Skip to content

Commit

Permalink
phpcsfixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Apr 28, 2016
1 parent ceebbfa commit cab1ba2
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 70 deletions.
3 changes: 1 addition & 2 deletions src/cart/AbstractServerProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
use Yii;

/**
* Class AbstractServerProduct is an abstract cart position for server produce
* @package hipanel\modules\server\cart
* Class AbstractServerProduct is an abstract cart position for server produce.
*/
abstract class AbstractServerProduct extends AbstractCartPosition
{
Expand Down
3 changes: 1 addition & 2 deletions src/cart/RenewCalculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
namespace hipanel\modules\server\cart;

/**
* Class RenewCalculation performs calculation for server renewal operation
* @package hipanel\modules\server\cart
* Class RenewCalculation performs calculation for server renewal operation.
*/
class RenewCalculation extends \hipanel\modules\finance\models\Calculation
{
Expand Down
8 changes: 4 additions & 4 deletions src/cart/ServerOrderProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getPurchaseModel($options = [])
'cluster_id' => $this->cluster_id,
'social' => $this->social,
'purpose' => $this->purpose,
'tariff_id' => $this->tariff_id
'tariff_id' => $this->tariff_id,
], $options));
}

Expand All @@ -129,13 +129,13 @@ public function rules()
[['cluster_id', 'tariff_id'], 'integer'],
[['social', 'osimage'], 'safe'],
[['tariff_id', 'purpose', 'osimage'], 'required'],
[['cluster_id'], 'validateClusterId']
[['cluster_id'], 'validateClusterId'],
]);
}

public function validateClusterId($value)
{
return in_array($this->cluster_id, array_keys($this->_model->getLocations()));
return in_array($this->cluster_id, array_keys($this->_model->getLocations()), true);
}

/** {@inheritdoc} */
Expand All @@ -144,7 +144,7 @@ public function attributeLabels()
return ArrayHelper::merge(parent::attributeLabels(), [
'cluster_id' => Yii::t('hipanel/server', 'Server location'),
'purpose' => Yii::t('hipanel/server', 'Purpose'),
'social' => Yii::t('hipanel/server', 'Social network')
'social' => Yii::t('hipanel/server', 'Social network'),
]);
}

Expand Down
5 changes: 2 additions & 3 deletions src/cart/ServerOrderPurchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
use hipanel\base\ModelTrait;

/**
* Class ServerOrderPurchase
* @package hipanel\modules\server\cart
* Class ServerOrderPurchase.
*/
class ServerOrderPurchase extends AbstractServerPurchase
{
Expand All @@ -40,7 +39,7 @@ public function rules()
return array_merge(parent::rules(), [
[['osimage', 'panel', 'cluster_id', 'social', 'purpose', 'tariff_id'], 'required'],
[['osimage', 'panel', 'social', 'purpose'], 'safe'],
[['tariff_id', 'cluster_id'], 'integer']
[['tariff_id', 'cluster_id'], 'integer'],
]);
}
}
4 changes: 1 addition & 3 deletions src/cart/ServerRenewProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
use Yii;

/**
* Class ServerRenewProduct
*
* @package hipanel\modules\server\cart
* Class ServerRenewProduct.
*/
class ServerRenewProduct extends AbstractServerProduct
{
Expand Down
4 changes: 1 addition & 3 deletions src/cart/ServerRenewPurchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
use hipanel\base\ModelTrait;

/**
* Class ServerRenewPurchase
*
* @package hipanel\modules\server\cart
* Class ServerRenewPurchase.
*/
class ServerRenewPurchase extends AbstractServerPurchase
{
Expand Down
17 changes: 12 additions & 5 deletions src/cart/Tariff.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
<?php

/*
* Server module for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-server
* @package hipanel-module-server
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
*/

namespace hipanel\modules\server\cart;

use hipanel\modules\finance\models\CalculableModelInterface;

/**
* Class Tariff represents tariff for server
*
* @package hipanel\modules\server\cart
* Class Tariff represents tariff for server.
*/
class Tariff extends \hipanel\modules\finance\models\Tariff implements CalculableModelInterface
{
const TYPE_XEN = 'svds';
const TYPE_OPENVZ = 'ovds';

/**
* Method creates and returns corresponding Calculation model
* Method creates and returns corresponding Calculation model.
*
* @return OrderCalculation
*/
public function getCalculationModel()
{
return new TariffPageCalculation([
'tariff_id' => $this->id
'tariff_id' => $this->id,
]);
}
}
8 changes: 2 additions & 6 deletions src/cart/TariffPageCalculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@

namespace hipanel\modules\server\cart;

use Yii;

/**
* Class TariffPageCalculation is designed to calculate servers' prices
* when server is not created yet (using tariff only) and is not added to the cart
* when server is not created yet (using tariff only) and is not added to the cart.
*
* The class has dropped dependency on Cart module
*
* @package hipanel\modules\server\cart
*/
class TariffPageCalculation extends OrderCalculation
{
Expand All @@ -29,7 +25,7 @@ public static function primaryKey()
return ['tariff_id'];
}

/** @inheritdoc */
/** {@inheritdoc} */
public function synchronize()
{
return true;
Expand Down
11 changes: 5 additions & 6 deletions src/controllers/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function actions()
},
'data' => function ($action) {
/**
* @var $this
* @var
* @var $model Server
*/
$controller = $action->controller;
Expand Down Expand Up @@ -275,7 +275,7 @@ public function actions()
'delete' => [
'class' => SmartDeleteAction::class,
'success' => Yii::t('hipanel/server', 'Server was deleted successfully'),
'error' => Yii::t('hipanel/server', 'Failed to delete server')
'error' => Yii::t('hipanel/server', 'Failed to delete server'),
],
'bulk-delete-modal' => [
'class' => PrepareBulkAction::class,
Expand All @@ -302,9 +302,8 @@ public function actions()
foreach ($action->collection->models as $model) {
$model->setAttributes([
'type' => $type,
'comment' => $comment
'comment' => $comment,
]);

}
}
},
Expand All @@ -315,9 +314,9 @@ public function actions()
'view' => '_bulkEnableBlock',
'data' => function ($action, $data) {
return array_merge($data, [
'blockReasons' => $this->getBlockReasons()
'blockReasons' => $this->getBlockReasons(),
]);
}
},
],
'bulk-disable-block' => [
'class' => SmartUpdateAction::class,
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/ServerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ public static function getPanels()
/**
* @param string $type (svds|ovds)
* @param integer $tariff_id
* @return Package|array
* @throws NotFoundHttpException
* @throws UnprocessableEntityHttpException
* @return Package|array
*/
public static function getAvailablePackages($type = null, $tariff_id = null)
{
Expand All @@ -140,7 +140,7 @@ public static function getAvailablePackages($type = null, $tariff_id = null)
Yii::$app->params['seller'],
Yii::$app->user->id,
$type,
$tariff_id
$tariff_id,
];

/** @var Tariff[] $tariffs */
Expand All @@ -163,7 +163,7 @@ public static function getAvailablePackages($type = null, $tariff_id = null)
}

$calculationData = [];
foreach ((array)$calculations as $calculation) {
foreach ((array) $calculations as $calculation) {
$calculationData[$calculation->getPrimaryKey()] = $calculation->getAttributes();
}

Expand All @@ -182,7 +182,7 @@ public static function getAvailablePackages($type = null, $tariff_id = null)
$tariffPartsIds = array_filter(ArrayHelper::getColumn($tariff->resources, 'object_id'));

foreach ($parts as $id => $part) {
if (in_array($id, $tariffPartsIds)) {
if (in_array($id, $tariffPartsIds, true)) {
$tariffParts[$id] = $part;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/ru/os.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
'Soft package' => 'Пакет ПО',
'System name of image' => 'Название образа',
'Panel' => 'Панель управления',
'clear' => 'отсутствует'
'clear' => 'отсутствует',
];
13 changes: 11 additions & 2 deletions src/models/OpenvzPackage.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<?php

/*
* Server module for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-server
* @package hipanel-module-server
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
*/

namespace hipanel\modules\server\models;

use Yii;

/**
* Class OpenvzPackage
* Class OpenvzPackage.
* @property string $name
*/
class OpenvzPackage extends Package
Expand All @@ -22,7 +31,7 @@ protected function getResourceTitle_hdd()
return Yii::t('hipanel/server', 'HDD + SSD cache');
}

/** @inheritdoc */
/** {@inheritdoc} */
public function getLocations()
{
return [
Expand Down
Loading

0 comments on commit cab1ba2

Please sign in to comment.