-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a27292d
commit 1fd72b5
Showing
12 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace MiroClipboard\Exceptions; | ||
|
||
use Throwable; | ||
|
||
class InvalidDataException extends MiroDataException | ||
{ | ||
public function __construct(int $code = 0, ?Throwable $previous = null) | ||
{ | ||
parent::__construct('Unable to parse miro clipboard data', $code, $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace MiroClipboard\Exceptions; | ||
|
||
class MiroDataException extends \Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace MiroClipboard\Utility; | ||
|
||
use MiroClipboard\MiroClipboardData; | ||
use MiroClipboard\Objects\MiroGroup; | ||
|
||
trait HasGroup | ||
{ | ||
protected ?MiroGroup $group = null; | ||
|
||
public function group(): ?MiroGroup | ||
{ | ||
return $this->group; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
public function setGroup(MiroGroup $group): static | ||
{ | ||
$this->group = $group; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param MiroClipboardData $clipboardData | ||
* | ||
* @return void | ||
* | ||
* @internal | ||
*/ | ||
public function resolveGroupClipboardDataReferences(MiroClipboardData $clipboardData): void | ||
{ | ||
foreach ($clipboardData->getObjects() as $object) { | ||
if ($object instanceof MiroGroup) { | ||
if (in_array($this->getId(), $found = $object->toArray()['items'])) { | ||
if (in_array(HasGroup::class, class_uses(static::class))) { | ||
$this->group = $object; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters