diff --git a/.gitignore b/.gitignore index 9f78303..3eca4da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ composer.phar /vendor /examples/active_record/vendor +/examples/codeigniter/framework_files /.idea \ No newline at end of file diff --git a/composer.json b/composer.json index d825135..0474ffa 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mult1mate/cron-manager", "description": "Flexible cron tasks manager for MVC-type applications", - "minimum-stability": "dev", + "minimum-stability": "stable", "keywords": ["cron","crontab","tasks manager","schedule","codeigniter"], "homepage": "https://cron.multimate.ru", "license": "MIT", @@ -12,8 +12,8 @@ } ], "require": { - "php": ">=5.4.0", - "mtdowling/cron-expression": "dev-master" + "php": ">=5.3.2", + "mtdowling/cron-expression": "1.1.*" }, "autoload": { "psr-4": { diff --git a/examples/active_record/Controllers/BaseController.php b/examples/active_record/Controllers/BaseController.php index b34eaeb..e791bbf 100644 --- a/examples/active_record/Controllers/BaseController.php +++ b/examples/active_record/Controllers/BaseController.php @@ -11,8 +11,8 @@ public function __construct() { ActiveRecord\Config::initialize(function ($cfg) { $cfg->set_model_directory('../models'); - $cfg->set_connections([ - 'development' => 'mysql://root:qwerty@localhost/crontab']); + $cfg->set_connections(array( + 'development' => 'mysql://root:qwerty@localhost/crontab')); }); } diff --git a/examples/active_record/Controllers/TasksController.php b/examples/active_record/Controllers/TasksController.php index d51a9d0..899064b 100644 --- a/examples/active_record/Controllers/TasksController.php +++ b/examples/active_record/Controllers/TasksController.php @@ -13,15 +13,15 @@ class TasksController extends BaseController public function index() { - $this->renderView('tasks_list', [ + $this->renderView('tasks_list', array( 'tasks' => Task::getList(), 'methods' => TaskManager::getAllMethods(self::CONTROLLERS_FOLDER), - ]); + )); } public function export() { - $this->renderView('export', []); + $this->renderView('export', array()); } public function parseCrontab() @@ -36,7 +36,7 @@ public function exportTasks() { if (isset($_POST['folder'])) { $tasks = Task::getList(); - $result = []; + $result = array(); foreach ($tasks as $t) { $line = TaskManager::getTaskCrontabLine($t, $_POST['folder'], $_POST['php'], $_POST['file']); $result[] = nl2br($line); @@ -49,13 +49,13 @@ public function taskLog() { $task_id = isset($_GET['task_id']) ? $_GET['task_id'] : null; $runs = TaskRun::getLast($task_id); - $this->renderView('runs_list', ['runs' => $runs]); + $this->renderView('runs_list', array('runs' => $runs)); } public function runTask() { if (isset($_POST['task_id'])) { - $tasks = !is_array($_POST['task_id']) ? [$_POST['task_id']] : $_POST['task_id']; + $tasks = !is_array($_POST['task_id']) ? array($_POST['task_id']) : $_POST['task_id']; foreach ($tasks as $t) { $task = Task::find($t); /** @@ -120,10 +120,10 @@ public function taskEdit() $task = TaskManager::editTask($task, $_POST['time'], $_POST['command'], $_POST['status'], $_POST['comment']); } - $this->renderView('task_edit', [ + $this->renderView('task_edit', array( 'task' => $task, 'methods' => TaskManager::getAllMethods(self::CONTROLLERS_FOLDER), - ]); + )); } public function tasksUpdate() @@ -134,11 +134,11 @@ public function tasksUpdate() /** * @var Task $t */ - $action_status = [ + $action_status = array( 'Enable' => TaskInterface::TASK_STATUS_ACTIVE, 'Disable' => TaskInterface::TASK_STATUS_INACTIVE, 'Delete' => TaskInterface::TASK_STATUS_DELETED, - ]; + ); $t->setStatus($action_status[$_POST['action']]); $t->save(); } @@ -155,10 +155,10 @@ public function tasksReport() $date_begin = isset($_GET['date_begin']) ? $_GET['date_begin'] : date('Y-m-d', strtotime('-6 day')); $date_end = isset($_GET['date_end']) ? $_GET['date_end'] : date('Y-m-d'); - $this->renderView('report', [ + $this->renderView('report', array( 'report' => Task::getReport($date_begin, $date_end), 'date_begin' => $date_begin, 'date_end' => $date_end, - ]); + )); } } diff --git a/examples/active_record/models/Task.php b/examples/active_record/models/Task.php index 4dc9aa1..0122927 100644 --- a/examples/active_record/models/Task.php +++ b/examples/active_record/models/Task.php @@ -19,9 +19,9 @@ */ class Task extends Model implements TaskInterface { - static public $has_many = [ - ['taskruns', 'class_name' => 'TaskRun'] - ]; + static public $has_many = array( + array('taskruns', 'class_name' => 'TaskRun') + ); public static function taskGet($task_id) { @@ -30,10 +30,10 @@ public static function taskGet($task_id) public static function getList() { - return self::find('all', [ - 'conditions' => ['status in (?)', [TaskInterface::TASK_STATUS_ACTIVE, TaskInterface::TASK_STATUS_INACTIVE]], + return self::find('all', array( + 'conditions' => array('status in (?)', array(TaskInterface::TASK_STATUS_ACTIVE, TaskInterface::TASK_STATUS_INACTIVE)), 'order' => 'status, task_id desc', - ]); + )); } public static function getAll() @@ -43,7 +43,7 @@ public static function getAll() public static function getReport($date_begin, $date_end) { - return self::query(DbHelper::getReportSql(), [$date_begin, $date_end])->fetchAll(); + return self::query(DbHelper::getReportSql(), array($date_begin, $date_end))->fetchAll(); } public function taskDelete() diff --git a/examples/active_record/models/TaskRun.php b/examples/active_record/models/TaskRun.php index 27a7a21..799013b 100644 --- a/examples/active_record/models/TaskRun.php +++ b/examples/active_record/models/TaskRun.php @@ -16,15 +16,15 @@ */ class TaskRun extends Model implements TaskRunInterface { - static public $belongs_to = [ - ['task'] - ]; + static public $belongs_to = array( + array('task') + ); public static function getLast($task_id = null, $count = 100) { - $conditions = ['order' => 'task_run_id desc', 'include' => ['task'], 'limit' => $count]; + $conditions = array('order' => 'task_run_id desc', 'include' => array('task'), 'limit' => $count); if ($task_id) { - $conditions['conditions'] = ['task_id' => $task_id]; + $conditions['conditions'] = array('task_id' => $task_id); } return self::find('all', $conditions); diff --git a/examples/active_record/views/template.php b/examples/active_record/views/template.php index cac0a4e..5fc95d2 100644 --- a/examples/active_record/views/template.php +++ b/examples/active_record/views/template.php @@ -4,13 +4,13 @@ * Date: 21.12.15 * Time: 0:29 */ -$menu = [ +$menu = array( 'index' => 'Tasks list', 'taskEdit' => 'Add new/edit task', 'taskLog' => 'Logs', 'export' => 'Import/Export', 'tasksReport' => 'Report', -]; +); ?> Cron tasks manager diff --git a/examples/active_record/www/manager_actions.js b/examples/active_record/www/manager_actions.js index ea3a9cc..7742d8e 100644 --- a/examples/active_record/www/manager_actions.js +++ b/examples/active_record/www/manager_actions.js @@ -1,10 +1,11 @@ $(function () { + var controller_url = ''; //tasks list page $('.run_task').click(function () { if (confirm('Are you sure?')) { $('#output_section').show(); $('#task_output_container').text('Running...'); - $.post('?m=runTask', {task_id: $(this).attr('href')}, function (data) { + $.post(controller_url + '?m=runTask', {task_id: $(this).attr('href')}, function (data) { $('#task_output_container').html(data); }) } @@ -25,19 +26,19 @@ $(function () { if (confirm('Are you sure?')) { $('#output_section').show(); $('#task_output_container').text('Running...'); - $.post('?m=runTask', {task_id: tasks}, function (data) { + $.post(controller_url + '?m=runTask', {task_id: tasks}, function (data) { $('#task_output_container').html(data); }) } } else { - $.post('?m=tasksUpdate', {task_id: tasks, action: action}, function () { + $.post(controller_url + '?m=tasksUpdate', {task_id: tasks, action: action}, function () { window.location.reload(); }); } return false; }); $('.show_output').click(function () { - $.post('?m=getOutput', {task_run_id: $(this).attr('href')}, function (data) { + $.post(controller_url + '?m=getOutput', {task_run_id: $(this).attr('href')}, function (data) { $('#output_container').html(data); return false; }) @@ -46,7 +47,7 @@ $(function () { if (confirm('Are you sure?')) { $('#output_section').show(); $('#task_output_container').text('Running...'); - $.post('?m=runTask', {custom_task: $('#command').val()}, function (data) { + $.post(controller_url + '?m=runTask', {custom_task: $('#command').val()}, function (data) { $('#task_output_container').html(data); }) } @@ -59,7 +60,7 @@ $(function () { }); function getRunDates() { - $.post('?m=getDates', {time: $('#time').val()}, function (data) { + $.post(controller_url + '?m=getDates', {time: $('#time').val()}, function (data) { $('#dates_list').html(data); }) } @@ -78,7 +79,7 @@ $(function () { //export page $('#parse_crontab_form').submit(function () { - $.post('?m=parseCrontab', $(this).serialize(), function (data) { + $.post(controller_url + '?m=parseCrontab', $(this).serialize(), function (data) { var list = ''; data.forEach(function (element) { element.forEach(function (el) { @@ -91,7 +92,7 @@ $(function () { return false; }); $('#export_form').submit(function () { - $.post('?m=exportTasks', $(this).serialize(), function (data) { + $.post(controller_url + '?m=exportTasks', $(this).serialize(), function (data) { var list = ''; data.forEach(function (element) { list += '' + element + '
'; diff --git a/examples/codeigniter/application/controllers/TasksController.php b/examples/codeigniter/application/controllers/TasksController.php index 4bb99f6..c0b4dbd 100644 --- a/examples/codeigniter/application/controllers/TasksController.php +++ b/examples/codeigniter/application/controllers/TasksController.php @@ -11,7 +11,7 @@ */ class TasksController extends CI_Controller { - const CONTROLLERS_FOLDER = __DIR__ . '/../models'; + private $controller_folder; public function __construct() { @@ -20,22 +20,23 @@ public function __construct() $this->load->model('DbBaseModel'); $this->load->model('Task', 'task'); $this->load->model('TaskRun', 'task_run'); + $this->controller_folder = __DIR__ . '/../models'; - TaskManager::set_setting(TaskManager::SETTING_LOAD_CLASS, true); - TaskManager::set_setting(TaskManager::SETTING_CLASS_FOLDERS, self::CONTROLLERS_FOLDER); + TaskManager::setSetting(TaskManager::SETTING_LOAD_CLASS, true); + TaskManager::setSetting(TaskManager::SETTING_CLASS_FOLDERS, $this->controller_folder); } public function index() { - $this->load->view('tasks/tasks_list', [ - 'tasks' => Task::findAll(['not_in' => ['status', TaskInterface::TASK_STATUS_DELETED]]), - 'methods' => TaskManager::getAllMethods(self::CONTROLLERS_FOLDER), - ]); + $this->load->view('tasks/tasks_list', array( + 'tasks' => Task::findAll(array('not_in' => array('status', TaskInterface::TASK_STATUS_DELETED))), + 'methods' => TaskManager::getAllMethods($this->controller_folder), + )); } public function export() { - $this->load->view('tasks/export', []); + $this->load->view('tasks/export', array()); } public function parseCrontab() @@ -49,8 +50,8 @@ public function parseCrontab() public function exportTasks() { if (isset($_POST['folder'])) { - $tasks = Task::findAll(['in' => ['status', [TaskInterface::TASK_STATUS_ACTIVE, TaskInterface::TASK_STATUS_INACTIVE]]]); - $result = []; + $tasks = Task::findAll(array('in' => array('status', array(TaskInterface::TASK_STATUS_ACTIVE, TaskInterface::TASK_STATUS_INACTIVE)))); + $result = array(); foreach ($tasks as $t) { $line = TaskManager::getTaskCrontabLine($t, $_POST['folder'], $_POST['php'], $_POST['file']); $result[] = nl2br($line); @@ -63,13 +64,13 @@ public function taskLog() { $task_id = isset($_GET['task_id']) ? $_GET['task_id'] : null; $runs = TaskRun::getLast($task_id); - $this->load->view('tasks/runs_list', ['runs' => $runs]); + $this->load->view('tasks/runs_list', array('runs' => $runs)); } public function runTask() { if (isset($_POST['task_id'])) { - $tasks = !is_array($_POST['task_id']) ? [$_POST['task_id']] : $_POST['task_id']; + $tasks = !is_array($_POST['task_id']) ? array($_POST['task_id']) : $_POST['task_id']; foreach ($tasks as $t) { $task = Task::findByPk($t); /** @@ -134,25 +135,25 @@ public function taskEdit() $task = TaskManager::editTask($task, $_POST['time'], $_POST['command'], $_POST['status'], $_POST['comment']); } - $this->load->view('tasks/task_edit', [ + $this->load->view('tasks/task_edit', array( 'task' => $task, - 'methods' => TaskManager::getAllMethods(self::CONTROLLERS_FOLDER), - ]); + 'methods' => TaskManager::getAllMethods($this->controller_folder), + )); } public function tasksUpdate() { if (isset($_POST['task_id'])) { - $tasks = Task::findAll(['in' => ['task_id', $_POST['task_id']]]); + $tasks = Task::findAll(array('in' => array('task_id', $_POST['task_id']))); foreach ($tasks as $t) { /** * @var Task $t */ - $action_status = [ + $action_status = array( 'Enable' => TaskInterface::TASK_STATUS_ACTIVE, 'Disable' => TaskInterface::TASK_STATUS_INACTIVE, 'Delete' => TaskInterface::TASK_STATUS_DELETED, - ]; + ); $t->setStatus($action_status[$_POST['action']]); $t->taskSave(); } @@ -169,10 +170,10 @@ public function tasksReport() $date_begin = isset($_GET['date_begin']) ? $_GET['date_begin'] : date('Y-m-d', strtotime('-6 day')); $date_end = isset($_GET['date_end']) ? $_GET['date_end'] : date('Y-m-d'); - $this->load->view('tasks/report', [ + $this->load->view('tasks/report', array( 'report' => Task::getReport($date_begin, $date_end), 'date_begin' => $date_begin, 'date_end' => $date_end, - ]); + )); } } diff --git a/examples/codeigniter/application/manager_actions.js b/examples/codeigniter/application/manager_actions.js index 001f9bc..a221ee1 100644 --- a/examples/codeigniter/application/manager_actions.js +++ b/examples/codeigniter/application/manager_actions.js @@ -1,10 +1,11 @@ $(function () { + var controller_url = '/TasksController/'; //tasks list page $('.run_task').click(function () { if (confirm('Are you sure?')) { $('#output_section').show(); $('#task_output_container').text('Running...'); - $.post('/TasksController/runTask', {task_id: $(this).attr('href')}, function (data) { + $.post(controller_url + 'runTask', {task_id: $(this).attr('href')}, function (data) { $('#task_output_container').html(data); }) } @@ -25,19 +26,19 @@ $(function () { if (confirm('Are you sure?')) { $('#output_section').show(); $('#task_output_container').text('Running...'); - $.post('/TasksController/runTask', {task_id: tasks}, function (data) { + $.post(controller_url + 'runTask', {task_id: tasks}, function (data) { $('#task_output_container').html(data); }) } } else { - $.post('/TasksController/tasksUpdate', {task_id: tasks, action: action}, function () { + $.post(controller_url + 'tasksUpdate', {task_id: tasks, action: action}, function () { window.location.reload(); }); } return false; }); $('.show_output').click(function () { - $.post('/TasksController/getOutput', {task_run_id: $(this).attr('href')}, function (data) { + $.post(controller_url + 'getOutput', {task_run_id: $(this).attr('href')}, function (data) { $('#output_container').html(data); return false; }) @@ -46,7 +47,7 @@ $(function () { if (confirm('Are you sure?')) { $('#output_section').show(); $('#task_output_container').text('Running...'); - $.post('/TasksController/runTask', {custom_task: $('#command').val()}, function (data) { + $.post(controller_url + 'runTask', {custom_task: $('#command').val()}, function (data) { $('#task_output_container').html(data); }) } @@ -59,7 +60,7 @@ $(function () { }); function getRunDates() { - $.post('/TasksController/getDates', {time: $('#time').val()}, function (data) { + $.post(controller_url + 'getDates', {time: $('#time').val()}, function (data) { $('#dates_list').html(data); }) } @@ -78,7 +79,7 @@ $(function () { //export page $('#parse_crontab_form').submit(function () { - $.post('/TasksController/parseCrontab', $(this).serialize(), function (data) { + $.post(controller_url + 'parseCrontab', $(this).serialize(), function (data) { var list = ''; data.forEach(function (element) { element.forEach(function (el) { @@ -91,7 +92,7 @@ $(function () { return false; }); $('#export_form').submit(function () { - $.post('/TasksController/exportTasks', $(this).serialize(), function (data) { + $.post(controller_url + 'exportTasks', $(this).serialize(), function (data) { var list = ''; data.forEach(function (element) { list += '' + element + '
'; diff --git a/examples/codeigniter/application/models/DbBaseModel.php b/examples/codeigniter/application/models/DbBaseModel.php index 1126ad7..aac69da 100644 --- a/examples/codeigniter/application/models/DbBaseModel.php +++ b/examples/codeigniter/application/models/DbBaseModel.php @@ -6,8 +6,8 @@ class DbBaseModel extends CI_Model { private $new_record = false; // whether this instance is new or not - private $attributes = []; // attribute name => attribute value - private $errors = []; + private $attributes = array(); // attribute name => attribute value + private $errors = array(); public static $table_name; public static $primary_key; @@ -42,10 +42,10 @@ public function __isset($name) public function attributes() { - return []; + return array(); } - public static function findOne($condition = []) + public static function findOne($condition = array()) { $query = self::query($condition)->get(); if ($query->num_rows() > 0) { @@ -67,12 +67,12 @@ public static function findOne($condition = []) */ public static function findByPk($value) { - return self::findOne(['where' => [static::$primary_key => $value]]); + return self::findOne(array('where' => array(static::$primary_key => $value))); } - public static function findAll($condition = []) + public static function findAll($condition = array()) { - $found = []; + $found = array(); $query = self::query($condition)->get(); if ($query->num_rows() > 0) { @@ -93,7 +93,7 @@ public static function findAll($condition = []) public static function findAllBySql($sql, $binds = null) { - $found = []; + $found = array(); $ci =& get_instance(); $query = $ci->db->query($sql, $binds); @@ -120,7 +120,7 @@ public static function query($condition) if (!array_key_exists('where', $condition)) { $found = false; - foreach (['select', 'order', 'limit', 'like', 'in', 'not_in'] as $key) { + foreach (array('select', 'order', 'limit', 'like', 'in', 'not_in') as $key) { if (array_key_exists($key, $condition)) { $found = true; break; @@ -128,7 +128,7 @@ public static function query($condition) } if (!$found) { - $condition = ['where' => $condition]; + $condition = array('where' => $condition); } } @@ -204,7 +204,7 @@ public function getAttribute($name) public function getAttributes() { - $data = []; + $data = array(); foreach ($this->attributes() as $name) { $data[$name] = $this->getAttribute($name); } @@ -256,7 +256,7 @@ protected function update() $update = $this->attributes; $key = static::$primary_key; unset($update[$key]); - return (bool)$this->db->where([$key => $this->$key])->update(static::$table_name, $update); + return (bool)$this->db->where(array($key => $this->$key))->update(static::$table_name, $update); } protected function beforeSave() diff --git a/examples/codeigniter/application/models/Task.php b/examples/codeigniter/application/models/Task.php index 0144f98..12fe429 100644 --- a/examples/codeigniter/application/models/Task.php +++ b/examples/codeigniter/application/models/Task.php @@ -23,7 +23,7 @@ class Task extends DbBaseModel implements TaskInterface public function attributes() { - return ['task_id', 'time', 'command', 'status', 'comment', 'ts', 'ts_updated']; + return array('task_id', 'time', 'command', 'status', 'comment', 'ts', 'ts_updated'); } public static function taskGet($task_id) @@ -38,7 +38,7 @@ public static function getAll() public static function getReport($date_begin, $date_end) { - return self::getDb()->query(DbHelper::getReportSql(), [$date_begin, $date_end])->result(); + return self::getDb()->query(DbHelper::getReportSql(), array($date_begin, $date_end))->result(); } public function taskDelete() diff --git a/examples/codeigniter/application/models/TaskRun.php b/examples/codeigniter/application/models/TaskRun.php index 2529f8d..21c2bfb 100644 --- a/examples/codeigniter/application/models/TaskRun.php +++ b/examples/codeigniter/application/models/TaskRun.php @@ -20,7 +20,7 @@ class TaskRun extends DbBaseModel implements TaskRunInterface public function attributes() { - return ['task_run_id', 'task_id', 'status', 'output', 'execution_time', 'ts']; + return array('task_run_id', 'task_id', 'status', 'output', 'execution_time', 'ts'); } public static function getLast($task_id = null, $count = 100) diff --git a/examples/codeigniter/application/views/tasks/template.php b/examples/codeigniter/application/views/tasks/template.php index 48d102f..6fb920b 100644 --- a/examples/codeigniter/application/views/tasks/template.php +++ b/examples/codeigniter/application/views/tasks/template.php @@ -4,13 +4,13 @@ * Date: 21.12.15 * Time: 0:29 */ -$menu = [ +$menu = array( 'index' => 'Tasks list', 'taskEdit' => 'Add new/edit task', 'taskLog' => 'Logs', 'export' => 'Import/Export', 'tasksReport' => 'Report', -]; +); ?> Cron tasks manager diff --git a/src/TaskManager.php b/src/TaskManager.php index 7f556a7..8a9f520 100644 --- a/src/TaskManager.php +++ b/src/TaskManager.php @@ -13,7 +13,7 @@ class TaskManager const SETTING_LOAD_CLASS = 'load_class'; const SETTING_CLASS_FOLDERS = 'class_folders'; protected static $load_class = false; - protected static $class_folders = []; + protected static $class_folders = array(); /** * @param TaskInterface $task @@ -87,7 +87,7 @@ public static function getRunDates($time, $count = 10) $cron = CronExpression::factory($time); $dates = $cron->getMultipleRunDates($count); } catch (\Exception $e) { - return []; + return array(); } return $dates; } @@ -143,7 +143,7 @@ public static function parseAndRunCommand($command) throw new CrontabManagerException('method ' . $method . ' not found in class ' . $class); } - $result = call_user_func_array([$obj, $method], $args); + $result = call_user_func_array(array($obj, $method), $args); } catch (\Exception $e) { echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL; return false; @@ -159,11 +159,11 @@ public static function parseAndRunCommand($command) protected static function parseCommand($command) { if (preg_match('/(\w+)::(\w+)\((.*)\)/', $command, $match)) { - return [ + return array( $match[1], $match[2], explode(',', $match[3]) - ]; + ); } else { throw new CrontabManagerException('Command not recognized'); } @@ -216,7 +216,7 @@ public static function getControllerMethods($class) */ protected static function getControllersList($paths) { - $controllers = []; + $controllers = array(); foreach ($paths as $p) { if (!file_exists($p)) { throw new CrontabManagerException('folder ' . $p . ' does not exist'); @@ -240,9 +240,9 @@ protected static function getControllersList($paths) public static function getAllMethods($folder) { if (!is_array($folder)) { - $folder = [$folder]; + $folder = array($folder); } - $methods = []; + $methods = array(); $controllers = self::getControllersList($folder); foreach ($controllers as $c) { if (!class_exists($c)) { @@ -263,13 +263,13 @@ public static function parseCrontab($cron, $task_class) { $cron_array = explode(PHP_EOL, $cron); $comment = null; - $result = []; + $result = array(); foreach ($cron_array as $c) { $c = trim($c); if (empty($c)) { continue; } - $r = []; + $r = array(); $r[] = $c; $cron_line_exp = '/(#?)(.*)cd.*php.*\.php\s+([\w\d-_]+)\s+([\w\d-_]+)\s*([\d\w-_\s]+)?(\d[\d>&\s]+)(.*)?/i'; if (preg_match($cron_line_exp, $c, $matches)) { @@ -339,7 +339,7 @@ public static function setSetting($name, $value) if (is_array($value)) { self::$class_folders = $value; } else { - self::$class_folders = [$value]; + self::$class_folders = array($value); } break; case self::SETTING_LOAD_CLASS: