protected function findTemplatesFiles(array $templatesNames = [])
    {
        $findAll = ($templatesNames == []);

        if ($findAll) {
            $files = FileHelper::findFiles(Yii::getAlias($this->templatePath), ['only' => ['*.php']]);
        } else {
            $filesToSearch = [];

            foreach ($templatesNames as $fileName) {
                $filesToSearch[] = $fileName . '.php';
            }

            $files = FileHelper::findFiles(Yii::getAlias($this->templatePath), ['only' => $filesToSearch]);
        }

        $foundTemplates = [];

        foreach ($files as $fileName) {
            // strip templatePath from current template's full path
            $relativeName = str_replace(Yii::getAlias($this->templatePath) . DIRECTORY_SEPARATOR, "", $fileName);
            $relativeDir = dirname($relativeName) == '.' ? '' : dirname($relativeName) . '/';
            // strip extension
            $relativeName = $relativeDir . basename($relativeName,'.php');
            $foundTemplates[] = $relativeName;
        }

        return $foundTemplates;
    }
protected function findTemplatesFiles(array $templatesNames = [])
    {
        $findAll = ($templatesNames == []);

        if ($findAll) {
            $files = FileHelper::findFiles(Yii::getAlias($this->templatePath), ['only' => ['*.php']]);
        } else {
            $filesToSearch = [];

            foreach ($templatesNames as $fileName) {
                $filesToSearch[] = $fileName . '.php';
            }

            $files = FileHelper::findFiles(Yii::getAlias($this->templatePath), ['only' => $filesToSearch]);
        }

        $foundTemplates = [];

        foreach ($files as $fileName) {
            // strip templatePath from current template's full path
            $relativeName = str_replace(Yii::getAlias($this->templatePath) . DIRECTORY_SEPARATOR, "", $fileName);
            $relativeDir = dirname($relativeName) == '.' ? '' : dirname($relativeName) . '/';
            // strip extension
            $relativeName = $relativeDir . basename($relativeName,'.php');
            $foundTemplates[] = $relativeName;
        }

        return $foundTemplates;
    }
protected function findTemplatesFiles ( array $ templatesNames = [ ] ) { $ findAll = ( $ templatesNames == [ ] ) ; if ( $ findAll ) { $ files = FileHelper :: findFiles ( Yii :: getAlias ( $ this -> templatePath ) , [ 'only' => [ '*.php' ] ] ) ; } else { $ filesToSearch = [ ] ; foreach ( $ templatesNames as $ fileName ) { $ filesToSearch [ ] = $ fileName . '.php' ; } $ files = FileHelper :: findFiles ( Yii :: getAlias ( $ this -> templatePath ) , [ 'only' => $ filesToSearch ] ) ; } $ foundTemplates = [ ] ; foreach ( $ files as $ fileName ) { // strip templatePath from current template's full path $ relativeName = str_replace ( Yii :: getAlias ( $ this -> templatePath ) . DIRECTORY_SEPARATOR , "" , $ fileName ) ; $ relativeDir = dirname ( $ relativeName ) == '.' ? '' : dirname ( $ relativeName ) . '/' ; // strip extension $ relativeName = $ relativeDir . basename ( $ relativeName , '.php' ) ; $ foundTemplates [ ] = $ relativeName ; } return $ foundTemplates ; }
Returns array containing fixtures templates file names. You can specify what files to find
by the given parameter.
@param array $templatesNames template file names to search. If empty then all files will be searched.
@return array
@since 2.0.4
Returns array containing fixtures templates file names . You can specify what files to find by the given parameter .