Checks whether pattern should be applied based on whether the if and unless
properties are set in project.

@param  Project $project
@return boolean
978563
public function valid(Project $project)
    {
        if ($this->ifCond !== null && $project->getProperty($this->ifCond) === null) {
            return false;
        } else {
            if ($this->unlessCond !== null && $project->getProperty($this->unlessCond) !== null) {
                return false;
            }
        }

        return true;
    }
174095
protected function corrected($project = '')
    {
        if (! $project) return;

        $corrected = [];
        if ( $q = parent::makeup() ) {
            $corrected = parent::fuzzy($q)[$project]->getCorrectedQuery($q);
        }
        return $corrected;
    }
1160062
public function evaluate()
    {
        if ($this->property === null) {
            throw new BuildException(
                "No property specified for isset "
                . "condition"
            );
        }

        return $this->project->getProperty($this->property) !== null;
    }
82248
public function getExcludePatterns(Project $p)
    {
        if ($this->isReference()) {
            $o = $this->getRef($p);

            return $o->getExcludePatterns($p);
        } else {
            $this->readFiles($p);

            return $this->makeArray($this->excludeList, $p);
        }
    }
1051466
public function __isset($property)
	{
		if (array_key_exists($property, static::properties()))
		{
			return true;
		}
		elseif (static::relations($property))
		{
			return true;
		}
		elseif ($this->_get_eav($property, true))
		{
			return true;
		}
		elseif (array_key_exists($property, $this->_custom_data))
		{
			return true;
		}

		return false;
	}
22442
public static boolean hasFindBugsNature(IProject project) {
        try {
            return ProjectUtilities.isJavaProject(project) && project.hasNature(FindbugsPlugin.NATURE_ID);
        } catch (CoreException e) {
            FindbugsPlugin.getDefault().logException(e, "Error while testing SpotBugs nature for project " + project);
        }
        return false;
    }
48473
protected function suggests($project = '')
    {   
        if (! $project) return;

        $expand = []; 
        if ( $q = parent::makeup() ) { 
            $expand = parent::fuzzy($q)[$project]->getExpandedQuery($q, static::$limit);
        }
        return $expand;
    }
874
protected function getByName($project_name) {

        if (!strstr($project_name, ":")) {
            throw (new \Exception("You must search for project with namespace: prefix"));
        }
        $parts = explode(':', $project_name);

        $projects = $this->_client->get('/projects/search/' . urlencode($parts[1]));

        $found_project = false;
        foreach ($projects as $project) {
            if (preg_match("~^" . $parts[0] . "$~", $project->namespace->name)) {
                return $project;
            }
        }

        if (!$found_project) {
            return false;
        }
    }
1143950
protected function enableProject($enable, $project)
    {
        $project->timestamps = false;

        $project->enabled = $enable;

        $project->save();
    }
1034330
protected boolean existsProject(String projectName) {

        try {
            m_adminCms.readProject(projectName);
            return true;
        } catch (CmsException e) {
            return false;
        }
    }
155840
public static function checkRegexPattern($pattern)
  {
    $check = @preg_match($pattern, "anything"); // thats the easy way to check a pattern ;)
    if (is_integer($check) == false) return false;
    else return true;
  }
87353
public function execute(ProjectDescriptor $project)
    {
        $rootPackageDescriptor = new PackageDescriptor();
        $rootPackageDescriptor->setName('\\');
        $project->getIndexes()->set('packages', new Collection());
        $project->getIndexes()->packages['\\'] = $rootPackageDescriptor;

        foreach ($project->getFiles() as $file) {
            $this->addElementsOfTypeToPackage($project, array($file), 'files');
            $this->addElementsOfTypeToPackage($project, $file->getConstants()->getAll(), 'constants');
            $this->addElementsOfTypeToPackage($project, $file->getFunctions()->getAll(), 'functions');
            $this->addElementsOfTypeToPackage($project, $file->getClasses()->getAll(), 'classes');
            $this->addElementsOfTypeToPackage($project, $file->getInterfaces()->getAll(), 'interfaces');
            $this->addElementsOfTypeToPackage($project, $file->getTraits()->getAll(), 'traits');
        }
    }
1357557
public function hasProperty()
    {
        if (!array_key_exists($this->data[1], (array)$this->data[0])) {
            throw new DidNotMatchException();
        }

        return $this->data[0]->{$this->data[1]};
    }
625740
public function checkRoutePattern($patterns)
    {
        if (!$this->route) {
            return false;
        }

        $routeName = $this->route->getName();

        if ($routeName == null) {
            return in_array(null, $patterns);
        }

        foreach ((array)$patterns as $p) {
            if (str_is($p, $routeName)) {
                return true;
            }
        }

        return false;
    }
328195
public function addProject(Project $project)
    {
        $this->storage->updateProject($project);

        $this->projects[$project->getSlug()] = $project;
    }
324733
public function has($property)
    {
        if (is_array($property)) {
            foreach ($property as $item) {
                if (is_a($this->{$item}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) {
                    return ($this->{$item}->count()) ? true : false;
                } else {
                    return (!empty($this->{$item})) ? true : false;
                }
            }
        } else {
            if (is_a($this->{$property}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) {
                return ($this->{$property}->count()) ? true : false;
            } else {
                return (!empty($this->{$property})) ? true : false;
            }
        }
    }
131764
public function execute(ProjectDescriptor $project): void
    {
        $markerTerms = $project->getSettings()->getMarkers();

        foreach ($project->getFiles() as $file) {
            $marker_data = [];
            $matches = [];
            preg_match_all(
                '~//[\s]*(' . implode('|', $markerTerms) . ')\:?[\s]*(.*)~',
                $file->getSource(),
                $matches,
                PREG_SET_ORDER | PREG_OFFSET_CAPTURE
            );

            foreach ($matches as $match) {
                list($before) = str_split($file->getSource(), $match[1][1]); // fetches all the text before the match

                $line_number = strlen($before) - strlen(str_replace("\n", '', $before)) + 1;

                $marker_data[] = ['type' => trim($match[1][0], '@'), 'line' => $line_number, $match[2][0]];
            }

            $file->setMarkers(new Collection($marker_data));
        }
    }