Commit 74a8a4f0 authored by Franco Fichtner's avatar Franco Fichtner

mvc: style sweep

parent 2e31042e
......@@ -167,7 +167,9 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
* @param $mdl The validated model containing the new state of the model
* @return Error message on error, or null/void on success
*/
protected function setActionHook() { }
protected function setActionHook()
{
}
/**
* update model settings
......
......@@ -39,11 +39,13 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
static protected $modelPathPrefix = '';
static protected $gridFields = array();
static protected $gridDefaultSort = null;
private function getNodes() {
private function getNodes()
{
$ref = static::$modelPathPrefix . static::$internalModelName;
return $this->getModel()->getNodeByReference($ref);
}
private function getNodeByUUID($uuid) {
private function getNodeByUUID($uuid)
{
$nodes = $this->getNodes();
return !empty($nodes) ? $nodes->$uuid : null;
}
......@@ -78,7 +80,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $mdl The validated model containing the new state of the model
* @return Error message on error, or null/void on success
*/
protected function setItemActionHook($mdl) { }
protected function setItemActionHook($mdl)
{
}
/**
* update item with given properties
......@@ -108,7 +112,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $mdl The validated model containing the state of the new model
* @return Error message on error, or null/void on success
*/
protected function addItemActionHook($mdl) { }
protected function addItemActionHook($mdl)
{
}
/**
* add new item and set with attributes from post
......@@ -134,7 +140,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $uuid The UUID of the item to be deleted
* @return Error message on error, or null/void on succes s
*/
protected function delItemActionHook($uuid) { }
protected function delItemActionHook($uuid)
{
}
/**
* delete item by uuid
......@@ -150,7 +158,7 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
$errorMessage = delItemActionHook($uuid);
if ($errorMessage) {
$result['error'] = $errorMessage;
} else if (getNodes()->del($uuid)) {
} elseif (getNodes()->del($uuid)) {
// if item is removed, serialize to config and save
$mdl->serializeToConfig();
Config::getInstance()->save();
......@@ -172,7 +180,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
* @return Error message on error, or null/void on succes s
*/
protected function toggleItemActionHook($uuid, $enabled) { }
protected function toggleItemActionHook($uuid, $enabled)
{
}
/**
* toggle item by uuid (enable/disable)
......
......@@ -526,7 +526,7 @@ abstract class BaseModel
// fetch version migrations
$versions = array();
foreach (glob(dirname($class_info->getFileName())."/migrations/M*.php") as $filename) {
$version = str_replace('_', '.', explode('.', substr(basename($filename),1))[0]);
$version = str_replace('_', '.', explode('.', substr(basename($filename), 1))[0]);
$versions[$version] = $filename;
}
uksort($versions, "version_compare");
......@@ -546,8 +546,7 @@ abstract class BaseModel
$this->internal_current_model_version .
" to " . $mig_version . " in ".
$class_info->getName() .
" [skipping step]"
);
" [skipping step]");
}
$this->internal_current_model_version = $mig_version;
}
......
......@@ -37,5 +37,7 @@ use Phalcon\Logger\Adapter\Syslog;
*/
abstract class BaseModelMigration
{
public function run($model) {}
public function run($model)
{
}
}
......@@ -38,4 +38,4 @@ class M0_0_1 extends BaseModelMigration
$current_value = (string)$model->general->FromEmail;
$model->general->FromEmail = "001_" . $current_value;
}
}
\ No newline at end of file
}
......@@ -38,4 +38,4 @@ class M1_0_0 extends BaseModelMigration
$current_value = (string)$model->general->FromEmail;
$model->general->FromEmail = "100_" . $current_value;
}
}
\ No newline at end of file
}
......@@ -38,4 +38,4 @@ class M1_0_1 extends BaseModelMigration
$current_value = (string)$model->general->FromEmail;
$model->general->FromEmail = "101_" . $current_value;
}
}
\ No newline at end of file
}
......@@ -234,5 +234,4 @@ class BaseModelTest extends \PHPUnit_Framework_TestCase
$data = BaseModelTest::$model->arraytypes->item->getNodes();
$this->assertEquals(count($data), 9);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment