@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | * @return type |
| 15 | 15 | */ |
| 16 | 16 | static public function build($id = 1){ |
| 17 | - $generator = \Faker\Factory::create(); |
|
| 18 | - $populator = new \Faker\ORM\Propel2\Populator($generator); |
|
| 19 | - $populator->addEntity(\Core\Models\User\User::class, $id); |
|
| 20 | - return $populator->execute(); |
|
| 17 | + $generator = \Faker\Factory::create(); |
|
| 18 | + $populator = new \Faker\ORM\Propel2\Populator($generator); |
|
| 19 | + $populator->addEntity(\Core\Models\User\User::class, $id); |
|
| 20 | + return $populator->execute(); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -25,6 +25,6 @@ discard block |
||
| 25 | 25 | * @return type |
| 26 | 26 | */ |
| 27 | 27 | public static function reset(){ |
| 28 | - return \Core\Models\User\UserQuery::create()->deleteAll(); |
|
| 28 | + return \Core\Models\User\UserQuery::create()->deleteAll(); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | * @author Dmitriy |
| 8 | 8 | */ |
| 9 | -class User implements \Frameworkless\SeedInterface{ |
|
| 9 | +class User implements \Frameworkless\SeedInterface { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
| 13 | 13 | * @param type $id |
| 14 | 14 | * @return type |
| 15 | 15 | */ |
| 16 | - static public function build($id = 1){ |
|
| 16 | + static public function build($id = 1) { |
|
| 17 | 17 | $generator = \Faker\Factory::create(); |
| 18 | 18 | $populator = new \Faker\ORM\Propel2\Populator($generator); |
| 19 | 19 | $populator->addEntity(\Core\Models\User\User::class, $id); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @return type |
| 26 | 26 | */ |
| 27 | - public static function reset(){ |
|
| 27 | + public static function reset() { |
|
| 28 | 28 | return \Core\Models\User\UserQuery::create()->deleteAll(); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | * |
| 9 | 9 | * @author Dmitriy |
| 10 | 10 | */ |
| 11 | -class ServiceProvider extends AbstractServiceProvider{ |
|
| 11 | +class ServiceProvider extends AbstractServiceProvider { |
|
| 12 | 12 | |
| 13 | 13 | protected $provides = [ |
| 14 | 14 | ]; |
| 15 | 15 | |
| 16 | - public function register(){ |
|
| 16 | + public function register() { |
|
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | class UserRepository implements \Frameworkless\CrudInterface{ |
| 13 | 13 | |
| 14 | 14 | public function find(array $conditions = []){ |
| 15 | - return UserQuery::create()->findOneByArray($conditions); |
|
| 15 | + return UserQuery::create()->findOneByArray($conditions); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -22,24 +22,24 @@ discard block |
||
| 22 | 22 | * @throws \InvalidArgumentException |
| 23 | 23 | */ |
| 24 | 24 | public function findById($id){ |
| 25 | - if(!$User = UserQuery::create()->findPk($id)){ |
|
| 26 | - throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
|
| 27 | - } |
|
| 25 | + if(!$User = UserQuery::create()->findPk($id)){ |
|
| 26 | + throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - return $User; |
|
| 29 | + return $User; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function findMany(array $conditions = [], $limit = false){ |
| 33 | - $Users = UserQuery::create() |
|
| 34 | - ->_if($limit) |
|
| 35 | - ->limit($limit) |
|
| 36 | - ->_endif() |
|
| 37 | - ->findByArray($conditions); |
|
| 38 | - return $Users; |
|
| 33 | + $Users = UserQuery::create() |
|
| 34 | + ->_if($limit) |
|
| 35 | + ->limit($limit) |
|
| 36 | + ->_endif() |
|
| 37 | + ->findByArray($conditions); |
|
| 38 | + return $Users; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function delete(ActiveRecordInterface $Model){ |
| 42 | - return $Model->delete(); |
|
| 42 | + return $Model->delete(); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @throws \DomainException |
| 50 | 50 | */ |
| 51 | 51 | public function save(ActiveRecordInterface $Model){ |
| 52 | - return $Model->save(); |
|
| 52 | + return $Model->save(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,6 +57,6 @@ discard block |
||
| 57 | 57 | * @return \Core\Models\User\User $User |
| 58 | 58 | */ |
| 59 | 59 | public function build(){ |
| 60 | - return new User; |
|
| 60 | + return new User; |
|
| 61 | 61 | } |
| 62 | 62 | } |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @author Dmitriy |
| 11 | 11 | */ |
| 12 | -class UserRepository implements \Frameworkless\CrudInterface{ |
|
| 12 | +class UserRepository implements \Frameworkless\CrudInterface { |
|
| 13 | 13 | |
| 14 | - public function find(array $conditions = []){ |
|
| 14 | + public function find(array $conditions = []) { |
|
| 15 | 15 | return UserQuery::create()->findOneByArray($conditions); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -21,15 +21,15 @@ discard block |
||
| 21 | 21 | * @return \Models\User\User $User |
| 22 | 22 | * @throws \InvalidArgumentException |
| 23 | 23 | */ |
| 24 | - public function findById($id){ |
|
| 25 | - if(!$User = UserQuery::create()->findPk($id)){ |
|
| 24 | + public function findById($id) { |
|
| 25 | + if (!$User = UserQuery::create()->findPk($id)) { |
|
| 26 | 26 | throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return $User; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function findMany(array $conditions = [], $limit = false){ |
|
| 32 | + public function findMany(array $conditions = [], $limit = false) { |
|
| 33 | 33 | $Users = UserQuery::create() |
| 34 | 34 | ->_if($limit) |
| 35 | 35 | ->limit($limit) |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return $Users; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function delete(ActiveRecordInterface $Model){ |
|
| 41 | + public function delete(ActiveRecordInterface $Model) { |
|
| 42 | 42 | return $Model->delete(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @return boolean |
| 49 | 49 | * @throws \DomainException |
| 50 | 50 | */ |
| 51 | - public function save(ActiveRecordInterface $Model){ |
|
| 51 | + public function save(ActiveRecordInterface $Model) { |
|
| 52 | 52 | return $Model->save(); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return \Core\Models\User\User $User |
| 58 | 58 | */ |
| 59 | - public function build(){ |
|
| 59 | + public function build() { |
|
| 60 | 60 | return new User; |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | /** |
| 10 | 10 | * Return index page (/) |
| 11 | 11 | * |
| 12 | - * @param array $args |
|
| 13 | 12 | * @return Response |
| 14 | 13 | */ |
| 15 | 14 | public function get(){ |
@@ -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(){ |
|
| 15 | + public function get() { |
|
| 16 | 16 | |
| 17 | 17 | $result = \App::getModule(UserList::class, [ |
| 18 | 18 | "limit" => 50 |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function get(){ |
| 16 | 16 | |
| 17 | - $result = \App::getModule(UserListModule::class, [ |
|
| 18 | - "limit" => 50 |
|
| 19 | - ]); |
|
| 17 | + $result = \App::getModule(UserListModule::class, [ |
|
| 18 | + "limit" => 50 |
|
| 19 | + ]); |
|
| 20 | 20 | |
| 21 | - return new Response($this->render('pages/index.html.twig', [ |
|
| 22 | - "content" => $result, |
|
| 23 | - ])); |
|
| 21 | + return new Response($this->render('pages/index.html.twig', [ |
|
| 22 | + "content" => $result, |
|
| 23 | + ])); |
|
| 24 | 24 | } |
| 25 | 25 | } |
@@ -7,11 +7,11 @@ discard block |
||
| 7 | 7 | private static $_instance = null; |
| 8 | 8 | |
| 9 | 9 | private function __construct(){ |
| 10 | - // приватный конструктор ограничивает реализацию getInstance () |
|
| 10 | + // приватный конструктор ограничивает реализацию getInstance () |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | protected function __clone(){ |
| 14 | - // ограничивает клонирование объекта |
|
| 14 | + // ограничивает клонирование объекта |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -21,28 +21,28 @@ discard block |
||
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | 23 | public static function getModule($name, array $params = []){ |
| 24 | - $DI = self::getInstance()->load("DI"); |
|
| 25 | - $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
| 26 | - $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s', $name, json_encode($params))); |
|
| 27 | - $debugbar['time']->startMeasure($name, 'Load module ' . $name); |
|
| 28 | - $module = $DI->get($name); |
|
| 29 | - $result = $module->setParams($params)->process(); |
|
| 30 | - $debugbar['time']->stopMeasure($name); |
|
| 31 | - return $result; |
|
| 24 | + $DI = self::getInstance()->load("DI"); |
|
| 25 | + $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
| 26 | + $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s', $name, json_encode($params))); |
|
| 27 | + $debugbar['time']->startMeasure($name, 'Load module ' . $name); |
|
| 28 | + $module = $DI->get($name); |
|
| 29 | + $result = $module->setParams($params)->process(); |
|
| 30 | + $debugbar['time']->stopMeasure($name); |
|
| 31 | + return $result; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public static function getInstance(){ |
| 35 | - if(is_null(self::$_instance)){ |
|
| 36 | - self::$_instance = new self(); |
|
| 37 | - } |
|
| 38 | - return self::$_instance; |
|
| 35 | + if(is_null(self::$_instance)){ |
|
| 36 | + self::$_instance = new self(); |
|
| 37 | + } |
|
| 38 | + return self::$_instance; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function import($key, $value){ |
| 42 | - $this->settings[$key] = $value; |
|
| 42 | + $this->settings[$key] = $value; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function load($key){ |
| 46 | - return $this->settings[$key]; |
|
| 46 | + return $this->settings[$key]; |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class App{ |
|
| 3 | +class App { |
|
| 4 | 4 | |
| 5 | 5 | private $settings = array(); |
| 6 | 6 | |
| 7 | 7 | private static $_instance = null; |
| 8 | 8 | |
| 9 | - private function __construct(){ |
|
| 9 | + private function __construct() { |
|
| 10 | 10 | // приватный конструктор ограничивает реализацию getInstance () |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - protected function __clone(){ |
|
| 13 | + protected function __clone() { |
|
| 14 | 14 | // ограничивает клонирование объекта |
| 15 | 15 | } |
| 16 | 16 | |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | * @param array $params |
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | - public static function getModule($name, array $params = []){ |
|
| 24 | - $DI = self::getInstance()->load("DI"); |
|
| 25 | - $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
| 23 | + public static function getModule($name, array $params = []) { |
|
| 24 | + $DI = self::getInstance()->load("DI"); |
|
| 25 | + $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
| 26 | 26 | $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s', $name, json_encode($params))); |
| 27 | 27 | $debugbar['time']->startMeasure($name, 'Load module ' . $name); |
| 28 | 28 | $module = $DI->get($name); |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | return $result; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public static function getInstance(){ |
|
| 35 | - if(is_null(self::$_instance)){ |
|
| 34 | + public static function getInstance() { |
|
| 35 | + if (is_null(self::$_instance)) { |
|
| 36 | 36 | self::$_instance = new self(); |
| 37 | 37 | } |
| 38 | 38 | return self::$_instance; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function import($key, $value){ |
|
| 41 | + public function import($key, $value) { |
|
| 42 | 42 | $this->settings[$key] = $value; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function load($key){ |
|
| 45 | + public function load($key) { |
|
| 46 | 46 | return $this->settings[$key]; |
| 47 | 47 | } |
| 48 | 48 | } |