Skip to content

Commit

Permalink
Merge pull request #421 from AntonShevchuk/master
Browse files Browse the repository at this point in the history
Fixed code and comments style
  • Loading branch information
Anton authored Jun 30, 2017
2 parents 4042360 + 347a99b commit 6f56205
Show file tree
Hide file tree
Showing 361 changed files with 2,719 additions and 1,320 deletions.
24 changes: 16 additions & 8 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
checks:
php: true
php:
psr2_switch_declaration: true
psr2_class_declaration: true
no_short_open_tag: true
deprecated_code_usage: true
code_rating: true
filter:
excluded_paths:
- vendor/
- tests/
tools:
external_code_coverage:
timeout: 600
php_code_sniffer: true
php_mess_detector: true
php_analyzer: true
php_code_sniffer:
config:
standard: PSR2
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
php_loc:
enabled: true
excluded_dirs: [vendor, tests]
enabled: true
excluded_dirs: [vendor, tests]
php_mess_detector: true
php_pdepend: true
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
sensiolabs_security_checker: true
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
global:
- secure: "QKyI/QO6H6pFE04Iz/4IcSuttMdY3o85mD2BTNV2Y2SeSPxLfuukqPrxjANrTc4GfI1v7/bZM43uMl3aRa76+HRZ83ZsXR8uv1VZUgNHYuoq7jdZb18BitM36h0LbHzTbYetJLiYg7l3mnbAezTXPXHfpNIWvZcuyZzatyF/lng="
before_install:
# Prefer IPv4 over IPv6
- sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
install:
# Composer
Expand All @@ -24,11 +25,11 @@ before_script:
- wget https://scrutinizer-ci.com/ocular.phar
script:
# Check code style
- php vendor/bin/phpcs --report=xml --report-file=.reports/phpcs.xml
#- php vendor/bin/phpcs --report=xml --report-file=.reports/phpcs.xml
# Lines of code
- php vendor/bin/phploc --log-xml=.reports/phploc.xml src
#- php vendor/bin/phploc --log-xml=.reports/phploc.xml src
# Mess detection
- php vendor/bin/phpmd ./src xml codesize,unusedcode,naming --reportfile .reports/phpmd.xml || true
#- php vendor/bin/phpmd ./src xml codesize,unusedcode,naming --reportfile .reports/phpmd.xml || true
# Run CodeCeption tests
- php vendor/bin/codecept run --coverage --coverage-xml
after_success:
Expand Down
4 changes: 2 additions & 2 deletions src/Acl/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down Expand Up @@ -32,7 +32,7 @@ class Acl
*
* @return bool
*/
public function isAllowed($module, $privilege) : bool
public function isAllowed($module, $privilege): bool
{
if ($privilege) {
$user = Auth::getIdentity();
Expand Down
2 changes: 1 addition & 1 deletion src/Acl/AclException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
16 changes: 11 additions & 5 deletions src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down Expand Up @@ -107,21 +107,23 @@ public function isDebug()
* Return/setup Layout Flag
*
* @param bool|null $flag
*
* @return bool
*/
public function useLayout($flag = null)
{
if (is_bool($flag)) {
$this->layoutFlag = $flag;
}

return $this->layoutFlag;
}

/**
* Initialize system packages
*
* @param string $environment
*
* @throws ApplicationException
* @return void
*/
Expand Down Expand Up @@ -172,14 +174,14 @@ protected function initConfig()

// setup configuration for current environment
if ($debug = Config::getData('debug')) {
$this->debugFlag = (bool) $debug;
$this->debugFlag = (bool)$debug;
}

// initial php settings
if ($ini = Config::getData('php')) {
foreach ($ini as $key => $value) {
$result = ini_set($key, $value);
Logger::info('app:init:php:'.$key.':'.($result?:'---'));
Logger::info('app:init:php:' . $key . ':' . ($result ?: '---'));
}
}
}
Expand Down Expand Up @@ -353,6 +355,7 @@ protected function postProcess()
* @param string $module
* @param string $controller
* @param array $params
*
* @return Controller
* @throws ApplicationException
*/
Expand All @@ -371,6 +374,7 @@ public function dispatch($module, $controller, $params = [])
* @param string $module
* @param string $controller
* @param array $params
*
* @return void
*/
protected function preDispatch($module, $controller, $params = [])
Expand All @@ -383,7 +387,8 @@ protected function preDispatch($module, $controller, $params = [])
*
* @param string $module
* @param string $controller
* @param array $params
* @param array $params
*
* @return Controller
* @throws \Bluz\Application\Exception\ForbiddenException
* @throws \Bluz\Application\Exception\NotAllowedException
Expand Down Expand Up @@ -415,6 +420,7 @@ protected function doDispatch($module, $controller, $params = [])
* @param string $module
* @param string $controller
* @param array $params
*
* @return void
*/
protected function postDispatch($module, $controller, $params = [])
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/ApplicationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/BadRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/ForbiddenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/NotAcceptableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/NotAllowedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/NotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/NotImplementedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/RedirectException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Exception/UnauthorizedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
4 changes: 3 additions & 1 deletion src/Application/Helper/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand All @@ -17,7 +17,9 @@

/**
* Reload helper can be declared inside Bootstrap
*
* @param \Exception $exception
*
* @return Controller
*/
return
Expand Down
4 changes: 3 additions & 1 deletion src/Application/Helper/Forbidden.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand All @@ -16,7 +16,9 @@

/**
* Forbidden helper can be declared inside Bootstrap
*
* @param ForbiddenException $exception
*
* @return Controller
*/
return
Expand Down
6 changes: 4 additions & 2 deletions src/Application/Helper/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand All @@ -17,7 +17,9 @@

/**
* Redirect helper can be declared inside Bootstrap
*
* @param string $url
*
* @return null
*/
return
Expand All @@ -26,7 +28,7 @@ function ($url) {
* @var Application $this
*/
$this->useLayout(false);

Response::removeHeaders();
Response::clearBody();

Expand Down
2 changes: 1 addition & 1 deletion src/Auth/AbstractRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down
7 changes: 4 additions & 3 deletions src/Auth/AbstractRowEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down Expand Up @@ -32,16 +32,17 @@ abstract public function tryLogin();
*
* @return array
*/
abstract public function getPrivileges() : array;
abstract public function getPrivileges(): array;

/**
* Has role a privilege
*
* @param string $module
* @param string $privilege
*
* @return bool
*/
public function hasPrivilege($module, $privilege) : bool
public function hasPrivilege($module, $privilege): bool
{
$privileges = $this->getPrivileges();

Expand Down
4 changes: 3 additions & 1 deletion src/Auth/AbstractTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down Expand Up @@ -61,6 +61,7 @@ abstract class AbstractTable extends Table
*
* @param string $provider
* @param string $foreignKey
*
* @return AbstractRow
*/
public function getAuthRow($provider, $foreignKey)
Expand All @@ -72,6 +73,7 @@ public function getAuthRow($provider, $foreignKey)
* Generate Secret token
*
* @param integer $id
*
* @return string
*/
protected function generateSecret($id)
Expand Down
3 changes: 2 additions & 1 deletion src/Auth/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
* @link https://github.com/bluzphp/framework
*/

declare(strict_types=1);
Expand Down Expand Up @@ -34,6 +34,7 @@ class Auth
* Setup identity
*
* @param EntityInterface $identity
*
* @return void
*/
public function setIdentity(EntityInterface $identity)
Expand Down
Loading

0 comments on commit 6f56205

Please sign in to comment.