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;
    }