| @@ -1,15 +1,15 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Global Configuration Override | |
| 4 | - * | |
| 5 | - * You can use this file for overriding configuration values from modules, etc. | |
| 6 | - * You would place values in here that are agnostic to the environment and not | |
| 7 | - * sensitive to security. | |
| 8 | - * | |
| 9 | - * @NOTE: In practice, this file will typically be INCLUDED in your source | |
| 10 | - * control, so do not include passwords or other sensitive information in this | |
| 11 | - * file. | |
| 12 | - */ | |
| 3 | + * Global Configuration Override | |
| 4 | + * | |
| 5 | + * You can use this file for overriding configuration values from modules, etc. | |
| 6 | + * You would place values in here that are agnostic to the environment and not | |
| 7 | + * sensitive to security. | |
| 8 | + * | |
| 9 | + * @NOTE: In practice, this file will typically be INCLUDED in your source | |
| 10 | + * control, so do not include passwords or other sensitive information in this | |
| 11 | + * file. | |
| 12 | + */ | |
| 13 | 13 | |
| 14 | 14 | return [ | 
| 15 | 15 | |
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Generate report | |
| 4 | - * adopted and modified version from http://stackoverflow.com/questions/28120280/how-to-generate-php-code-coverage-reports-from-xdebug-output | |
| 5 | - */ | |
| 3 | + * Generate report | |
| 4 | + * adopted and modified version from http://stackoverflow.com/questions/28120280/how-to-generate-php-code-coverage-reports-from-xdebug-output | |
| 5 | + */ | |
| 6 | 6 | require_once 'vendor/autoload.php'; | 
| 7 | 7 | |
| 8 | 8 | use SebastianBergmann\FinderFacade\FinderFacade; | 
| @@ -111,7 +111,7 @@ | ||
| 111 | 111 |          if (!$e->getViewModel()->terminate()) { | 
| 112 | 112 |              $entityManager = $this->services->get('Doctrine\ORM\EntityManager'); | 
| 113 | 113 | $e->getViewModel() | 
| 114 | -              ->setVariable('modules_list', $entityManager->getRepository('Application\Entity\ModuleList')->findBy([], ['id' => 'DESC'])); | |
| 114 | +                ->setVariable('modules_list', $entityManager->getRepository('Application\Entity\ModuleList')->findBy([], ['id' => 'DESC'])); | |
| 115 | 115 | } | 
| 116 | 116 | } | 
| 117 | 117 | |
| @@ -45,8 +45,8 @@ discard block | ||
| 45 | 45 | $this->services = $e->getApplication()->getServiceManager(); | 
| 46 | 46 | |
| 47 | 47 | $eventManager = $e->getApplication()->getEventManager(); | 
| 48 | - $eventManager->attach(MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch']); | |
| 49 | - $eventManager->attach(MvcEvent::EVENT_RENDER, [$this, 'onRender']); | |
| 48 | + $eventManager->attach(MvcEvent::EVENT_DISPATCH, [ $this, 'onDispatch' ]); | |
| 49 | + $eventManager->attach(MvcEvent::EVENT_RENDER, [ $this, 'onRender' ]); | |
| 50 | 50 | |
| 51 | 51 | $moduleRouteListener = new ModuleRouteListener(); | 
| 52 | 52 | $moduleRouteListener->attach($eventManager); | 
| @@ -74,8 +74,8 @@ discard block | ||
| 74 | 74 | $controllerClass = get_class($controller); | 
| 75 | 75 | $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\')); | 
| 76 | 76 | |
| 77 | - $fbMeta['title'] = 'Real Live Learn ZF2'; | |
| 78 | - $fbMeta['description'] = ''; | |
| 77 | + $fbMeta[ 'title' ] = 'Real Live Learn ZF2'; | |
| 78 | + $fbMeta[ 'description' ] = ''; | |
| 79 | 79 | |
| 80 | 80 | // set title prepend of module desc... | 
| 81 | 81 |                  $moduleDetail = $this->services->get('Doctrine\ORM\EntityManager')->getRepository('Application\Entity\ModuleList')->findOneBy([ | 
| @@ -87,8 +87,8 @@ discard block | ||
| 87 | 87 | $title = $moduleDetail->getModuleDesc(); | 
| 88 | 88 | $description = $moduleDetail->getModuleDesc(); | 
| 89 | 89 | |
| 90 | - $fbMeta['title'] = $title.'-'.$fbMeta['title']; | |
| 91 | - $fbMeta['description'] = $description.'-'.$fbMeta['description']; | |
| 90 | + $fbMeta[ 'title' ] = $title.'-'.$fbMeta[ 'title' ]; | |
| 91 | + $fbMeta[ 'description' ] = $description.'-'.$fbMeta[ 'description' ]; | |
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | 94 |                  $e->getViewModel()->setVariable('fbMeta', $fbMeta); | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 |          if (!$e->getViewModel()->terminate()) { | 
| 112 | 112 |              $entityManager = $this->services->get('Doctrine\ORM\EntityManager'); | 
| 113 | 113 | $e->getViewModel() | 
| 114 | -              ->setVariable('modules_list', $entityManager->getRepository('Application\Entity\ModuleList')->findBy([], ['id' => 'DESC'])); | |
| 114 | +              ->setVariable('modules_list', $entityManager->getRepository('Application\Entity\ModuleList')->findBy([ ], [ 'id' => 'DESC' ])); | |
| 115 | 115 | } | 
| 116 | 116 | } | 
| 117 | 117 | |
| @@ -97,7 +97,7 @@ discard block | ||
| 97 | 97 |          foreach ($contributors as $i => $contributor) { | 
| 98 | 98 |              $message = sprintf('    Processing %d/%d', $i, $total); | 
| 99 | 99 | $this->console->write($message); | 
| 100 | -            $this->httpClient->setUri("https://api.github.com/users/{$contributor['login']}"); | |
| 100 | +            $this->httpClient->setUri("https://api.github.com/users/{$contributor[ 'login' ]}"); | |
| 101 | 101 | $response = $this->httpClient->send(); | 
| 102 | 102 |              if (!$response->isSuccess()) { | 
| 103 | 103 | // report failure | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | } | 
| 107 | 107 | $body = $response->getBody(); | 
| 108 | 108 | $userInfo = json_decode($body, 1); | 
| 109 | - $contributors[$i]['user_info'] = $userInfo; | |
| 109 | + $contributors[ $i ][ 'user_info' ] = $userInfo; | |
| 110 | 110 | $this->reportSuccess($width, strlen($message)); | 
| 111 | 111 | } | 
| 112 | 112 | |
| @@ -139,7 +139,7 @@ discard block | ||
| 139 | 139 |          $this->console->writeLine(str_repeat('-', $width)); | 
| 140 | 140 | $message = 'Writing file'; | 
| 141 | 141 | $this->console->write($message, Color::BLUE); | 
| 142 | - $path = $this->config['console']['contributors']['output']; | |
| 142 | + $path = $this->config[ 'console' ][ 'contributors' ][ 'output' ]; | |
| 143 | 143 | file_put_contents($path, serialize($contributors)); | 
| 144 | 144 | $this->reportSuccess($width, strlen($message)); | 
| 145 | 145 |          $this->console->writeLine(sprintf('File written to %s', $path)); | 
| @@ -33,8 +33,8 @@ | ||
| 33 | 33 | $services = $serviceLocator->getServiceLocator(); | 
| 34 | 34 | $moduleList = []; | 
| 35 | 35 |          foreach ($services->get('Doctrine\ORM\EntityManager') | 
| 36 | -                               ->getRepository('Application\Entity\ModuleList') | |
| 37 | -                               ->findAll() as $module) { | |
| 36 | +                                ->getRepository('Application\Entity\ModuleList') | |
| 37 | +                                ->findAll() as $module) { | |
| 38 | 38 | $moduleList[] = $module->getModuleName(); | 
| 39 | 39 | } | 
| 40 | 40 | |
| @@ -31,11 +31,11 @@ | ||
| 31 | 31 | public function createService(ServiceLocatorInterface $serviceLocator) | 
| 32 | 32 |      { | 
| 33 | 33 | $services = $serviceLocator->getServiceLocator(); | 
| 34 | - $moduleList = []; | |
| 34 | + $moduleList = [ ]; | |
| 35 | 35 |          foreach ($services->get('Doctrine\ORM\EntityManager') | 
| 36 | 36 |                                 ->getRepository('Application\Entity\ModuleList') | 
| 37 | 37 |                                 ->findAll() as $module) { | 
| 38 | - $moduleList[] = $module->getModuleName(); | |
| 38 | + $moduleList[ ] = $module->getModuleName(); | |
| 39 | 39 | } | 
| 40 | 40 | |
| 41 | 41 | return new DownloadController($moduleList); | 
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | $services = $serviceLocator->getServiceLocator(); | 
| 34 | 34 | |
| 35 | 35 | return new IndexController( | 
| 36 | -            $services->get('Doctrine\ORM\EntityManager')->getRepository('Application\Entity\ModuleList')->findBy([], ['id' => 'DESC']) | |
| 36 | +            $services->get('Doctrine\ORM\EntityManager')->getRepository('Application\Entity\ModuleList')->findBy([ ], [ 'id' => 'DESC' ]) | |
| 37 | 37 | ); | 
| 38 | 38 | } | 
| 39 | 39 | } | 
| @@ -62,8 +62,8 @@ | ||
| 62 | 62 | |
| 63 | 63 | public function listresourcesandrightsAction() | 
| 64 | 64 |      { | 
| 65 | - $resources = []; | |
| 66 | - $rights = []; | |
| 65 | + $resources = [ ]; | |
| 66 | + $rights = [ ]; | |
| 67 | 67 | |
| 68 | 68 |          if ($this->request->isPost()) { | 
| 69 | 69 |              $roleId = $this->request->getPost('roleId', 0); | 
| @@ -45,12 +45,12 @@ discard block | ||
| 45 | 45 |          $this->addResource(new Resource('AdminController')); | 
| 46 | 46 | |
| 47 | 47 |          $this->allow('Guest', 'HomeController', 'ViewHome'); | 
| 48 | -        $this->allow('Guest', 'UserController', ['ViewUser', 'RegisterUser']); | |
| 48 | +        $this->allow('Guest', 'UserController', [ 'ViewUser', 'RegisterUser' ]); | |
| 49 | 49 | |
| 50 | 50 |          $this->allow('User', 'UserController', 'EditUser'); | 
| 51 | 51 |          $this->deny('User', 'UserController', 'RegisterUser'); | 
| 52 | 52 | |
| 53 | -        $this->allow('Admin', 'AdminController', ['DeleteUser', 'AddUser']); | |
| 53 | +        $this->allow('Admin', 'AdminController', [ 'DeleteUser', 'AddUser' ]); | |
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | 56 | /** | 
| @@ -62,23 +62,23 @@ discard block | ||
| 62 | 62 | */ | 
| 63 | 63 | public function getRightLists($roleId = null) | 
| 64 | 64 |      { | 
| 65 | - $rules = []; | |
| 65 | + $rules = [ ]; | |
| 66 | 66 | $currentRole = 'All'; | 
| 67 | 67 |          foreach ($this->getResources() as $resource) { | 
| 68 | 68 |              foreach ($this->getRoles() as $roleKey => $role) { | 
| 69 | - $rules[] = $this->getRules(new Resource($resource), new Role($role)); | |
| 69 | + $rules[ ] = $this->getRules(new Resource($resource), new Role($role)); | |
| 70 | 70 |                  if ($roleId === $roleKey) { | 
| 71 | 71 | $currentRole = $role; | 
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | 74 | } | 
| 75 | 75 | |
| 76 | - $rights = []; | |
| 76 | + $rights = [ ]; | |
| 77 | 77 |          foreach ($rules as $rule) { | 
| 78 | 78 |              if (is_array($rule)) { | 
| 79 | -                foreach ($rule['byPrivilegeId'] as $right => $typeAndAssert) { | |
| 79 | +                foreach ($rule[ 'byPrivilegeId' ] as $right => $typeAndAssert) { | |
| 80 | 80 |                      if (!in_array($right, $rights)) { | 
| 81 | - $rights[] = $right; | |
| 81 | + $rights[ ] = $right; | |
| 82 | 82 | } | 
| 83 | 83 | } | 
| 84 | 84 | } | 
| @@ -88,13 +88,13 @@ discard block | ||
| 88 | 88 | return $rights; | 
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | - $rightList = []; | |
| 91 | + $rightList = [ ]; | |
| 92 | 92 |          foreach ($this->getResources() as $resource) { | 
| 93 | 93 |              foreach ($rights as $key => $right) { | 
| 94 | 94 | if ($currentRole !== 'All' | 
| 95 | 95 | && $this->isAllowed($currentRole, $resource, $right) && !in_array($right, $rightList) | 
| 96 | 96 |                  ) { | 
| 97 | - $rightList[] = $right; | |
| 97 | + $rightList[ ] = $right; | |
| 98 | 98 | } | 
| 99 | 99 | } | 
| 100 | 100 | } | 
| @@ -119,13 +119,13 @@ discard block | ||
| 119 | 119 | } | 
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | - $resources = []; | |
| 122 | + $resources = [ ]; | |
| 123 | 123 |          foreach ($this->getResources() as $resource) { | 
| 124 | 124 |              foreach ($this->getRightLists() as $right) { | 
| 125 | 125 | if ($this->isAllowed($selectedRole, $resource, $right) | 
| 126 | 126 | && !in_array($resource, $resources) | 
| 127 | 127 |                  ) { | 
| 128 | - $resources[] = $resource; | |
| 128 | + $resources[ ] = $resource; | |
| 129 | 129 | } | 
| 130 | 130 | } | 
| 131 | 131 | } | 
| @@ -9,7 +9,7 @@ discard block | ||
| 9 | 9 | |
| 10 | 10 | namespace LearnZF2Ajax\Model; | 
| 11 | 11 | |
| 12 | -use Zend\InputFilter\Factory as InputFactory; // <-- Add this import | |
| 12 | +use Zend\InputFilter\Factory as InputFactory; // <-- Add this import | |
| 13 | 13 | use Zend\InputFilter\InputFilter; | 
| 14 | 14 | use Zend\InputFilter\InputFilterAwareInterface; | 
| 15 | 15 | use Zend\InputFilter\InputFilterInterface; | 
| @@ -22,8 +22,8 @@ discard block | ||
| 22 | 22 | |
| 23 | 23 | public function exchangeArray($data) | 
| 24 | 24 |      { | 
| 25 | - $this->username = (isset($data['username'])) ? $data['username'] : null; | |
| 26 | - $this->password = (isset($data['password'])) ? $data['password'] : null; | |
| 25 | + $this->username = (isset($data[ 'username' ])) ? $data[ 'username' ] : null; | |
| 26 | + $this->password = (isset($data[ 'password' ])) ? $data[ 'password' ] : null; | |
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | public function setInputFilter(InputFilterInterface $inputFilter) | 
| @@ -41,8 +41,8 @@ discard block | ||
| 41 | 41 | 'name' => 'username', | 
| 42 | 42 | 'required' => true, | 
| 43 | 43 | 'filters' => [ | 
| 44 | - ['name' => 'StripTags'], | |
| 45 | - ['name' => 'StringTrim'], | |
| 44 | + [ 'name' => 'StripTags' ], | |
| 45 | + [ 'name' => 'StringTrim' ], | |
| 46 | 46 | ], | 
| 47 | 47 | 'validators' => [ | 
| 48 | 48 | [ | 
| @@ -66,8 +66,8 @@ discard block | ||
| 66 | 66 | 'name' => 'password', | 
| 67 | 67 | 'required' => true, | 
| 68 | 68 | 'filters' => [ | 
| 69 | - ['name' => 'StripTags'], | |
| 70 | - ['name' => 'StringTrim'], | |
| 69 | + [ 'name' => 'StripTags' ], | |
| 70 | + [ 'name' => 'StringTrim' ], | |
| 71 | 71 | ], | 
| 72 | 72 | 'validators' => [ | 
| 73 | 73 | [ |