Completed
Push — master ( 357eb6...5eff20 )
by dima
02:34
created
app/Controllers/PageInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
  */
14 14
 interface PageInterface {
15 15
 	
16
-	public function setTwig(Twig_Environment $twig);
16
+    public function setTwig(Twig_Environment $twig);
17 17
 	
18
-	public  function setDebugbar(StandardDebugBar $debugbar);
18
+    public  function setDebugbar(StandardDebugBar $debugbar);
19 19
 	
20 20
 }
Please login to merge, or discard this patch.
app/Exceptions/ValidationException.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
  */
10 10
 class ValidationException extends \Exception {
11 11
 
12
-	private $failures;
12
+    private $failures;
13 13
 
14
-	public function __construct($failures, $message = "", $code = 0, $previous = null) {
14
+    public function __construct($failures, $message = "", $code = 0, $previous = null) {
15 15
 		
16
-		parent::__construct($message, $code, $previous);
16
+        parent::__construct($message, $code, $previous);
17 17
 		
18
-		$this->failures = $failures;
19
-	}
18
+        $this->failures = $failures;
19
+    }
20 20
 
21
-	function getFailures() {
22
-		return $this->failures;
23
-	}
21
+    function getFailures() {
22
+        return $this->failures;
23
+    }
24 24
 
25 25
 }
Please login to merge, or discard this patch.
packages/core/src/Modules/UserList/UserList.php 3 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Core\Modules\UserList;
3 3
 
4
-use Frameworkless\Controllers;
5
-use Donquixote\Cellbrush\Table\Table;
4
+use Frameworkless\Controllers;
5
+use Donquixote\Cellbrush\Table\Table;
6 6
 use Symfony\Component\HttpFoundation\Request;
7 7
 
8 8
 /**
Please login to merge, or discard this patch.
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -13,82 +13,82 @@
 block discarded – undo
13 13
 class UserList extends Controllers\ModuleController
14 14
 {
15 15
 
16
-	/**
17
-	 * UserRepository 
18
-	 * @var \Core\Models\User\UserRepository 
19
-	 */
20
-	protected $userRepository;
21
-
22
-	/**
23
-	 * Request
24
-	 * @var Symfony\Component\HttpFoundation\Request 
25
-	 */
26
-	protected $request;
27
-
28
-	protected $limit = 5;
29
-
30
-	function __construct(\Core\Models\User\UserRepository $userRepository, Request $request)
31
-	{
32
-		$this->userRepository	 = $userRepository;
33
-		$this->request			 = $request;
34
-	}
35
-
36
-	public function process()
37
-	{
38
-
39
-		if ($this->request->query->get('fn') == 'add') {
40
-			$this->add();
41
-		}
42
-
43
-		$Users = $this->userRepository->findMany([],$this->limit);
44
-
45
-		$table	 = Table::create();
46
-		$table->addColNames([0, 1, 2]);
47
-		$table->addClass('table table-striped');
48
-		$table->thead()
49
-				->addRowName('head row')
50
-				->th('head row', 0, 'Id')
51
-				->th('head row', 1, 'Имя')
52
-				->th('head row', 2, 'Email');
53
-		$i		 = 0;
54
-		foreach ($Users as $User) {
55
-			$table->addRow($i)->tdMultiple([
56
-				$User->getId(),
57
-				$User->getName(),
58
-				$User->getEmail()]);
59
-			$i++;
60
-		}
61
-
62
-		return $this->render('default', [
63
-					'table' => $table->render()
64
-		]);
65
-	}
66
-
67
-	protected function add()
68
-	{
69
-
70
-		try {
71
-
72
-			$User = $this->userRepository->build();
73
-			$User->setEmail('[email protected]');
74
-
75
-			if (!$this->userRepository->save($User)) {
76
-				throw new Exception('User not save');
77
-			} else {
78
-				$this->logger->info("Пользователь успешно сохранен!");
79
-			}
80
-		} catch(\Frameworkless\Exceptions\ValidationException $ex) {
81
-
82
-			foreach ($ex->getFailures() as $failure) {
83
-				$this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
84
-			}
85
-
86
-			$this->logger->info("Произошла ошибка при сохранении пользователя");
87
-		} catch(\Exception $ex) {
88
-
89
-			$this->logger->error("system error:" . $ex->getMessage());
90
-
91
-			$this->logger->info("Произошла ошибка при сохранении пользователя");
92
-		}
93
-	}
16
+    /**
17
+     * UserRepository 
18
+     * @var \Core\Models\User\UserRepository 
19
+     */
20
+    protected $userRepository;
21
+
22
+    /**
23
+     * Request
24
+     * @var Symfony\Component\HttpFoundation\Request 
25
+     */
26
+    protected $request;
27
+
28
+    protected $limit = 5;
29
+
30
+    function __construct(\Core\Models\User\UserRepository $userRepository, Request $request)
31
+    {
32
+        $this->userRepository	 = $userRepository;
33
+        $this->request			 = $request;
34
+    }
35
+
36
+    public function process()
37
+    {
38
+
39
+        if ($this->request->query->get('fn') == 'add') {
40
+            $this->add();
41
+        }
42
+
43
+        $Users = $this->userRepository->findMany([],$this->limit);
44
+
45
+        $table	 = Table::create();
46
+        $table->addColNames([0, 1, 2]);
47
+        $table->addClass('table table-striped');
48
+        $table->thead()
49
+                ->addRowName('head row')
50
+                ->th('head row', 0, 'Id')
51
+                ->th('head row', 1, 'Имя')
52
+                ->th('head row', 2, 'Email');
53
+        $i		 = 0;
54
+        foreach ($Users as $User) {
55
+            $table->addRow($i)->tdMultiple([
56
+                $User->getId(),
57
+                $User->getName(),
58
+                $User->getEmail()]);
59
+            $i++;
60
+        }
61
+
62
+        return $this->render('default', [
63
+                    'table' => $table->render()
64
+        ]);
65
+    }
66
+
67
+    protected function add()
68
+    {
69
+
70
+        try {
71
+
72
+            $User = $this->userRepository->build();
73
+            $User->setEmail('[email protected]');
74
+
75
+            if (!$this->userRepository->save($User)) {
76
+                throw new Exception('User not save');
77
+            } else {
78
+                $this->logger->info("Пользователь успешно сохранен!");
79
+            }
80
+        } catch(\Frameworkless\Exceptions\ValidationException $ex) {
81
+
82
+            foreach ($ex->getFailures() as $failure) {
83
+                $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
84
+            }
85
+
86
+            $this->logger->info("Произошла ошибка при сохранении пользователя");
87
+        } catch(\Exception $ex) {
88
+
89
+            $this->logger->error("system error:" . $ex->getMessage());
90
+
91
+            $this->logger->info("Произошла ошибка при сохранении пользователя");
92
+        }
93
+    }
94 94
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 
30 30
 	function __construct(\Core\Models\User\UserRepository $userRepository, Request $request)
31 31
 	{
32
-		$this->userRepository	 = $userRepository;
33
-		$this->request			 = $request;
32
+		$this->userRepository = $userRepository;
33
+		$this->request = $request;
34 34
 	}
35 35
 
36 36
 	public function process()
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 			$this->add();
41 41
 		}
42 42
 
43
-		$Users = $this->userRepository->findMany([],$this->limit);
43
+		$Users = $this->userRepository->findMany([], $this->limit);
44 44
 
45
-		$table	 = Table::create();
45
+		$table = Table::create();
46 46
 		$table->addColNames([0, 1, 2]);
47 47
 		$table->addClass('table table-striped');
48 48
 		$table->thead()
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				->th('head row', 0, 'Id')
51 51
 				->th('head row', 1, 'Имя')
52 52
 				->th('head row', 2, 'Email');
53
-		$i		 = 0;
53
+		$i = 0;
54 54
 		foreach ($Users as $User) {
55 55
 			$table->addRow($i)->tdMultiple([
56 56
 				$User->getId(),
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 			} else {
78 78
 				$this->logger->info("Пользователь успешно сохранен!");
79 79
 			}
80
-		} catch(\Frameworkless\Exceptions\ValidationException $ex) {
80
+		} catch (\Frameworkless\Exceptions\ValidationException $ex) {
81 81
 
82 82
 			foreach ($ex->getFailures() as $failure) {
83 83
 				$this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
84 84
 			}
85 85
 
86 86
 			$this->logger->info("Произошла ошибка при сохранении пользователя");
87
-		} catch(\Exception $ex) {
87
+		} catch (\Exception $ex) {
88 88
 
89 89
 			$this->logger->error("system error:" . $ex->getMessage());
90 90
 
Please login to merge, or discard this patch.
packages/core/src/Models/User/UserRepository.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function findById($id)
29 29
     {
30 30
         if (!$User = UserQuery::create()->findPk($id)) {
31
-            throw new \InvalidArgumentException(sprintf('User with ID %d does not exist',$id));
31
+            throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id));
32 32
         }
33 33
 
34 34
         return $User;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * 
60 60
      * @return \Core\Models\User\User $User
61 61
      */
62
-    public function build(){
62
+    public function build() {
63 63
         return new User;
64 64
     }
65 65
 
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@
 block discarded – undo
36 36
 
37 37
     public function findMany(array $conditions = [], $limit = false)
38 38
     {
39
-		$Users = UserQuery::create()
40
-				->_if($limit)
41
-					->limit($limit)
42
-				->_endif()
43
-				->findByArray($conditions);
39
+        $Users = UserQuery::create()
40
+                ->_if($limit)
41
+                    ->limit($limit)
42
+                ->_endif()
43
+                ->findByArray($conditions);
44 44
         return $Users;    
45 45
     }
46 46
 
Please login to merge, or discard this patch.
packages/core/src/Models/User/User.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
 class User extends BaseUser
17 17
 {
18 18
 
19
-	use \Frameworkless\ValidatorTrait;
19
+    use \Frameworkless\ValidatorTrait;
20 20
 
21 21
 }
Please login to merge, or discard this patch.
app/ValidatorTrait.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,26 +15,26 @@
 block discarded – undo
15 15
  */
16 16
 trait ValidatorTrait
17 17
 {
18
-	/**
19
-	 * Symfony\Component\Validator\Validator\RecursiveValidator
20
-	 * @var type 
21
-	 */
22
-	protected $validator;
18
+    /**
19
+     * Symfony\Component\Validator\Validator\RecursiveValidator
20
+     * @var type 
21
+     */
22
+    protected $validator;
23 23
 			
24 24
     function __construct()
25
-	{
26
-		$this->validator = new RecursiveValidator(
25
+    {
26
+        $this->validator = new RecursiveValidator(
27 27
             new ExecutionContextFactory(new IdentityTranslator()),
28 28
             new LazyLoadingMetadataFactory(new StaticMethodLoader()),
29 29
             new ConstraintValidatorFactory()
30 30
         );
31
-	}
31
+    }
32 32
 	
33
-	public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null)
34
-	{
33
+    public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null)
34
+    {
35 35
         if (!$result = $this->validate($this->validator)) {
36 36
             throw new ValidationException($this->getValidationFailures(),"Validation error");
37 37
         }     		
38
-		return $result;
39
-	}	
38
+        return $result;
39
+    }	
40 40
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null)
34 34
 	{
35 35
         if (!$result = $this->validate($this->validator)) {
36
-            throw new ValidationException($this->getValidationFailures(),"Validation error");
36
+            throw new ValidationException($this->getValidationFailures(), "Validation error");
37 37
         }     		
38 38
 		return $result;
39 39
 	}	
Please login to merge, or discard this patch.
bootstrap/container.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
  * set Monolog
26 26
  */
27 27
 $container->share(Monolog\Logger::class)
28
-		->withArgument('myLogger')
29
-		;
28
+        ->withArgument('myLogger')
29
+        ;
30 30
 
31 31
 /**
32 32
  * set Propel2 Logger
33 33
  */
34 34
 Propel\Runtime\Propel::getServiceContainer()->setLogger('defaultLogger', 
35
-		(new Monolog\Logger('defaultLogger'))
36
-			->pushHandler(new Monolog\Handler\StreamHandler('php://stderr'))
37
-		);
35
+        (new Monolog\Logger('defaultLogger'))
36
+            ->pushHandler(new Monolog\Handler\StreamHandler('php://stderr'))
37
+        );
38 38
 
39 39
 /**
40 40
  * set Debug bar
41 41
  */
42 42
 $container->share(DebugBar\StandardDebugBar::class)
43
-		->withMethodCall("addCollector",[
44
-			new DebugBar\Bridge\Twig\TwigCollector(
45
-					new DebugBar\Bridge\Twig\TraceableTwigEnvironment(
46
-							$container->get(Twig_Environment::class),
47
-							new DebugBar\DataCollector\TimeDataCollector
48
-							)
49
-					)
50
-		])
51
-		->withMethodCall("addCollector",[
52
-			new DebugBar\Bridge\Propel2Collector(Propel\Runtime\Propel::getConnection())
53
-		])	
54
-		->withMethodCall("addCollector",[
55
-			new \DebugBar\Bridge\MonologCollector($container->get(Monolog\Logger::class))
56
-		])
57
-		;
43
+        ->withMethodCall("addCollector",[
44
+            new DebugBar\Bridge\Twig\TwigCollector(
45
+                    new DebugBar\Bridge\Twig\TraceableTwigEnvironment(
46
+                            $container->get(Twig_Environment::class),
47
+                            new DebugBar\DataCollector\TimeDataCollector
48
+                            )
49
+                    )
50
+        ])
51
+        ->withMethodCall("addCollector",[
52
+            new DebugBar\Bridge\Propel2Collector(Propel\Runtime\Propel::getConnection())
53
+        ])	
54
+        ->withMethodCall("addCollector",[
55
+            new \DebugBar\Bridge\MonologCollector($container->get(Monolog\Logger::class))
56
+        ])
57
+        ;
58 58
 ;
59 59
 
60 60
 
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
  */
64 64
 
65 65
 $container->inflector(Psr\Log\LoggerAwareInterface::class)
66
-          ->invokeMethod('setLogger', [$container->get(Monolog\Logger::class)]);
66
+            ->invokeMethod('setLogger', [$container->get(Monolog\Logger::class)]);
67 67
 
68 68
 $container->inflector(Frameworkless\Controllers\PageInterface::class)
69
-          ->invokeMethod('setTwig', [$container->get(Twig_Environment::class)])
70
-		  ->invokeMethod('setDebugbar', [$container->get(DebugBar\StandardDebugBar::class)])
71
-		;
69
+            ->invokeMethod('setTwig', [$container->get(Twig_Environment::class)])
70
+            ->invokeMethod('setDebugbar', [$container->get(DebugBar\StandardDebugBar::class)])
71
+        ;
72 72
 
73 73
 
74 74
 App::getInstance()->import("DI", $container);
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 /**
14 14
  * set Request
15 15
  */
16
-$container->add(Request::class,Request::createFromGlobals());
16
+$container->add(Request::class, Request::createFromGlobals());
17 17
 
18 18
 /**
19 19
  * set Twig
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * set Debug bar
41 41
  */
42 42
 $container->share(DebugBar\StandardDebugBar::class)
43
-		->withMethodCall("addCollector",[
43
+		->withMethodCall("addCollector", [
44 44
 			new DebugBar\Bridge\Twig\TwigCollector(
45 45
 					new DebugBar\Bridge\Twig\TraceableTwigEnvironment(
46 46
 							$container->get(Twig_Environment::class),
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 							)
49 49
 					)
50 50
 		])
51
-		->withMethodCall("addCollector",[
51
+		->withMethodCall("addCollector", [
52 52
 			new DebugBar\Bridge\Propel2Collector(Propel\Runtime\Propel::getConnection())
53 53
 		])	
54
-		->withMethodCall("addCollector",[
54
+		->withMethodCall("addCollector", [
55 55
 			new \DebugBar\Bridge\MonologCollector($container->get(Monolog\Logger::class))
56 56
 		])
57 57
 		;
Please login to merge, or discard this patch.
bootstrap/common.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -3,53 +3,53 @@
 block discarded – undo
3 3
 class App
4 4
 {
5 5
 
6
-	private $settings = array();
6
+    private $settings = array();
7 7
 	
8
-	private static $_instance = null;
9
-
10
-	private function __construct()
11
-	{
12
-		// приватный конструктор ограничивает реализацию getInstance ()
13
-	}
14
-
15
-	protected function __clone()
16
-	{
17
-		// ограничивает клонирование объекта
18
-	}
19
-
20
-	/**
21
-	 * Вызов модуля
22
-	 * @param type $name
23
-	 * @param array $params
24
-	 * @return string
25
-	 */
26
-	static function getModule($name, array $params = [])
27
-	{
28
-		$DI			 = self::getInstance()->load("DI");
29
-		$debugbar	 = $DI->get(DebugBar\StandardDebugBar::class);
30
-		$debugbar['messages']->debug(sprintf('App::getModule %s, with params %s' , $name, json_encode($params) ));
31
-		$debugbar['time']->startMeasure($name, 'Load module ' . $name);
32
-		$module		 = $DI->get($name);
33
-		$result		 = $module->setParams($params)->process();
34
-		$debugbar['time']->stopMeasure($name);
35
-		return $result;
36
-	}
37
-
38
-	static public function getInstance()
39
-	{
40
-		if (is_null(self::$_instance)) {
41
-			self::$_instance = new self();
42
-		}
43
-		return self::$_instance;
44
-	}
45
-
46
-	public function import($key,$value)
47
-	{
48
-		$this->settings[$key] = $value;
49
-	}
50
-
51
-	public function load($key)
52
-	{
53
-		return $this->settings[$key];
54
-	}
8
+    private static $_instance = null;
9
+
10
+    private function __construct()
11
+    {
12
+        // приватный конструктор ограничивает реализацию getInstance ()
13
+    }
14
+
15
+    protected function __clone()
16
+    {
17
+        // ограничивает клонирование объекта
18
+    }
19
+
20
+    /**
21
+     * Вызов модуля
22
+     * @param type $name
23
+     * @param array $params
24
+     * @return string
25
+     */
26
+    static function getModule($name, array $params = [])
27
+    {
28
+        $DI			 = self::getInstance()->load("DI");
29
+        $debugbar	 = $DI->get(DebugBar\StandardDebugBar::class);
30
+        $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s' , $name, json_encode($params) ));
31
+        $debugbar['time']->startMeasure($name, 'Load module ' . $name);
32
+        $module		 = $DI->get($name);
33
+        $result		 = $module->setParams($params)->process();
34
+        $debugbar['time']->stopMeasure($name);
35
+        return $result;
36
+    }
37
+
38
+    static public function getInstance()
39
+    {
40
+        if (is_null(self::$_instance)) {
41
+            self::$_instance = new self();
42
+        }
43
+        return self::$_instance;
44
+    }
45
+
46
+    public function import($key,$value)
47
+    {
48
+        $this->settings[$key] = $value;
49
+    }
50
+
51
+    public function load($key)
52
+    {
53
+        return $this->settings[$key];
54
+    }
55 55
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	static function getModule($name, array $params = [])
27 27
 	{
28
-		$DI			 = self::getInstance()->load("DI");
29
-		$debugbar	 = $DI->get(DebugBar\StandardDebugBar::class);
30
-		$debugbar['messages']->debug(sprintf('App::getModule %s, with params %s' , $name, json_encode($params) ));
28
+		$DI = self::getInstance()->load("DI");
29
+		$debugbar = $DI->get(DebugBar\StandardDebugBar::class);
30
+		$debugbar['messages']->debug(sprintf('App::getModule %s, with params %s', $name, json_encode($params)));
31 31
 		$debugbar['time']->startMeasure($name, 'Load module ' . $name);
32 32
 		$module		 = $DI->get($name);
33 33
 		$result		 = $module->setParams($params)->process();
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		return self::$_instance;
44 44
 	}
45 45
 
46
-	public function import($key,$value)
46
+	public function import($key, $value)
47 47
 	{
48 48
 		$this->settings[$key] = $value;
49 49
 	}
Please login to merge, or discard this patch.
app/ModuleInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 interface ModuleInterface {
10 10
 	
11
-	public function process();
11
+    public function process();
12 12
 	
13
-	public function setParams(array $params = []);
13
+    public function setParams(array $params = []);
14 14
 }
Please login to merge, or discard this patch.