@@ -8,6 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | abstract class ModuleController extends BaseController implements \Frameworkless\ModuleInterface{ |
10 | 10 | |
11 | + /** |
|
12 | + * @param string $view |
|
13 | + */ |
|
11 | 14 | protected function render($view, array $data = array()){ |
12 | 15 | |
13 | 16 | $ref = new \ReflectionClass($this); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | |
11 | 11 | protected function render($view, array $data = array()){ |
12 | 12 | |
13 | - $ref = new \ReflectionClass($this); |
|
13 | + $ref = new \ReflectionClass($this); |
|
14 | 14 | |
15 | - $tpl = (new \SplFileInfo($ref->getFileName()))->getPath() . DIRECTORY_SEPARATOR . 'tpl'; |
|
15 | + $tpl = (new \SplFileInfo($ref->getFileName()))->getPath() . DIRECTORY_SEPARATOR . 'tpl'; |
|
16 | 16 | |
17 | - $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($tpl)); |
|
17 | + $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($tpl)); |
|
18 | 18 | |
19 | - return $twig->render($view . '.twig', $data); |
|
19 | + return $twig->render($view . '.twig', $data); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | abstract public function process(); |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function setParams(array $params = array()){ |
31 | 31 | |
32 | - foreach($params as $param => $value){ |
|
33 | - if((new \ReflectionClass($this))->hasProperty($param) === false) |
|
34 | - throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class)); |
|
32 | + foreach($params as $param => $value){ |
|
33 | + if((new \ReflectionClass($this))->hasProperty($param) === false) |
|
34 | + throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class)); |
|
35 | 35 | |
36 | - $this->{$param} = $value; |
|
37 | - } |
|
38 | - return $this; |
|
36 | + $this->{$param} = $value; |
|
37 | + } |
|
38 | + return $this; |
|
39 | 39 | } |
40 | 40 | } |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author d.lanec |
8 | 8 | */ |
9 | -abstract class ModuleController extends BaseController implements \Frameworkless\ModuleInterface{ |
|
9 | +abstract class ModuleController extends BaseController implements \Frameworkless\ModuleInterface { |
|
10 | 10 | |
11 | - protected function render($view, array $data = array()){ |
|
11 | + protected function render($view, array $data = array()) { |
|
12 | 12 | |
13 | 13 | $ref = new \ReflectionClass($this); |
14 | 14 | |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @return $this |
28 | 28 | * @throws \Exception |
29 | 29 | */ |
30 | - public function setParams(array $params = array()){ |
|
30 | + public function setParams(array $params = array()) { |
|
31 | 31 | |
32 | - foreach($params as $param => $value){ |
|
33 | - if((new \ReflectionClass($this))->hasProperty($param) === false) |
|
32 | + foreach ($params as $param => $value) { |
|
33 | + if ((new \ReflectionClass($this))->hasProperty($param) === false) |
|
34 | 34 | throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class)); |
35 | 35 | |
36 | 36 | $this->{$param} = $value; |
@@ -30,8 +30,9 @@ |
||
30 | 30 | public function setParams(array $params = array()){ |
31 | 31 | |
32 | 32 | foreach($params as $param => $value){ |
33 | - if((new \ReflectionClass($this))->hasProperty($param) === false) |
|
34 | - throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class)); |
|
33 | + if((new \ReflectionClass($this))->hasProperty($param) === false) { |
|
34 | + throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class)); |
|
35 | + } |
|
35 | 36 | |
36 | 37 | $this->{$param} = $value; |
37 | 38 | } |
@@ -23,15 +23,15 @@ |
||
23 | 23 | protected $validator; |
24 | 24 | |
25 | 25 | function __construct(){ |
26 | - $this->validator = new RecursiveValidator( |
|
27 | - new ExecutionContextFactory(new IdentityTranslator()), new LazyLoadingMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory() |
|
28 | - ); |
|
26 | + $this->validator = new RecursiveValidator( |
|
27 | + new ExecutionContextFactory(new IdentityTranslator()), new LazyLoadingMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory() |
|
28 | + ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null){ |
32 | - if(!$result = $this->validate($this->validator)){ |
|
33 | - throw new ValidationException($this->getValidationFailures(), "Validation error"); |
|
34 | - } |
|
35 | - return $result; |
|
32 | + if(!$result = $this->validate($this->validator)){ |
|
33 | + throw new ValidationException($this->getValidationFailures(), "Validation error"); |
|
34 | + } |
|
35 | + return $result; |
|
36 | 36 | } |
37 | 37 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @author Dmitriy |
16 | 16 | */ |
17 | -trait ValidatorTrait{ |
|
17 | +trait ValidatorTrait { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Symfony\Component\Validator\Validator\RecursiveValidator |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected $validator; |
24 | 24 | |
25 | - function __construct(){ |
|
25 | + function __construct() { |
|
26 | 26 | $this->validator = new RecursiveValidator( |
27 | 27 | new ExecutionContextFactory(new IdentityTranslator()), new LazyLoadingMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory() |
28 | 28 | ); |
29 | 29 | } |
30 | 30 | |
31 | - public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null){ |
|
32 | - if(!$result = $this->validate($this->validator)){ |
|
31 | + public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null) { |
|
32 | + if (!$result = $this->validate($this->validator)) { |
|
33 | 33 | throw new ValidationException($this->getValidationFailures(), "Validation error"); |
34 | 34 | } |
35 | 35 | return $result; |
@@ -27,21 +27,21 @@ |
||
27 | 27 | |
28 | 28 | protected function render($view, array $data = []){ |
29 | 29 | |
30 | - $debugbarRenderer = $this->debugbar->getJavascriptRenderer("/assets/debug_bar"); |
|
30 | + $debugbarRenderer = $this->debugbar->getJavascriptRenderer("/assets/debug_bar"); |
|
31 | 31 | |
32 | - $data["debugbar_Head"] = $debugbarRenderer->renderHead(); |
|
33 | - $data["debugbar_Body"] = $debugbarRenderer->render(); |
|
32 | + $data["debugbar_Head"] = $debugbarRenderer->renderHead(); |
|
33 | + $data["debugbar_Body"] = $debugbarRenderer->render(); |
|
34 | 34 | |
35 | - return new Response($this->twig->render($view, $data)); |
|
35 | + return new Response($this->twig->render($view, $data)); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function setTwig(Twig_Environment $twig){ |
39 | - $this->twig = $twig; |
|
40 | - return $this; |
|
39 | + $this->twig = $twig; |
|
40 | + return $this; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function setDebugbar(StandardDebugBar $debugbar){ |
44 | - $this->debugbar = $debugbar; |
|
45 | - return $this; |
|
44 | + $this->debugbar = $debugbar; |
|
45 | + return $this; |
|
46 | 46 | } |
47 | 47 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | use \Psr\Log\LoggerAwareTrait; |
27 | 27 | |
28 | - protected function render($view, array $data = []){ |
|
28 | + protected function render($view, array $data = []) { |
|
29 | 29 | |
30 | 30 | $debugbarRenderer = $this->debugbar->getJavascriptRenderer("/assets/debug_bar"); |
31 | 31 | |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | return new Response($this->twig->render($view, $data)); |
36 | 36 | } |
37 | 37 | |
38 | - public function setTwig(Twig_Environment $twig){ |
|
38 | + public function setTwig(Twig_Environment $twig) { |
|
39 | 39 | $this->twig = $twig; |
40 | 40 | return $this; |
41 | 41 | } |
42 | 42 | |
43 | - public function setDebugbar(StandardDebugBar $debugbar){ |
|
43 | + public function setDebugbar(StandardDebugBar $debugbar) { |
|
44 | 44 | $this->debugbar = $debugbar; |
45 | 45 | return $this; |
46 | 46 | } |
@@ -14,12 +14,12 @@ |
||
14 | 14 | */ |
15 | 15 | public function get($args){ |
16 | 16 | |
17 | - $result = \App::getModule(UserList::class, [ |
|
18 | - "limit" => 50 |
|
19 | - ]); |
|
17 | + $result = \App::getModule(UserList::class, [ |
|
18 | + "limit" => 50 |
|
19 | + ]); |
|
20 | 20 | |
21 | - return $this->render('pages/index.html.twig', [ |
|
22 | - "content" => $result, |
|
23 | - ]); |
|
21 | + return $this->render('pages/index.html.twig', [ |
|
22 | + "content" => $result, |
|
23 | + ]); |
|
24 | 24 | } |
25 | 25 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use Core\Modules\UserList\UserList; |
5 | 5 | use Symfony\Component\HttpFoundation\Response; |
6 | 6 | |
7 | -class IndexController extends BaseController{ |
|
7 | +class IndexController extends BaseController { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Return index page (/) |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @param array $args |
13 | 13 | * @return Response |
14 | 14 | */ |
15 | - public function get($args){ |
|
15 | + public function get($args) { |
|
16 | 16 | |
17 | 17 | $result = \App::getModule(UserList::class, [ |
18 | 18 | "limit" => 50 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @author d.lanec |
11 | 11 | */ |
12 | -interface PageInterface{ |
|
12 | +interface PageInterface { |
|
13 | 13 | |
14 | 14 | public function setTwig(Twig_Environment $twig); |
15 | 15 |
@@ -12,12 +12,12 @@ |
||
12 | 12 | |
13 | 13 | public function __construct($failures, $message = "", $code = 0, $previous = null){ |
14 | 14 | |
15 | - parent::__construct($message, $code, $previous); |
|
15 | + parent::__construct($message, $code, $previous); |
|
16 | 16 | |
17 | - $this->failures = $failures; |
|
17 | + $this->failures = $failures; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | function getFailures(){ |
21 | - return $this->failures; |
|
21 | + return $this->failures; |
|
22 | 22 | } |
23 | 23 | } |
@@ -6,18 +6,18 @@ |
||
6 | 6 | * |
7 | 7 | * @author Dmitriy |
8 | 8 | */ |
9 | -class ValidationException extends \Exception{ |
|
9 | +class ValidationException extends \Exception { |
|
10 | 10 | |
11 | 11 | private $failures; |
12 | 12 | |
13 | - public function __construct($failures, $message = "", $code = 0, $previous = null){ |
|
13 | + public function __construct($failures, $message = "", $code = 0, $previous = null) { |
|
14 | 14 | |
15 | 15 | parent::__construct($message, $code, $previous); |
16 | 16 | |
17 | 17 | $this->failures = $failures; |
18 | 18 | } |
19 | 19 | |
20 | - function getFailures(){ |
|
20 | + function getFailures() { |
|
21 | 21 | return $this->failures; |
22 | 22 | } |
23 | 23 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * |
9 | 9 | * @author Dmitriy |
10 | 10 | */ |
11 | -interface CrudInterface{ |
|
11 | +interface CrudInterface { |
|
12 | 12 | |
13 | 13 | public function findById($id); |
14 | 14 |
@@ -16,25 +16,25 @@ |
||
16 | 16 | class SeedResetCommand extends Command{ |
17 | 17 | |
18 | 18 | protected function configure(){ |
19 | - $this->setName('seed:reset') |
|
20 | - ->setDescription('Reset all seeds data') |
|
21 | - ->setDefinition( |
|
22 | - new InputDefinition(array( |
|
23 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
24 | - )) |
|
25 | - ); |
|
19 | + $this->setName('seed:reset') |
|
20 | + ->setDescription('Reset all seeds data') |
|
21 | + ->setDefinition( |
|
22 | + new InputDefinition(array( |
|
23 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
24 | + )) |
|
25 | + ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | protected function execute(InputInterface $input, OutputInterface $output){ |
29 | 29 | |
30 | - if(!$class = $input->getOption('class')){ |
|
31 | - $output->writeln("Class Model not set"); |
|
32 | - return; |
|
33 | - } |
|
30 | + if(!$class = $input->getOption('class')){ |
|
31 | + $output->writeln("Class Model not set"); |
|
32 | + return; |
|
33 | + } |
|
34 | 34 | |
35 | - if($class::reset()){ |
|
36 | - $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
37 | - } else |
|
38 | - $output->writeln("Command seed:reset fail to execute!"); |
|
35 | + if($class::reset()){ |
|
36 | + $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
37 | + } else |
|
38 | + $output->writeln("Command seed:reset fail to execute!"); |
|
39 | 39 | } |
40 | 40 | } |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @author Dmitriy |
15 | 15 | */ |
16 | -class SeedResetCommand extends Command{ |
|
16 | +class SeedResetCommand extends Command { |
|
17 | 17 | |
18 | - protected function configure(){ |
|
18 | + protected function configure() { |
|
19 | 19 | $this->setName('seed:reset') |
20 | 20 | ->setDescription('Reset all seeds data') |
21 | 21 | ->setDefinition( |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | ); |
26 | 26 | } |
27 | 27 | |
28 | - protected function execute(InputInterface $input, OutputInterface $output){ |
|
28 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
29 | 29 | |
30 | - if(!$class = $input->getOption('class')){ |
|
30 | + if (!$class = $input->getOption('class')) { |
|
31 | 31 | $output->writeln("Class Model not set"); |
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | - if($class::reset()){ |
|
35 | + if ($class::reset()) { |
|
36 | 36 | $output->writeln(sprintf("Seed %s reset success!", $class)); |
37 | 37 | } else |
38 | 38 | $output->writeln("Command seed:reset fail to execute!"); |
@@ -34,7 +34,8 @@ |
||
34 | 34 | |
35 | 35 | if($class::reset()){ |
36 | 36 | $output->writeln(sprintf("Seed %s reset success!", $class)); |
37 | - } else |
|
38 | - $output->writeln("Command seed:reset fail to execute!"); |
|
37 | + } else { |
|
38 | + $output->writeln("Command seed:reset fail to execute!"); |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | class InfoCommand extends Command{ |
14 | 14 | |
15 | 15 | protected function configure(){ |
16 | - $this->setName('info') |
|
17 | - ->setDescription('Outputs \'Info about command\''); |
|
16 | + $this->setName('info') |
|
17 | + ->setDescription('Outputs \'Info about command\''); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | protected function execute(InputInterface $input, OutputInterface $output){ |
21 | - $output->writeln('This is frameworkless console'); |
|
21 | + $output->writeln('This is frameworkless console'); |
|
22 | 22 | } |
23 | 23 | } |
@@ -10,14 +10,14 @@ |
||
10 | 10 | * |
11 | 11 | * @author Dmitriy |
12 | 12 | */ |
13 | -class InfoCommand extends Command{ |
|
13 | +class InfoCommand extends Command { |
|
14 | 14 | |
15 | - protected function configure(){ |
|
15 | + protected function configure() { |
|
16 | 16 | $this->setName('info') |
17 | 17 | ->setDescription('Outputs \'Info about command\''); |
18 | 18 | } |
19 | 19 | |
20 | - protected function execute(InputInterface $input, OutputInterface $output){ |
|
20 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
21 | 21 | $output->writeln('This is frameworkless console'); |
22 | 22 | } |
23 | 23 | } |