for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cloudstek\SCIM\FilterParser\AST;
/**
* Attribute path.
*/
class AttributePath implements \ArrayAccess, \IteratorAggregate, \Countable
{
private ?string $schema;
private array $names;
*
* @param string $schema
* @param string[] $names
* @throws \InvalidArgumentException On empty array of names.
public function __construct(?string $schema, array $names)
if (empty($names)) {
throw new \InvalidArgumentException('Attribute path should contain at least one attribute name.');
}
$this->schema = $schema;
$this->names = $names;
* Get schema URI.
* @return string|null
public function getSchema(): ?string
return $this->schema;
* Get names.
* @return string[]
public function getNames(): array
return $this->names;
* Get attribute names as dotted path notation.
* @return string
public function getPath(): string
return implode('.', $this->names);
* @inheritDoc
public function offsetExists($offset)
return isset($this->names[$offset]);
public function offsetGet($offset)
return $this->names[$offset];
public function offsetSet($offset, $value)
throw new \LogicException('Attribute path is read-only.');
public function offsetUnset($offset)
public function count()
return count($this->names);
public function getIterator()
return new \ArrayIterator($this->names);
public function __toString()
return $this->getPath();