diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d1024d8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: php +php: + - "7.0" +before_script: + # install CodeSniffer for Kohana Coding Standards checks + # - git clone https://github.com/squizlabs/PHP_CodeSniffer.git php-codesniffer --depth=1 + # Install Kohana Coding Standards + # - git clone https://github.com/kohana/coding-standards.git kohana-coding-standards --depth=1 + # - cd php-codesniffer + # - scripts/phpcs --config-set installed_paths ../kohana-coding-standards +script: + - find {application} -name "*.php" -print0 \ + | xargs -0 -n1 -P8 php -l \ + | grep -v '^No syntax errors detected' \ + ; test $? -eq 1 + # - php-codesniffer/scripts/phpcs -p -s -v -n --standard=Kohana --extensions=php application diff --git a/application/classes/Controller/Client.php b/application/classes/Controller/Client.php index 2e73eb9..ba24355 100644 --- a/application/classes/Controller/Client.php +++ b/application/classes/Controller/Client.php @@ -65,7 +65,7 @@ class Controller_Client extends Controller_Layout { **/ public function action_view() { - $this->template = new View_Client_View(); + $this->template = new View_Client_View; $model = ORM::factory('Client', $this->request->param('id')) ->with('courses') ->with('groups'); diff --git a/application/classes/Controller/Course.php b/application/classes/Controller/Course.php index f892c0a..8ff2f4d 100644 --- a/application/classes/Controller/Course.php +++ b/application/classes/Controller/Course.php @@ -66,7 +66,7 @@ class Controller_Course extends Controller_Layout { $this->template->model->period = $this->request->param('period', 1); $this->template->model->values($this->request->post(), ['type', 'group_id']); } - if ((int) $this->template->model->type === Model_Course::TYPE_SCHEDULED) + if ( (int) $this->template->model->type === Model_Course::TYPE_SCHEDULED) { $this->controls['period'] = 'input'; $this->controls['price'] = 'input'; @@ -141,7 +141,7 @@ class Controller_Course extends Controller_Layout { $model->period = $this->request->param('period', 1); $model->values($this->request->post(), ['type', 'group_id']); } - if ((int) $model->type === Model_Course::TYPE_SCHEDULED) + if ( (int) $model->type === Model_Course::TYPE_SCHEDULED) { $this->controls['period'] = 'input'; $this->controls['price'] = 'input'; diff --git a/application/classes/Form.php b/application/classes/Form.php index a85b8a0..936e7a6 100644 --- a/application/classes/Form.php +++ b/application/classes/Form.php @@ -8,7 +8,7 @@ class Form extends Kohana_Form { public static function orm_input($model, $name, $type = 'input') { - switch($type) + switch ($type) { case 'check': case 'chck': diff --git a/application/classes/Model/Course.php b/application/classes/Model/Course.php index cb0e87a..d007183 100644 --- a/application/classes/Model/Course.php +++ b/application/classes/Model/Course.php @@ -152,7 +152,7 @@ class Model_Course extends ORM { public function delete() { $letter_ids = $this->get_letter_ids($this->id); - if (!empty($letter_ids)) + if ( ! empty($letter_ids)) { $query = DB::delete('tasks'); if (is_array($letter_ids)) diff --git a/application/classes/Model/Letter.php b/application/classes/Model/Letter.php index d85b1c8..b14d5af 100644 --- a/application/classes/Model/Letter.php +++ b/application/classes/Model/Letter.php @@ -42,7 +42,7 @@ class Model_Letter extends ORM { public function customize() { - if($this->order == 0) + if ($this->order == 0) { $this->order = Model_Course::count_letters($this->course_id) + 1; } diff --git a/application/classes/Model/Task.php b/application/classes/Model/Task.php index 42fc5e4..2697f1d 100644 --- a/application/classes/Model/Task.php +++ b/application/classes/Model/Task.php @@ -112,7 +112,7 @@ class Model_Task extends ORM { { return $retval; } - elseif($i < count( $letters )) + elseif ($i < count( $letters )) { return $letters[$i]; } diff --git a/application/classes/Task/Migrate/Smartresponder.php b/application/classes/Task/Migrate/Smartresponder.php index 2f71d10..918cb1e 100644 --- a/application/classes/Task/Migrate/Smartresponder.php +++ b/application/classes/Task/Migrate/Smartresponder.php @@ -34,7 +34,7 @@ class Task_Migrate_Smartresponder extends Minion_Task $params = $this->get_options(); $path = $params['csv']; - if (!file_exists($path)) + if ( ! file_exists($path)) { echo "ERROR: File not found."; return; @@ -46,7 +46,7 @@ class Task_Migrate_Smartresponder extends Minion_Task $group = ORM::factory('Group')->where('id', '=', $params['group_id'])->find(); if ( ! $group->loaded()) { - echo "No group with id " . $params['group_id'] . " found.\n"; + echo "No group with id ".$params['group_id' " found.\n"; return; } @@ -56,26 +56,26 @@ class Task_Migrate_Smartresponder extends Minion_Task echo "File opened.\n"; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $client = ORM::factory('Client')->where('email', '=', $data[0]); - if (!$client->loaded()) { + if ( ! $client->loaded()) { $client = ORM::factory('Client'); $client->email = $data[0]; } - $name = trim($transcoder->transcode($data[1] . ' ' . $data[2], 'cp1251')); + $name = trim($transcoder->transcode($data[1].' '.$data[2], 'cp1251')); $client->name = $name; $client->sex = $data[5]; - if (!empty($data[13])) + if ( ! empty($data[13])) { $client->referrer = $data[13]; } - if (!empty($data[7])) + if ( ! empty($data[7])) { $client->city = $transcoder->transcode($data[7], 'cp1251'); } - if (!empty($data[6])) + if ( ! empty($data[6])) { $client->country = $data[6]; } - echo "Importing client " . $name . ".\n"; + echo "Importing client ".$name.".\n"; try { $client->customize(); diff --git a/application/classes/View/Edit.php b/application/classes/View/Edit.php index b9c8eeb..7ad3001 100644 --- a/application/classes/View/Edit.php +++ b/application/classes/View/Edit.php @@ -41,7 +41,7 @@ class View_Edit extends View_Layout { } $output .= '
'.Form::label($key, $value['label']); $input = ''; - switch($value['type']) + switch ($value['type']) { case 'file': $input = Form::file($key); diff --git a/application/classes/View/Layout.php b/application/classes/View/Layout.php index ba248a8..4f6dea4 100644 --- a/application/classes/View/Layout.php +++ b/application/classes/View/Layout.php @@ -99,7 +99,7 @@ class View_Layout { { $scripts = array_merge ($this->base_scripts, $this->scripts); $temp = ""; - foreach($scripts as $script) + foreach ($scripts as $script) { if (strstr($script, '://') === FALSE) // no protocol given, script is local { diff --git a/application/migrations/kangana/20161016123906_model-combining.php b/application/migrations/kangana/20161016123906_model-combining.php index 1c3b599..8b8a702 100644 --- a/application/migrations/kangana/20161016123906_model-combining.php +++ b/application/migrations/kangana/20161016123906_model-combining.php @@ -25,7 +25,7 @@ class Migration_Kangana_20161016123906 extends Minion_Migration_Base { $subscriptions = DB::select()->from('subscriptions')->as_object()->execute($db); - if (!empty($subscriptions)) + if ( ! empty($subscriptions)) { foreach ($subscriptions as $subscription) { diff --git a/application/migrations/kangana/20161023121040_new-client-fields.php b/application/migrations/kangana/20161023121040_new-client-fields.php index edc038c..349c7e4 100644 --- a/application/migrations/kangana/20161023121040_new-client-fields.php +++ b/application/migrations/kangana/20161023121040_new-client-fields.php @@ -5,7 +5,7 @@ */ class Migration_Kangana_20161023121040 extends Minion_Migration_Base { - public function up(Kohana_Database $db) + public function up(Kohana_Database $db) { $db->query(NULL, 'ALTER TABLE clients ADD COLUMN sex CHAR(1) NULL '); $db->query(NULL, 'ALTER TABLE clients ADD COLUMN referrer VARCHAR(255) NULL ');