Loading LuckPermsApi/Group.php→LuckPermsApi/Group/Group.php +1 −1 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi; namespace ApertureDevelopment\LuckPermsApi\Group; class Group { private string $name; Loading LuckPermsApi/Group/GroupList.php 0 → 100644 +5 −0 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi\Group; class GroupList {} No newline at end of file LuckPermsApi/Lib/DataCollection.php 0 → 100644 +171 −0 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi\Lib; use ArrayIterator; use stdClass; use Traversable; /** * Simple Data Collection * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development * @license MIT */ class DataCollection implements \Countable, \IteratorAggregate, \JsonSerializable, \ArrayAccess { /** * Count variable to keep track of the count of items in this collection * * @var integer * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ protected $_dataCount = 0; /** * Data container * * @var array * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ protected $_dataContainer; /** * Class Constructor * * @param \stdClass|null $object The stdClass object to initialize this data collection over * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function __construct(stdClass $object = null) { if(isset($object)) { foreach ($object as $key => $value) { $this->insert($value, $key); $this->_dataCount++; } } } /** * Insert value into collection * * @param mixed $anyValue Any value you want to insert into the collection * @param integer|null $position The position you want to insert your value at * @return DataCollection This data collection * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function insert(mixed $anyValue, int $position = null): DataCollection { if(isset($position)) { if(!$this->offsetExists($position)) { $this->_dataCount++; } $this->offsetSet($position, $anyValue); } else { $this->_dataCount++; $this->offsetSet(null, $anyValue); } return $this; } /** * Remove value from collection * * @param integer $position The position you want to remove the value from * @return DataCollection This data collection * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function remove(int $position): DataCollection { if($this->offsetExists($position)) { $this->offsetUnset($position); $this->_dataCount--; } return $this; } /** * Find values in the collection * * @param mixed $anySearchTerm Any term you want to search for * @return DataCollection A new data collection only containing the results * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function find(mixed $anySearchTerm): DataCollection { $results = new $this(); foreach ($this->_dataContainer as $key => $value) { if(is_string($value)) { if($anySearchTerm == $value) { $results->insert($value, $key); } } elseif(is_subclass_of($value, 'DataCollection')) { if($value->find($anySearchTerm)) { $results->insert($value, $key); } } } return $results; } /** * @inheritDoc */ public function getIterator(): Traversable { return new ArrayIterator($this->_dataContainer); } /** * @inheritDoc */ public function count(): int { return $this->_dataCount; } /** * @inheritDoc */ public function jsonSerialize() { return $this->_dataContainer; } /** * @inheritDoc */ public function offsetExists(mixed $offset): bool { return isset($this->_dataContainer[$offset]); } /** * @inheritDoc */ public function offsetGet(mixed $offset): mixed { return isset($this->_dataContainer[$offset]) ? $this->_dataContainer[$offset] : null; } /** * @inheritDoc */ public function offsetSet(mixed $offset, mixed $value): void { if(is_null($offset)) { $this->_dataContainer[] = $value; } else { $this->_dataContainer[$offset] = $value; } } /** * @inheritDoc */ public function offsetUnset(mixed $offset): void { if(isset($this->_dataContainer[$offset])) { unset($this->_dataContainer[$offset]); } } } No newline at end of file LuckPermsApi/HttpRequest.php→LuckPermsApi/Lib/HttpRequest.php +1 −1 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi; namespace ApertureDevelopment\LuckPermsApi\Lib; use Exception; /** Loading LuckPermsApi/LuckPermsApi.php +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace ApertureDevelopment\LuckPermsApi; use ApertureDevelopment\LuckPermsApi\Lib\HttpRequest; class LuckPermsApi { private $httpRequest; Loading Loading
LuckPermsApi/Group.php→LuckPermsApi/Group/Group.php +1 −1 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi; namespace ApertureDevelopment\LuckPermsApi\Group; class Group { private string $name; Loading
LuckPermsApi/Group/GroupList.php 0 → 100644 +5 −0 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi\Group; class GroupList {} No newline at end of file
LuckPermsApi/Lib/DataCollection.php 0 → 100644 +171 −0 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi\Lib; use ArrayIterator; use stdClass; use Traversable; /** * Simple Data Collection * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development * @license MIT */ class DataCollection implements \Countable, \IteratorAggregate, \JsonSerializable, \ArrayAccess { /** * Count variable to keep track of the count of items in this collection * * @var integer * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ protected $_dataCount = 0; /** * Data container * * @var array * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ protected $_dataContainer; /** * Class Constructor * * @param \stdClass|null $object The stdClass object to initialize this data collection over * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function __construct(stdClass $object = null) { if(isset($object)) { foreach ($object as $key => $value) { $this->insert($value, $key); $this->_dataCount++; } } } /** * Insert value into collection * * @param mixed $anyValue Any value you want to insert into the collection * @param integer|null $position The position you want to insert your value at * @return DataCollection This data collection * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function insert(mixed $anyValue, int $position = null): DataCollection { if(isset($position)) { if(!$this->offsetExists($position)) { $this->_dataCount++; } $this->offsetSet($position, $anyValue); } else { $this->_dataCount++; $this->offsetSet(null, $anyValue); } return $this; } /** * Remove value from collection * * @param integer $position The position you want to remove the value from * @return DataCollection This data collection * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function remove(int $position): DataCollection { if($this->offsetExists($position)) { $this->offsetUnset($position); $this->_dataCount--; } return $this; } /** * Find values in the collection * * @param mixed $anySearchTerm Any term you want to search for * @return DataCollection A new data collection only containing the results * * @author Maximilian Grüttemeier <m.gruettemeier@Aperture-Development.de> * @copyright 2022 Aperture Development */ public function find(mixed $anySearchTerm): DataCollection { $results = new $this(); foreach ($this->_dataContainer as $key => $value) { if(is_string($value)) { if($anySearchTerm == $value) { $results->insert($value, $key); } } elseif(is_subclass_of($value, 'DataCollection')) { if($value->find($anySearchTerm)) { $results->insert($value, $key); } } } return $results; } /** * @inheritDoc */ public function getIterator(): Traversable { return new ArrayIterator($this->_dataContainer); } /** * @inheritDoc */ public function count(): int { return $this->_dataCount; } /** * @inheritDoc */ public function jsonSerialize() { return $this->_dataContainer; } /** * @inheritDoc */ public function offsetExists(mixed $offset): bool { return isset($this->_dataContainer[$offset]); } /** * @inheritDoc */ public function offsetGet(mixed $offset): mixed { return isset($this->_dataContainer[$offset]) ? $this->_dataContainer[$offset] : null; } /** * @inheritDoc */ public function offsetSet(mixed $offset, mixed $value): void { if(is_null($offset)) { $this->_dataContainer[] = $value; } else { $this->_dataContainer[$offset] = $value; } } /** * @inheritDoc */ public function offsetUnset(mixed $offset): void { if(isset($this->_dataContainer[$offset])) { unset($this->_dataContainer[$offset]); } } } No newline at end of file
LuckPermsApi/HttpRequest.php→LuckPermsApi/Lib/HttpRequest.php +1 −1 Original line number Diff line number Diff line <?php namespace ApertureDevelopment\LuckPermsApi; namespace ApertureDevelopment\LuckPermsApi\Lib; use Exception; /** Loading
LuckPermsApi/LuckPermsApi.php +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace ApertureDevelopment\LuckPermsApi; use ApertureDevelopment\LuckPermsApi\Lib\HttpRequest; class LuckPermsApi { private $httpRequest; Loading