protected function filterProjects(array &$projects, array $filters)
    {
        foreach ($filters as $filter => $value) {
            switch ($filter) {
                case 'host':
                    $projects = array_filter($projects, function (Project $project) use ($value) {
                        return $value === parse_url($project->getUri(), PHP_URL_HOST);
                    });
                    break;

                case 'title':
                    $projects = array_filter($projects, function (Project $project) use ($value) {
                        return stripos($project->title, $value) !== false;
                    });
                    break;

                case 'my':
                    $ownerId = $this->api()->getMyAccount()['id'];
                    $projects = array_filter($projects, function (Project $project) use ($ownerId) {
                        return $project->owner === $ownerId;
                    });
                    break;
            }
        }
    }
protected function filterProjects(array &$projects, array $filters)
    {
        foreach ($filters as $filter => $value) {
            switch ($filter) {
                case 'host':
                    $projects = array_filter($projects, function (Project $project) use ($value) {
                        return $value === parse_url($project->getUri(), PHP_URL_HOST);
                    });
                    break;

                case 'title':
                    $projects = array_filter($projects, function (Project $project) use ($value) {
                        return stripos($project->title, $value) !== false;
                    });
                    break;

                case 'my':
                    $ownerId = $this->api()->getMyAccount()['id'];
                    $projects = array_filter($projects, function (Project $project) use ($ownerId) {
                        return $project->owner === $ownerId;
                    });
                    break;
            }
        }
    }
protected function filterProjects ( array & $ projects , array $ filters ) { foreach ( $ filters as $ filter => $ value ) { switch ( $ filter ) { case 'host' : $ projects = array_filter ( $ projects , function ( Project $ project ) use ( $ value ) { return $ value === parse_url ( $ project -> getUri ( ) , PHP_URL_HOST ) ; } ) ; break ; case 'title' : $ projects = array_filter ( $ projects , function ( Project $ project ) use ( $ value ) { return stripos ( $ project -> title , $ value ) !== false ; } ) ; break ; case 'my' : $ ownerId = $ this -> api ( ) -> getMyAccount ( ) [ 'id' ] ; $ projects = array_filter ( $ projects , function ( Project $ project ) use ( $ ownerId ) { return $ project -> owner === $ ownerId ; } ) ; break ; } } }
Filter the list of projects.

@param Project[]     &$projects
@param mixed[string] $filters
Filter the list of projects .