/** * @test */ public function is_key_when_no_path_is_given() { $structureItem = new StructureItem('onlyAKey', StructureDefinition::STRING); $this->assertEquals('onlyAKey', $structureItem->pathWithKey()); }
/** * @param string|StructureItem $aPathOrStructureItem * @return bool */ public function isSubItemOf($aPathOrStructureItem) { if ($aPathOrStructureItem instanceof StructureItem) { $aPath = $aPathOrStructureItem->pathWithKey(); } else { Assertion::string($aPathOrStructureItem); $aPath = $aPathOrStructureItem; } return strpos($this->path(), $aPath) === 0; }