@@ -29,8 +29,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -25,9 +25,9 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | * @author d.lanec |
| 9 | 9 | */ |
| 10 | -abstract class ModuleController extends BaseController implements \Frameworkless\ModuleInterface{
|
|
| 10 | +abstract class ModuleController extends BaseController implements \Frameworkless\ModuleInterface {
|
|
| 11 | 11 | |
| 12 | 12 | protected function render($view, array $data = array()) {
|
| 13 | 13 | |
| 14 | 14 | $ref = new \ReflectionClass($this); |
| 15 | 15 | |
| 16 | - $tpl = (new \SplFileInfo($ref->getFileName()))->getPath() . DIRECTORY_SEPARATOR .'tpl'; |
|
| 16 | + $tpl = (new \SplFileInfo($ref->getFileName()))->getPath() . DIRECTORY_SEPARATOR . 'tpl'; |
|
| 17 | 17 | |
| 18 | 18 | $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($tpl)); |
| 19 | 19 | |
| 20 | - return $twig->render($view . '.twig',$data); |
|
| 20 | + return $twig->render($view . '.twig', $data); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | abstract public function process(); |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | public function setParams(array $params = array()) |
| 32 | 32 | {
|
| 33 | 33 | |
| 34 | - foreach($params as $param => $value){
|
|
| 35 | - if((new \ReflectionClass($this))->hasProperty($param)===false) |
|
| 36 | - throw new \Exception(sprintf("param '%s' not found in module '%s'",$param,self::class));
|
|
| 34 | + foreach ($params as $param => $value) {
|
|
| 35 | + if ((new \ReflectionClass($this))->hasProperty($param) === false) |
|
| 36 | + throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class));
|
|
| 37 | 37 | |
| 38 | 38 | $this->{$param} = $value;
|
| 39 | 39 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function get($args) { |
| 18 | 18 | |
| 19 | - $result = \App::getModule(UserList::class,[ |
|
| 19 | + $result = \App::getModule(UserList::class, [ |
|
| 20 | 20 | "limit" => 2 |
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | - $result .= \App::getModule(UserList::class,[ |
|
| 23 | + $result .= \App::getModule(UserList::class, [ |
|
| 24 | 24 | "limit" => 1 |
| 25 | 25 | ]); |
| 26 | 26 | |