Returns the evalutead menu item whether from the childOf property or set from the setter method.
@return Item
@throws Exception
11377
public function getItem()
    {
        if ($this->_item === null) {
            $this->_item = Yii::$app->menu->find()->where(['id' => $this->childOf])->with('hidden')->one();
            
            if (!$this->_item) {
                throw new Exception("Unable to find item with id " . $this->childOf);
            }
        }
        
        return $this->_item;
    }
925674
public function getParent()
	{
		if ( ! $this->hasParent()) {
			return null;
		}
		$parents = $this->getAncestors(1);
		if ( ! isset($parents[0])) {
			$dump = static::dump($this);
			throw new Exception\InvalidStructure("Parent node was not found for {$dump} but must exist");
		}
		$parent = $parents[0];
		
		return $parent;
	}
119258
public function getMenu(string $name): Menu
    {
        if (!$this->hasMenu($name)) {
            throw new Exception('Invalid menu name "'.$name.'"');
        }

        return $this->menus[$name];
    }
303253
public function getMainItem()
    {
        $menuPage = $this->menuBuilder->getTopNavbar()->getChild('menu.page');

        if ($menuPage) {
            return $menuPage;
        } else {
            return $this->menuBuilder->createDropdownMenuItem(
                $this->menuBuilder->getTopNavbar(),
                'menu.page'
            );
        }
    }
717699
private function getProperty($name)
    {
        if (!Property::exists($this->properties, $name)) {
            throw new \Exception();
        }

        return Property::get($this->properties, $name);
    }
1015391
protected function NextItem()
	{
		MoveNextIter:

		if ( ! $this->accept )
		{
			if ( ! $this->iter->MoveNext() )
				return null;

			if ( ! $this->iter->getCurrent() instanceof XPathNavigator )
			{
				throw XPath2Exception::withErrorCodeAndParam( "XPTY0019", Resources::XPTY0019, $this->iter->getCurrent()->Value );
			}

			/**
			 * @var XPathNavigator $current
			 */
			$current = $this->iter->getCurrent();

			if ( is_null( $this->curr ) || ! $this->curr->MoveTo( $current ) )
			{
				$this->curr = $current->CloneInstance();
			}

			$this->sequentialPosition = 0;
			$this->accept = true;
		}

		MoveToFirstChild:

		if ( $this->curr->MoveToChild( $this->kind ) )
		{
			$this->depth++;
			goto TestItem;
		}

		MoveToNext:

		if ( $this->depth == 0 )
		{
			$this->accept = false;
			goto MoveNextIter;
		}

		if ( ! $this->curr->MoveToNext( $this->kind ) )
		{
			$this->curr->MoveToParent();
			$this->depth--;
			goto MoveToNext;
		}

		TestItem:

		if ( $this->depth < count( $this->nodeTest ) || ! $this->TestItem( $this->curr, $this->lastTest ) )
			goto MoveToFirstChild;

		if ( is_null( $this->nav ) || ! $this->nav->MoveTo( $this->curr ) )
		{
			$this->nav = $this->curr->CloneInstance();
		}

		for ( $k = count( $this->nodeTest ) - 2; $k >= 0; $k--)
		{
			if ( ! ( $this->nav->MoveToParent() && $this->TestItem( $this->nav, $this->nodeTest[ $k ] ) ) )
				goto MoveToFirstChild;
		}

		$this->sequentialPosition++;
		return $this->curr;
	}
526858
public function evaluate()
    {
        if ($this->property === null) {
            throw new BuildException('Property name must be set.');
        }
        $value = $this->getProject()->getProperty($this->property);

        return $value === null || !Project::toBoolean($value);
    }
496713
public function getSettingsKey(): string
    {
        $key = $this->settingsKey;

        if (empty($this->$key)) {
            throw new Exception("No settings key is set on the constructor");
        }

        return $this->$key;
    }
405966
public function getParent() {
		$parentid = $this->{$this->parentKeyName};
		if (empty($parentid)) {
			return NULL;
		}
		$collname = $this->collectionName;
		$bitems = $collname::getInstance();
		$fparent = $bitems->itemGet($parentid);
		return $fparent;
	}
485587
public function getPrimaryProperty()
    {
        foreach ($this->properties as $property) {

            if ($property->hasOption(Entity\Reflection\Property\Option\Primary::KEY)) {
                return $property;
            }
        }
        throw new \Exception(
            "Primary property not defined in " . $this->className . "!"
        );
    }
450900
public function getItems()
    {
        if (null === $this->items) {
            /** @var \Darvin\AdminBundle\Menu\Item[] $items */
            $items = $skipped = [];

            foreach ($this->itemFactories as $itemFactory) {
                foreach ($itemFactory->getItems() as $item) {
                    if (isset($items[$item->getName()])) {
                        throw new MenuException(sprintf('Menu item "%s" already exists.', $item->getName()));
                    }
                    if (null === $item->getIndexUrl() && null === $item->getNewUrl()) {
                        $skipped[$item->getName()] = true;

                        continue;
                    }

                    $associatedObject = $item->getAssociatedObject();

                    if (!empty($associatedObject)
                        && (!$this->authorizationChecker->isGranted(Permission::VIEW, $associatedObject) && !$this->authorizationChecker->isGranted(Permission::CREATE_DELETE, $associatedObject))
                    ) {
                        $skipped[$item->getName()] = true;

                        continue;
                    }

                    $items[$item->getName()] = $item;
                }
            }

            $this->sortItems($items);

            foreach ($items as $item) {
                if (!$item->hasParent()) {
                    continue;
                }

                $parentName = $item->getParentName();

                if (isset($skipped[$parentName])) {
                    continue;
                }
                if (!isset($items[$parentName])) {
                    $items[$parentName] = $this->createItemGroup($parentName, $item->getPosition());
                }

                $parent = $items[$parentName];
                $parent->addChild($item);
            }
            foreach ($items as $key => $item) {
                if ($item->hasParent() && !isset($skipped[$item->getParentName()])) {
                    unset($items[$key]);
                }
            }

            $this->sortItems($items);

            $this->items = $items;
        }

        return $this->items;
    }
1160062
public function evaluate()
    {
        if ($this->property === null) {
            throw new BuildException(
                "No property specified for isset "
                . "condition"
            );
        }

        return $this->project->getProperty($this->property) !== null;
    }
147253
protected function get($name)
    {
        if (isset($this->site[$name])) {
            return $this->site[$name];
        }

        throw new Exception("The property $name could not be found on the website ID " . (int)$this->id);
    }
896977
protected function NextItem()
	{
		while (true)
		{
			if ( ! is_null( $this->childIter ) )
			{
				if ( $this->childIter->MoveNext() )
					return $this->childIter->getCurrent();
				else
					$this->childIter = null;
			}

			if ( $this->iter->MoveNext() )
			{
				$res = $this->iter->current();

				if ( $res instanceof XPath2NodeIterator )
				{
					$this->childIter = $res;
				}
				else
				{
					$this->childIter = null;
					return $res instanceof XPathItem
						? $res
						: XPath2Item::fromValue( $res );
				}
			}
			else
			{
				return null;
			}
		}
	}
717025
protected function _deriveViewVar()
    {
        if ($this->scope() === 'table') {
            return Inflector::variable($this->_controller()->getName());
        }

        if ($this->scope() === 'entity') {
            return Inflector::variable(Inflector::singularize($this->_controller()->getName()));
        }

        throw new Exception('Unknown action scope: ' . $this->scope());
    }
1203079
protected function evaluateSet()
    {
        
        common_Logger::d('Constructed Set TYPE', array('Generis Term evaluateSet'));
    	$operator = $this->getUniquePropertyValue(new core_kernel_classes_Property(RulesRdf::PROPERTY_SET_OPERATOR));
    	$subSets = $this->getPropertyValuesCollection(new core_kernel_classes_Property(RulesRdf::PROPERTY_SUBSET));
    	$returnValue = new core_kernel_classes_ContainerCollection($this);

		foreach ($subSets->getIterator() as $aSet) {
    		
    		if ($aSet instanceof core_kernel_classes_Resource ) {
    			$newSet = new core_kernel_rules_Term($aSet->getUri());
    			$resultSet = $newSet->evaluate();
    			if ($resultSet instanceof core_kernel_classes_ContainerCollection  ) {
    				$returnValue = $this->evalutateSetOperation($operator,$returnValue,$resultSet);
				}
    			else {
					$collection = new core_kernel_classes_ContainerCollection($this);
    				$collection->add($resultSet);
    				$returnValue = $this->evalutateSetOperation($operator,$returnValue,$collection);
    			}	
    		}
    		else {
    			throw new common_Exception('Bad Type , waiting for a Resource ');
    		}
    	   
    	}    		
    	
    	return $returnValue;
        
    }
201823
public static function getTree()
    {
        $menu = MenuItem::orderBy('lft')->get();

        if ($menu->count())
        {
            foreach ($menu as $k => $menu_item) {
                $menu_item->children = collect([]);

                foreach ($menu as $i => $menu_subitem) {
                    if ($menu_subitem->parent_id == $menu_item->id) {
                        $menu_item->children->push($menu_subitem);

                        // remove the subitem for the first level
                        $menu = $menu->reject(function ($item) use ($menu_subitem) {
                            return $item->id == $menu_subitem->id;
                        });
                    }
                }
            }
        }

        return $menu;
    }