Check if a path is contained in the perimeter

@param string             $item
@param PerimeterInterface $perimeter

@return boolean
963187
public function isInPerimeter($item, PerimeterInterface $perimeter)
    {
        if (isset($this->strategies[$perimeter->getType()])) {
            return $this->strategies[$perimeter->getType()]->isInPerimeter($item, $perimeter);
        }

        return false;
    }
480886
public static boolean contains(@Nonnull Item item) {
        ItemDeletion instance = instance();
        if (instance == null) {
            return false;
        }
        instance.lock.readLock().lock();
        try {
            return instance._contains(item);
        } finally {
            instance.lock.readLock().unlock();
        }
    }
195034
public function contains(ValueObjectInterface $object)
    {
        foreach ($this->items as $item) {
            if ($item->sameValueAs($object)) {
                return true;
            }
        }

        return false;
    }
1153323
protected function locate($item): ?ItemBucket
    {
        for ($this->rewind(); $this->valid(); $this->next()) {
            /** @var ItemBucket $current */
            $current = $this->current;
            if (Validate::areEqual($item, $current->item())) {
                return $current;
            }
        }

        return null;
    }
68327
private function resolvePathToContent(array $item)
    {
        if ($item['path'] === 'homepage') {
            $item['link'] = $this->app['url_generator']->generate('homepage');

            return $item;
        }

        // We have a mistakenly placed URL, allow it but log it.
        if (preg_match('#^(https?://|//)#i', $item['path'])) {
            $item['link'] = $item['path'];
            $this->app['logger.system']->error(
                Trans::__(
                    'Invalid menu path (%PATH%) set in menu.yml. Probably should be a link: instead!',
                    ['%PATH%' => $item['path']]
                ),
                ['event' => 'config']
            );

            return $item;
        }

        // Get a copy of the path minus trailing/leading slash
        $path = trim($item['path'], '/');

        // Pre-set our link in case the match() throws an exception
        $basePath = '';
        if ($request = $this->app['request_stack']->getCurrentRequest()) {
            $basePath = $request->getBasePath();
        }
        $item['link'] = $basePath . '/' . $path;

        try {
            // See if we have a 'content/id' or 'content/slug' path
            if (preg_match('#^([a-z0-9_-]+)/([a-z0-9_-]+)$#i', $path)) {
                // Determine if the provided path first matches any routes
                // that we have, this will catch any valid configured
                // contenttype slug and record combination, or throw a
                // ResourceNotFoundException exception otherwise
                $this->app['url_matcher']->match('/' . $path);

                // If we found a valid routing match then we're still here,
                // attempt to retrieve the actual record and use its values.
                $item = $this->populateItemFromRecord($item, $path);
            }
        } catch (ResourceNotFoundException $e) {
            $this->app['logger.system']->error(
                Trans::__(
                    'Invalid menu path (%PATH%) set in menu.yml. Does not match any configured contenttypes or routes.',
                    ['%PATH%' => $item['path']]
                ),
                ['event' => 'config']
            );
        } catch (MethodNotAllowedException $e) {
            // Route is probably a GET and we're currently in a POST
        }

        return $item;
    }
754981
protected function checkList($item)
	{
		$inList = in_array($item, $this->list);
		
		$allow = null;
		
		if ($this->mode == self::MODE_BLACKLIST) {
			$allow = ! $inList;
		} else {
			$allow = $inList;
		}
		
		return $allow;
	}
722760
private static function isSorted($item)
    {
        return
            (is_object($item) && null !== $item->getPosition())
            ||
            (is_array($item) && isset($item[static::POSITION_KEY]));
    }
16424
public function isAncestor(ItemInterface $item, $depth = null): bool
    {
        $request = $this->request_stack->getCurrentRequest();

        return 0 === strpos($request->getPathInfo(), $item->getUri());
    }
1308297
public static function checkType($item)
    {
        if (is_string($item)) {
            // Item is a string; check to see if it's a URL or filepath
            if (filter_var($item, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)) {
                // Item is a URL
                return Type::URL;
            } elseif (is_file(config('filer.path.absolute') . "/{$item}")) {
                // Item is a filepath
                return Type::FILEPATH;
            }
        } elseif (is_a($item, 'SplFileInfo')) {
            // Item is a file object
            return Type::FILE;
        }

        // Throw an exception if item doesn't match any known types
        throw new Exception('Unknown item type');
    }
1211255
private function menuHelper($item)
    {
        // recurse into submenus
        if (isset($item['submenu']) && is_array($item['submenu'])) {
            $item['submenu'] = $this->menuHelper($item['submenu']);
        }

        if (isset($item['route'])) {
            $item['link'] = $this->resolveRouteToLink($item);
        } elseif (isset($item['path'])) {
            $item = $this->resolvePathToContent($item);
        }

        return $item;
    }
576003
private function _isLink($item): bool
	{
		if ($item === null) {
			return true;
		} elseif (is_array($item)) {
			return !is_array(current($item));
		} else {
			throw new \InvalidArgumentException('Cms menu items is wrong in config.neon');
		}
	}
522977
protected function satisfied($item)
    {
        $pass = true;
        foreach ($this->getDependents($item) as $dep) {
            if ($this->isSorted($dep)) {
                continue;
            }

            if (! $this->exists($item)) {
                $this->setMissing($item, $dep);
                if ($pass) {
                    $pass = false;
                }
            }
            if (! $this->hasDependents($dep)) {
                if ($pass) {
                    $pass = false;
                }
            } else {
                $this->setFound($item, $dep);
            }
            if ($this->isDependent($item, $dep)) {
                $this->setCircular($item, $dep);
                if ($pass) {
                    $pass = false;
                }
            }
        }

        return $pass;
    }
571679
private function absolutePath($item) {

		// Sanity Check
		if (!is_string($item) && !$item instanceOf Model) throw new \UnexpectedValueException('Path should be a string or object.');

		// Item is already a fully-qualified URL
		if ((strpos($item, 'https://') !== false)) return $item;

		// Else, build URL
		$url  = $this->host;

		// Path from Item
		if (is_string($item)) $path = ltrim($item, '/');
		if ($item instanceOf Model) $path = strtolower(get_class($item)).'s/'.self::getId($item);

		// Return URL
		$auth = (!empty($this->token)) ? '?'.http_build_query(['auth' => $this->token]) : '';
		return $url.$path.'.json'.$auth;
	}
511995
public function findByPerimeter(Perimeter $perimeter)
    {
        $qb = $this->createQueryBuilder('s');
        $qb->where("s.perimeter = :perimeter")
            ->setParameter('perimeter', $perimeter)
            ->orderBy('s.startDate', 'DESC')
        ;

        return $qb->getQuery()->getResult();
    }
363542
protected function filter(\SplFileInfo $item) : bool
    {
        $filename = $item->getFilename();

        if (!$this->includeHidden && $filename{0} == '.') {
            return false;
        }

        if ($this->includeNames) {
            if (!in_array($filename, $this->includeNames, true)) {
                return false;
            }
        }
        elseif ($this->excludeNames && in_array($filename, $this->excludeNames, true)) {
            return false;
        }

        if ($this->includeExtensions) {
            if (!$this->longExtensions) {
                if (!in_array($item->getExtension(), $this->includeExtensions, true)) {
                    return false;
                }
            } else {
                $matches = false;
                foreach ($this->includeExtensions as $ext) {
                    if (
                        ($pos = strpos($filename, '.' . $ext)) !== false
                        && $pos == strlen($filename) - strlen($ext) - 1
                    ) {
                        $matches = true;
                        break;
                    }
                }
                if (!$matches) {
                    return false;
                }
            }
        }
        elseif ($this->excludeExtensions) {
            if (!$this->longExtensions) {
                if (in_array($item->getExtension(), $this->excludeExtensions, true)) {
                    return false;
                }
            } else {
                foreach ($this->excludeExtensions as $ext) {
                    if (
                        ($pos = strpos($filename, '.' . $ext)) !== false
                        && $pos == strlen($filename) - strlen($ext) - 1
                    ) {
                        return false;
                    }
                }
            }
        }

        if ($this->includeParents || $this->excludeParents) {
            $parent_path = $item->getPathname();
            $parent_path = substr($parent_path, 0, -strlen($filename) - 1);
            if ($this->includeParents) {
                if ($parent_path === false) {
                    // No space for any parent path.
                    return false;
                }
                $matches = false;
                foreach ($this->includeParents as $name) {
                    if (
                        ($pos = strpos($parent_path, '/' . $name)) !== false
                        && $pos == strlen($parent_path) - strlen($name) - 1
                    ) {
                        $matches = true;
                        break;
                    }
                }
                if (!$matches) {
                    return false;
                }
            }
            elseif ($parent_path !== false) {
                foreach ($this->excludeParents as $name) {
                    if (
                        ($pos = strpos($parent_path, '/' . $name)) !== false
                        && $pos == strlen($parent_path) - strlen($name) - 1
                    ) {
                        return false;
                    }
                }
            }
        }

        if ($this->customFilter) {
            return call_user_func_array($this->customFilter, [$item]);
        }

        return true;
    }
744628
public function equals(ItemInterface $item)
    {
        // It is exactly the same item.
        if ($this === $item) {
            return true;
        }

        // The actions are not equal.
        if ($this->getAction() !== $item->getAction()) {
            return false;
        }

        // One has a parent ID, the other not.
        if (($this->getParentId() && !$item->getParentId()) || (!$this->getParentId() && $item->getParentId())) {
            return false;
        }

        // The parent IDs are not equal.
        if ($this->getParentId() && !$this->getParentId()->equals($item->getParentId())) {
            return false;
        }

        // One has a model ID, the other not.
        if (($this->getModelId() && !$item->getModelId()) || (!$this->getModelId() && $item->getModelId())) {
            return false;
        }

        // Both have no model id and the data provider is different.
        if (!($this->getModelId() || $item->getModelId())) {
            return ($this->getDataProviderName() === $item->getDataProviderName());
        }

        // The model IDs are not equal
        return $this->getModelId()->equals($item->getModelId());
    }
165048
public function contains( $item ) {
			
			for ( $i=0; $i < $this->len; $i++ ) {
			
				if ( $this->compare( $item, $this->items[$i] ) === 0 ) {
			
					return true;
			
				}
			
			}

			return false;
		}