OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
1.4 KiB

<?php
namespace App\Helpers;
/**
*
*
*
*
*/
class NginxTemplateHelper
{
// path for templates files
const TEMPLATES_PATH = '/ressources/templates';
// path for custom template files
const CUSTOM_TEMPLATES_PATH = '/ressources/templates/custom';
/**
*
*
*
* @return array
*
*/
private function getTemplates()
{
$results = [];
array_merge(
scandir(self::TEMPLATES_PATH),
scandir(self::CUSTOM_TEMPLATES_PATH)
);
return $templates;
}
/**
*
* @param [type] $files [description]
* @param [type] $templatePath [description]
* @return [type] [description]
*/
private function getTemplates($templatePath)
{
$results = [];
foreach(scandir(base_dir().$templatePath) as $file) {
if (!in_array($file, self::IGNORE_FILES)) {
$results[] = [
'filename' => $file,
'path' => $templatePath
];
}
}
return $results;
}
/**
* getting templates
*
*/
public function find()
{
$results = array_merge(
$this->getTemplates(self::TEMPLATES_DIR),
$this->getTemplates(self::TEMPLATES_CUSTOM_DIR)
);
return $results;
}
}