Commit 987be151 authored by Mark Harding's avatar Mark Harding
Browse files

(chore): perform lint of entire codebase

parent 26c983ca
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,12 @@ test:
  script:
  script:
    - bin/phpspec run
    - bin/phpspec run


lint:
  stage: test
  image: minds/php-tests:latest
  script:
    - bin/php-cs-fixer fix --allow-risky=yes --verbose --dry-run

prepare:fpm:
prepare:fpm:
  stage: prepare
  stage: prepare
  image: minds/ci:latest
  image: minds/ci:latest
+7 −2
Original line number Original line Diff line number Diff line
@@ -5,5 +5,10 @@ $finder = PhpCsFixer\Finder::create()
    ->in(__DIR__);
    ->in(__DIR__);


return PhpCsFixer\Config::create()
return PhpCsFixer\Config::create()
      ->fixers(['psr2', 'strict_param', 'short_array_syntax', 'no_blank_lines_after_class_opening'])
    ->setRules([
      ->finder($finder);
        '@PSR2' => true,
        'strict_param' => true,
        'array_syntax' => ['syntax' => 'short'],
        'no_blank_lines_after_class_opening' => true,
    ])
    ->setFinder($finder);
+7 −7
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ class Factory
                    if (!$handler instanceof Interfaces\ApiIgnorePam) {
                    if (!$handler instanceof Interfaces\ApiIgnorePam) {
                        self::pamCheck($request, $response);
                        self::pamCheck($request, $response);
                    }
                    }
                    $pages = array_splice($segments, $loop) ?: array();
                    $pages = array_splice($segments, $loop) ?: [];
                    return $handler->$method($pages);
                    return $handler->$method($pages);
                }
                }
            }
            }
@@ -65,7 +65,7 @@ class Factory
                if (!$handler instanceof Interfaces\ApiIgnorePam) {
                if (!$handler instanceof Interfaces\ApiIgnorePam) {
                    self::pamCheck($request, $response);
                    self::pamCheck($request, $response);
                }
                }
                $pages = array_splice($segments, $loop) ?: array();
                $pages = array_splice($segments, $loop) ?: [];
                return $handler->$method($pages);
                return $handler->$method($pages);
            }
            }
            --$loop;
            --$loop;
@@ -111,7 +111,7 @@ class Factory
            header('Content-type: application/json');
            header('Content-type: application/json');
            header("Access-Control-Allow-Origin: *");
            header("Access-Control-Allow-Origin: *");
            header('HTTP/1.1 401 Unauthorized', true, 401);
            header('HTTP/1.1 401 Unauthorized', true, 401);
            echo json_encode(array('error'=>'You are not an admin', 'code'=>401));
            echo json_encode(['error'=>'You are not an admin', 'code'=>401]);
            exit;
            exit;
        }
        }
    }
    }
@@ -143,11 +143,11 @@ class Factory
     * Builds an API response
     * Builds an API response
     * @param array $data
     * @param array $data
     */
     */
    public static function response($data = array())
    public static function response($data = [])
    {
    {
        $data = array_merge(array(
        $data = array_merge([
            'status' => 'success', //should success be assumed?
            'status' => 'success', //should success be assumed?
        ), $data);
        ], $data);


        ob_end_clean();
        ob_end_clean();


@@ -162,7 +162,7 @@ class Factory
     * @return array - an array of the entities
     * @return array - an array of the entities
     * @deprecated
     * @deprecated
     */
     */
    public static function exportable($entities, $exceptions = array(), $exportContext = false)
    public static function exportable($entities, $exceptions = [], $exportContext = false)
    {
    {
        if (!$entities) {
        if (!$entities) {
            return [];
            return [];
+1 −1
Original line number Original line Diff line number Diff line
@@ -6,7 +6,7 @@ namespace Minds\Api;
 */
 */
class Routes
class Routes
{
{
    public static $routes = array();
    public static $routes = [];


    /**
    /**
     * Adds a custom API route resolution
     * Adds a custom API route resolution
+1 −1
Original line number Original line Diff line number Diff line
@@ -6,7 +6,7 @@ namespace Minds\Cli;
 */
 */
class Routes
class Routes
{
{
    public static $routes = array();
    public static $routes = [];


    /**
    /**
     * Adds a custom CLI route resolution
     * Adds a custom CLI route resolution
Loading