@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function setEnabled($enabled = false) |
54 | 54 | { |
55 | - $this->enabled = (boolean)$enabled; |
|
55 | + $this->enabled = (boolean) $enabled; |
|
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (null === $minimumSeconds) { |
159 | 159 | $this->filterElapsedSecs = null; |
160 | 160 | } else { |
161 | - $this->filterElapsedSecs = (integer)$minimumSeconds; |
|
161 | + $this->filterElapsedSecs = (integer) $minimumSeconds; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | return $this; |
@@ -21,7 +21,7 @@ |
||
21 | 21 | protected $endedMicrotime = null; |
22 | 22 | |
23 | 23 | protected $startedMemory = null; |
24 | - protected $endedMemory = null; |
|
24 | + protected $endedMemory = null; |
|
25 | 25 | |
26 | 26 | |
27 | 27 | public function __construct($type) { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function setProfiles($profiles) { |
17 | 17 | if (is_array($profiles)) { |
18 | - foreach ($profiles as $p){ |
|
18 | + foreach ($profiles as $p) { |
|
19 | 19 | $this->addProfile($p); |
20 | 20 | } |
21 | 21 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return $this->getTool()->mainMenu(); |
38 | 38 | } |
39 | 39 | |
40 | - $this->getTool()->getGenerator()->{'generate' . ucfirst ($this->_entity)}($response); |
|
40 | + $this->getTool()->getGenerator()->{'generate' . ucfirst($this->_entity)}($response); |
|
41 | 41 | } else { |
42 | 42 | $this->getTool()->getConsole()->error("Empty response"); |
43 | 43 | } |
@@ -26,17 +26,17 @@ |
||
26 | 26 | |
27 | 27 | public function askConfirmation($question) |
28 | 28 | { |
29 | - $question .= ' (Y|n) : '; |
|
30 | - $return = $this->askQuestion($question); |
|
29 | + $question .= ' (Y|n) : '; |
|
30 | + $return = $this->askQuestion($question); |
|
31 | 31 | return !$return || $return == 'Y'; |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function askQuestion($question) |
35 | 35 | { |
36 | - $this->output($question . "\n"); |
|
37 | - $handle = fopen ("php://stdin","r"); |
|
38 | - $line = fgets($handle); |
|
39 | - return trim($line); |
|
36 | + $this->output($question . "\n"); |
|
37 | + $handle = fopen ("php://stdin","r"); |
|
38 | + $line = fgets($handle); |
|
39 | + return trim($line); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function error($error) |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public function askQuestion($question) |
35 | 35 | { |
36 | 36 | $this->output($question . "\n"); |
37 | - $handle = fopen ("php://stdin","r"); |
|
37 | + $handle = fopen("php://stdin", "r"); |
|
38 | 38 | $line = fgets($handle); |
39 | 39 | return trim($line); |
40 | 40 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | file_put_contents($file, $content); |
22 | 22 | |
23 | - return $this->getConsole()->success('controller [' . $name . '] generated'); |
|
23 | + return $this->getConsole()->success('controller [' . $name . '] generated'); |
|
24 | 24 | } |
25 | 25 | return $this->getConsole()->error('controller [' . $name . '] not generated'); |
26 | 26 | } |
@@ -28,23 +28,23 @@ discard block |
||
28 | 28 | public function generatePath($name) |
29 | 29 | { |
30 | 30 | if (substr_count($name, '-') > 0) { |
31 | - $parts = explode('-', $name); |
|
32 | - $module = array_shift($parts); |
|
31 | + $parts = explode('-', $name); |
|
32 | + $module = array_shift($parts); |
|
33 | 33 | |
34 | - if (!is_dir(MODULES_PATH . $module)) { |
|
35 | - $this->getConsole()->error('No module ['.$module.']'); |
|
36 | - if (!$this->getConsole()->askConfirmation('Create it ?')) { |
|
34 | + if (!is_dir(MODULES_PATH . $module)) { |
|
35 | + $this->getConsole()->error('No module ['.$module.']'); |
|
36 | + if (!$this->getConsole()->askConfirmation('Create it ?')) { |
|
37 | 37 | return false; |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | 40 | $this->getConsole()->log('Creating module ['.$module.']'); |
41 | 41 | $this->getGenerator()->generateModule($module); |
42 | - } |
|
42 | + } |
|
43 | 43 | $fileName = Nip_Inflector::instance()->camelize(array_pop($parts)) . '.php'; |
44 | 44 | $path = implode('/', $parts); |
45 | 45 | |
46 | 46 | return MODULES_PATH . $module .DS. 'controllers' .DS. ($path ? $path . DS : '') . $fileName; |
47 | - } else { |
|
47 | + } else { |
|
48 | 48 | $this->getConsole()->error('bad format. Ex: module-controller'); |
49 | 49 | } |
50 | 50 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | |
54 | 54 | public function generateContent($name) |
55 | 55 | { |
56 | - $parts = explode('-', $name); |
|
57 | - $module = array_shift($parts); |
|
56 | + $parts = explode('-', $name); |
|
57 | + $module = array_shift($parts); |
|
58 | 58 | $cName = implode('-', $parts); |
59 | 59 | |
60 | 60 | $name = Nip_Dispatcher::instance()->getFullControllerName($module, implode('-', $parts)); |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | $file = $this->generatePath($name); |
9 | 9 | if ($file) { |
10 | 10 | if (is_file($file)) { |
11 | - return $this->getConsole()->error('controller exits ['.$file.']'); |
|
11 | + return $this->getConsole()->error('controller exits [' . $file . ']'); |
|
12 | 12 | } |
13 | 13 | |
14 | - $this->getConsole()->log('Creating controller ['.$file.']'); |
|
14 | + $this->getConsole()->log('Creating controller [' . $file . ']'); |
|
15 | 15 | $content = $this->generateContent($name); |
16 | 16 | $dir = dirname($file); |
17 | 17 | if (!is_dir($dir)) { |
18 | - $this->getConsole()->log('Creating dir ['.$dir.']'); |
|
18 | + $this->getConsole()->log('Creating dir [' . $dir . ']'); |
|
19 | 19 | mkdir($dir, 0755, true); |
20 | 20 | } |
21 | 21 | file_put_contents($file, $content); |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | $module = array_shift($parts); |
33 | 33 | |
34 | 34 | if (!is_dir(MODULES_PATH . $module)) { |
35 | - $this->getConsole()->error('No module ['.$module.']'); |
|
35 | + $this->getConsole()->error('No module [' . $module . ']'); |
|
36 | 36 | if (!$this->getConsole()->askConfirmation('Create it ?')) { |
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - $this->getConsole()->log('Creating module ['.$module.']'); |
|
40 | + $this->getConsole()->log('Creating module [' . $module . ']'); |
|
41 | 41 | $this->getGenerator()->generateModule($module); |
42 | 42 | } |
43 | 43 | $fileName = Nip_Inflector::instance()->camelize(array_pop($parts)) . '.php'; |
44 | - $path = implode('/', $parts); |
|
44 | + $path = implode('/', $parts); |
|
45 | 45 | |
46 | - return MODULES_PATH . $module .DS. 'controllers' .DS. ($path ? $path . DS : '') . $fileName; |
|
46 | + return MODULES_PATH . $module . DS . 'controllers' . DS . ($path ? $path . DS : '') . $fileName; |
|
47 | 47 | } else { |
48 | 48 | $this->getConsole()->error('bad format. Ex: module-controller'); |
49 | 49 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function generatePath() |
30 | 30 | { |
31 | - return MODULES_PATH . $this->getName() .DS; |
|
31 | + return MODULES_PATH . $this->getName() .DS; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function generateControllers() |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function generatePath() |
30 | 30 | { |
31 | - return MODULES_PATH . $this->getName() .DS; |
|
31 | + return MODULES_PATH . $this->getName() . DS; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function generateControllers() |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | /** Static Route */ |
45 | 45 | $content = $this->getGenerator()->newClass() |
46 | 46 | ->setName(ucfirst($this->getName()) . '_Route_Static')->setExtends('Nip_Route_Static') |
47 | - ->appendProperty('_params', 'protected', 'array("module" => "'.$this->getName().'")') |
|
47 | + ->appendProperty('_params', 'protected', 'array("module" => "' . $this->getName() . '")') |
|
48 | 48 | ->generate(); |
49 | 49 | file_put_contents($mainDir . 'Static.php', $content); |
50 | 50 | |
51 | 51 | /** Regex Route */ |
52 | 52 | $content = $this->getGenerator()->newClass() |
53 | 53 | ->setName(ucfirst($this->getName()) . '_Route_Regex')->setExtends('Nip_Route_Regex') |
54 | - ->appendProperty('_params', 'protected', 'array("module" => "'.$this->getName().'")') |
|
54 | + ->appendProperty('_params', 'protected', 'array("module" => "' . $this->getName() . '")') |
|
55 | 55 | ->generate(); |
56 | 56 | file_put_contents($mainDir . 'Regex.php', $content); |
57 | 57 | |
58 | 58 | /** Dynamic Route */ |
59 | 59 | $content = $this->getGenerator()->newClass() |
60 | 60 | ->setName(ucfirst($this->getName()) . '_Route_Dynamic')->setExtends('Nip_Route_Dynamic') |
61 | - ->appendProperty('_params', 'protected', 'array("module" => "'.$this->getName().'")') |
|
61 | + ->appendProperty('_params', 'protected', 'array("module" => "' . $this->getName() . '")') |
|
62 | 62 | ->generate(); |
63 | 63 | file_put_contents($mainDir . 'Dynamic.php', $content); |
64 | 64 |
@@ -6,9 +6,9 @@ |
||
6 | 6 | public function generate($name) |
7 | 7 | { |
8 | 8 | $dir = $this->getDir($name); |
9 | - if (!is_dir($dir)) { |
|
10 | - mkdir($dir, 0755, true); |
|
11 | - } |
|
9 | + if (!is_dir($dir)) { |
|
10 | + mkdir($dir, 0755, true); |
|
11 | + } |
|
12 | 12 | |
13 | 13 | $this->generateRecords($name); |
14 | 14 | $this->generateRecord($name); |
@@ -82,7 +82,6 @@ |
||
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Sets a parameter by name. |
85 | - |
|
86 | 85 | * @param string $key The key |
87 | 86 | * @param mixed $value The value |
88 | 87 | */ |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function set($key, $value) |
90 | 90 | { |
91 | - $key = (string)$key; |
|
91 | + $key = (string) $key; |
|
92 | 92 | |
93 | 93 | if ((null === $value) && isset($this->parameters[$key])) { |
94 | 94 | unset($this->parameters[$key]); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function getInt($key, $default = 0) |
173 | 173 | { |
174 | - return (int)$this->get($key, $default); |
|
174 | + return (int) $this->get($key, $default); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |