mirror of
https://github.com/Oreolek/kangana.git
synced 2024-06-16 15:01:09 +03:00
Code style and Travis CI
This commit is contained in:
parent
6762f6afd0
commit
ed4e22e5ac
16
.travis.yml
Normal file
16
.travis.yml
Normal file
|
@ -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
|
|
@ -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');
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class Model_Task extends ORM {
|
|||
{
|
||||
return $retval;
|
||||
}
|
||||
elseif($i < count( $letters ))
|
||||
elseif ($i < count( $letters ))
|
||||
{
|
||||
return $letters[$i];
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -41,7 +41,7 @@ class View_Edit extends View_Layout {
|
|||
}
|
||||
$output .= '<div class="container">'.Form::label($key, $value['label']);
|
||||
$input = '';
|
||||
switch($value['type'])
|
||||
switch ($value['type'])
|
||||
{
|
||||
case 'file':
|
||||
$input = Form::file($key);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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 ');
|
||||
|
|
Loading…
Reference in a new issue