Test Setup Failed
Push — master ( 28a725...051deb )
by Alain
01:49
created
src/Views.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -28,97 +28,97 @@
 block discarded – undo
28 28
 class Views
29 29
 {
30 30
 
31
-    /**
32
-     * ViewBuilder Instance.
33
-     *
34
-     * @since 0.1.0
35
-     *
36
-     * @var ViewBuilder
37
-     */
38
-    protected static $viewBuilder;
31
+	/**
32
+	 * ViewBuilder Instance.
33
+	 *
34
+	 * @since 0.1.0
35
+	 *
36
+	 * @var ViewBuilder
37
+	 */
38
+	protected static $viewBuilder;
39 39
 
40
-    /**
41
-     * Add a location to the ViewBuilder.
42
-     *
43
-     * @since 0.1.0
44
-     *
45
-     * @param Location $location Location to add.
46
-     *
47
-     * @throws FailedToProcessConfigException If the Config could not be processed.
48
-     */
49
-    public static function addLocation(Location $location)
50
-    {
51
-        $viewBuilder = static::getViewBuilder();
52
-        $viewBuilder->addLocation($location);
53
-    }
40
+	/**
41
+	 * Add a location to the ViewBuilder.
42
+	 *
43
+	 * @since 0.1.0
44
+	 *
45
+	 * @param Location $location Location to add.
46
+	 *
47
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
48
+	 */
49
+	public static function addLocation(Location $location)
50
+	{
51
+		$viewBuilder = static::getViewBuilder();
52
+		$viewBuilder->addLocation($location);
53
+	}
54 54
 
55
-    /**
56
-     * Get the ViewBuilder instance.
57
-     *
58
-     * @since 0.1.0
59
-     *
60
-     * @return ViewBuilder
61
-     * @throws FailedToProcessConfigException If the Config could not be processed.
62
-     */
63
-    public static function getViewBuilder()
64
-    {
65
-        if (null === static::$viewBuilder) {
66
-            static::$viewBuilder = static::instantiateViewBuilder();
67
-        }
55
+	/**
56
+	 * Get the ViewBuilder instance.
57
+	 *
58
+	 * @since 0.1.0
59
+	 *
60
+	 * @return ViewBuilder
61
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
62
+	 */
63
+	public static function getViewBuilder()
64
+	{
65
+		if (null === static::$viewBuilder) {
66
+			static::$viewBuilder = static::instantiateViewBuilder();
67
+		}
68 68
 
69
-        return static::$viewBuilder;
70
-    }
69
+		return static::$viewBuilder;
70
+	}
71 71
 
72
-    /**
73
-     * Instantiate the ViewBuilder.
74
-     *
75
-     * @since 0.1.0
76
-     *
77
-     * @param ConfigInterface|null $config Optional. Configuration to pass into the ViewBuilder.
78
-     *
79
-     * @return ViewBuilder Instance of the ViewBuilder.
80
-     * @throws FailedToProcessConfigException If the Config could not be processed.
81
-     */
82
-    public static function instantiateViewBuilder(ConfigInterface $config = null)
83
-    {
84
-        return static::$viewBuilder = new ViewBuilder($config);
85
-    }
72
+	/**
73
+	 * Instantiate the ViewBuilder.
74
+	 *
75
+	 * @since 0.1.0
76
+	 *
77
+	 * @param ConfigInterface|null $config Optional. Configuration to pass into the ViewBuilder.
78
+	 *
79
+	 * @return ViewBuilder Instance of the ViewBuilder.
80
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
81
+	 */
82
+	public static function instantiateViewBuilder(ConfigInterface $config = null)
83
+	{
84
+		return static::$viewBuilder = new ViewBuilder($config);
85
+	}
86 86
 
87
-    /**
88
-     * Create a new view for a given URI.
89
-     *
90
-     * @since 0.1.0
91
-     *
92
-     * @param string      $view View identifier to create a view for.
93
-     * @param string|null $type Type of view to create.
94
-     *
95
-     * @return View Instance of the requested view.
96
-     * @throws FailedToProcessConfigException If the Config could not be processed.
97
-     */
98
-    public static function create($view, $type = null)
99
-    {
100
-        $viewBuilder = static::getViewBuilder();
87
+	/**
88
+	 * Create a new view for a given URI.
89
+	 *
90
+	 * @since 0.1.0
91
+	 *
92
+	 * @param string      $view View identifier to create a view for.
93
+	 * @param string|null $type Type of view to create.
94
+	 *
95
+	 * @return View Instance of the requested view.
96
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
97
+	 */
98
+	public static function create($view, $type = null)
99
+	{
100
+		$viewBuilder = static::getViewBuilder();
101 101
 
102
-        return $viewBuilder->create($view, $type);
103
-    }
102
+		return $viewBuilder->create($view, $type);
103
+	}
104 104
 
105
-    /**
106
-     * Render a view for a given URI.
107
-     *
108
-     * @since 0.1.0
109
-     *
110
-     * @param string      $view    View identifier to create a view for.
111
-     * @param array       $context Optional. The context in which to render the view.
112
-     * @param string|null $type    Type of view to create.
113
-     *
114
-     * @return string Rendered HTML content.
115
-     * @throws FailedToProcessConfigException If the Config could not be processed.
116
-     */
117
-    public static function render($view, array $context = [], $type = null)
118
-    {
119
-        $viewBuilder = static::getViewBuilder();
120
-        $viewObject  = $viewBuilder->create($view, $type);
105
+	/**
106
+	 * Render a view for a given URI.
107
+	 *
108
+	 * @since 0.1.0
109
+	 *
110
+	 * @param string      $view    View identifier to create a view for.
111
+	 * @param array       $context Optional. The context in which to render the view.
112
+	 * @param string|null $type    Type of view to create.
113
+	 *
114
+	 * @return string Rendered HTML content.
115
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
116
+	 */
117
+	public static function render($view, array $context = [], $type = null)
118
+	{
119
+		$viewBuilder = static::getViewBuilder();
120
+		$viewObject  = $viewBuilder->create($view, $type);
121 121
 
122
-        return $viewObject->render($context);
123
-    }
122
+		return $viewObject->render($context);
123
+	}
124 124
 }
Please login to merge, or discard this patch.
src/View/Location/URIs.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,19 +25,19 @@
 block discarded – undo
25 25
 class URIs extends ArrayCollection
26 26
 {
27 27
 
28
-    /**
29
-     * Create a new URIs from a Symfony Finder instance.
30
-     *
31
-     * @since 0.1.3
32
-     *
33
-     * @param Finder $finder The Finder instance to create the URI collection from.
34
-     *
35
-     * @return URIs New URIs instance.
36
-     */
37
-    public static function fromFinder(Finder $finder): URIs
38
-    {
39
-        $elements = array_keys(iterator_to_array($finder));
28
+	/**
29
+	 * Create a new URIs from a Symfony Finder instance.
30
+	 *
31
+	 * @since 0.1.3
32
+	 *
33
+	 * @param Finder $finder The Finder instance to create the URI collection from.
34
+	 *
35
+	 * @return URIs New URIs instance.
36
+	 */
37
+	public static function fromFinder(Finder $finder): URIs
38
+	{
39
+		$elements = array_keys(iterator_to_array($finder));
40 40
 
41
-        return new static($elements);
42
-    }
41
+		return new static($elements);
42
+	}
43 43
 }
Please login to merge, or discard this patch.
src/View/Location/Location.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@
 block discarded – undo
22 22
 interface Location
23 23
 {
24 24
 
25
-    /**
26
-     * Get the first URI that matches the given criteria.
27
-     *
28
-     * @since 0.1.0
29
-     *
30
-     * @param array $criteria Criteria to match.
31
-     *
32
-     * @return string|false URI that matches the criteria or false if none found.
33
-     */
34
-    public function getURI(array $criteria);
25
+	/**
26
+	 * Get the first URI that matches the given criteria.
27
+	 *
28
+	 * @since 0.1.0
29
+	 *
30
+	 * @param array $criteria Criteria to match.
31
+	 *
32
+	 * @return string|false URI that matches the criteria or false if none found.
33
+	 */
34
+	public function getURI(array $criteria);
35 35
 
36
-    /**
37
-     * Get all URIs that match the given criteria.
38
-     *
39
-     * @since 0.1.1
40
-     *
41
-     * @param array $criteria Criteria to match.
42
-     *
43
-     * @return URIs Collection of URIs that matches the criteria or an empty collection if none found.
44
-     */
45
-    public function getURIs(array $criteria): URIs;
36
+	/**
37
+	 * Get all URIs that match the given criteria.
38
+	 *
39
+	 * @since 0.1.1
40
+	 *
41
+	 * @param array $criteria Criteria to match.
42
+	 *
43
+	 * @return URIs Collection of URIs that matches the criteria or an empty collection if none found.
44
+	 */
45
+	public function getURIs(array $criteria): URIs;
46 46
 }
Please login to merge, or discard this patch.
src/View/Support/Findable.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@
 block discarded – undo
22 22
 interface Findable
23 23
 {
24 24
 
25
-    /**
26
-     * Check whether the Findable can handle an individual criterion.
27
-     *
28
-     * @since 0.1.0
29
-     *
30
-     * @param mixed $criterion Criterion to check.
31
-     *
32
-     * @return bool Whether the Findable can handle the criterion.
33
-     */
34
-    public function canHandle($criterion): bool;
25
+	/**
26
+	 * Check whether the Findable can handle an individual criterion.
27
+	 *
28
+	 * @since 0.1.0
29
+	 *
30
+	 * @param mixed $criterion Criterion to check.
31
+	 *
32
+	 * @return bool Whether the Findable can handle the criterion.
33
+	 */
34
+	public function canHandle($criterion): bool;
35 35
 }
Please login to merge, or discard this patch.
src/View/Support/Extensions.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@
 block discarded – undo
24 24
 class Extensions extends ArrayCollection
25 25
 {
26 26
 
27
-    /**
28
-     * Check whether a given URI has a specific extension.
29
-     *
30
-     * @since 0.1.0
31
-     *
32
-     * @param string $uri       URI to check the extension of.
33
-     * @param string $extension Extension to check for.
34
-     *
35
-     * @return bool
36
-     */
37
-    public static function hasExtension(string $uri, string $extension): bool
38
-    {
39
-        $uriLength       = mb_strlen($uri);
40
-        $extensionLength = mb_strlen($extension);
41
-        if ($extensionLength > $uriLength) {
42
-            return false;
43
-        }
27
+	/**
28
+	 * Check whether a given URI has a specific extension.
29
+	 *
30
+	 * @since 0.1.0
31
+	 *
32
+	 * @param string $uri       URI to check the extension of.
33
+	 * @param string $extension Extension to check for.
34
+	 *
35
+	 * @return bool
36
+	 */
37
+	public static function hasExtension(string $uri, string $extension): bool
38
+	{
39
+		$uriLength       = mb_strlen($uri);
40
+		$extensionLength = mb_strlen($extension);
41
+		if ($extensionLength > $uriLength) {
42
+			return false;
43
+		}
44 44
 
45
-        return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
46
-    }
45
+		return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
src/View/View/BaseView.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
 class BaseView extends AbstractView
23 23
 {
24 24
 
25
-    /**
26
-     * Check whether the Findable can handle an individual criterion.
27
-     *
28
-     * @since 0.1.0
29
-     *
30
-     * @param mixed $criterion Criterion to check.
31
-     *
32
-     * @return bool Whether the Findable can handle the criterion.
33
-     */
34
-    public function canHandle($criterion): bool
35
-    {
36
-        return true;
37
-    }
25
+	/**
26
+	 * Check whether the Findable can handle an individual criterion.
27
+	 *
28
+	 * @since 0.1.0
29
+	 *
30
+	 * @param mixed $criterion Criterion to check.
31
+	 *
32
+	 * @return bool Whether the Findable can handle the criterion.
33
+	 */
34
+	public function canHandle($criterion): bool
35
+	{
36
+		return true;
37
+	}
38 38
 }
Please login to merge, or discard this patch.
src/View/Engine/PHPEngine.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -26,75 +26,75 @@
 block discarded – undo
26 26
 class PHPEngine extends AbstractEngine
27 27
 {
28 28
 
29
-    const PHP_EXTENSION = '.php';
29
+	const PHP_EXTENSION = '.php';
30 30
 
31
-    /**
32
-     * Check whether the Findable can handle an individual criterion.
33
-     *
34
-     * @since 0.1.0
35
-     *
36
-     * @param mixed $criterion Criterion to check.
37
-     *
38
-     * @return bool Whether the Findable can handle the criterion.
39
-     */
40
-    public function canHandle($criterion): bool
41
-    {
42
-        return URIHelper::hasExtension($criterion, static::PHP_EXTENSION)
43
-            && is_readable($criterion);
44
-    }
31
+	/**
32
+	 * Check whether the Findable can handle an individual criterion.
33
+	 *
34
+	 * @since 0.1.0
35
+	 *
36
+	 * @param mixed $criterion Criterion to check.
37
+	 *
38
+	 * @return bool Whether the Findable can handle the criterion.
39
+	 */
40
+	public function canHandle($criterion): bool
41
+	{
42
+		return URIHelper::hasExtension($criterion, static::PHP_EXTENSION)
43
+			&& is_readable($criterion);
44
+	}
45 45
 
46
-    /**
47
-     * Get the rendering callback for a given URI.
48
-     *
49
-     * @since 0.1.0
50
-     *
51
-     * @param string $uri     URI to render.
52
-     * @param array  $context Context in which to render.
53
-     *
54
-     * @return callable Rendering callback.
55
-     * @throws FailedToLoadView If the View URI is not accessible or readable.
56
-     * @throws FailedToLoadView If the View URI could not be loaded.
57
-     */
58
-    public function getRenderCallback(string $uri, array $context = []): callable
59
-    {
60
-        if (! is_readable($uri)) {
61
-            throw new FailedToLoadView(
62
-                sprintf(
63
-                    _('The View URI "%1$s" is not accessible or readable.'),
64
-                    $uri
65
-                )
66
-            );
67
-        }
46
+	/**
47
+	 * Get the rendering callback for a given URI.
48
+	 *
49
+	 * @since 0.1.0
50
+	 *
51
+	 * @param string $uri     URI to render.
52
+	 * @param array  $context Context in which to render.
53
+	 *
54
+	 * @return callable Rendering callback.
55
+	 * @throws FailedToLoadView If the View URI is not accessible or readable.
56
+	 * @throws FailedToLoadView If the View URI could not be loaded.
57
+	 */
58
+	public function getRenderCallback(string $uri, array $context = []): callable
59
+	{
60
+		if (! is_readable($uri)) {
61
+			throw new FailedToLoadView(
62
+				sprintf(
63
+					_('The View URI "%1$s" is not accessible or readable.'),
64
+					$uri
65
+				)
66
+			);
67
+		}
68 68
 
69
-        $closure = function () use ($uri, $context) {
69
+		$closure = function () use ($uri, $context) {
70 70
 
71
-            // Save current buffering level so we can backtrack in case of an error.
72
-            // This is needed because the view itself might also add an unknown number of output buffering levels.
73
-            $bufferLevel = ob_get_level();
74
-            ob_start();
71
+			// Save current buffering level so we can backtrack in case of an error.
72
+			// This is needed because the view itself might also add an unknown number of output buffering levels.
73
+			$bufferLevel = ob_get_level();
74
+			ob_start();
75 75
 
76
-            try {
77
-                include $uri;
78
-            } catch (Exception $exception) {
79
-                // Remove whatever levels were added up until now.
80
-                while (ob_get_level() > $bufferLevel) {
81
-                    ob_end_clean();
82
-                }
76
+			try {
77
+				include $uri;
78
+			} catch (Exception $exception) {
79
+				// Remove whatever levels were added up until now.
80
+				while (ob_get_level() > $bufferLevel) {
81
+					ob_end_clean();
82
+				}
83 83
 
84
-                throw new FailedToLoadView(
85
-                    sprintf(
86
-                        _('Could not load the View URI "%1$s". Reason: "%2$s".'),
87
-                        $uri,
88
-                        $exception->getMessage()
89
-                    ),
90
-                    $exception->getCode(),
91
-                    $exception
92
-                );
93
-            }
84
+				throw new FailedToLoadView(
85
+					sprintf(
86
+						_('Could not load the View URI "%1$s". Reason: "%2$s".'),
87
+						$uri,
88
+						$exception->getMessage()
89
+					),
90
+					$exception->getCode(),
91
+					$exception
92
+				);
93
+			}
94 94
 
95
-            return ob_get_clean();
96
-        };
95
+			return ob_get_clean();
96
+		};
97 97
 
98
-        return $closure;
99
-    }
98
+		return $closure;
99
+	}
100 100
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function getRenderCallback(string $uri, array $context = []): callable
59 59
     {
60
-        if (! is_readable($uri)) {
60
+        if ( ! is_readable($uri)) {
61 61
             throw new FailedToLoadView(
62 62
                 sprintf(
63 63
                     _('The View URI "%1$s" is not accessible or readable.'),
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             );
67 67
         }
68 68
 
69
-        $closure = function () use ($uri, $context) {
69
+        $closure = function() use ($uri, $context) {
70 70
 
71 71
             // Save current buffering level so we can backtrack in case of an error.
72 72
             // This is needed because the view itself might also add an unknown number of output buffering levels.
Please login to merge, or discard this patch.
src/View/Engine/Engine.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
 interface Engine extends Findable
25 25
 {
26 26
 
27
-    /**
28
-     * Get the rendering callback for a given URI.
29
-     *
30
-     * @since 0.1.0
31
-     *
32
-     * @param string $uri     URI to render.
33
-     * @param array  $context Context in which to render.
34
-     *
35
-     * @return callable Render callback.
36
-     */
37
-    public function getRenderCallback(string $uri, array $context = []): callable;
27
+	/**
28
+	 * Get the rendering callback for a given URI.
29
+	 *
30
+	 * @since 0.1.0
31
+	 *
32
+	 * @param string $uri     URI to render.
33
+	 * @param array  $context Context in which to render.
34
+	 *
35
+	 * @return callable Render callback.
36
+	 */
37
+	public function getRenderCallback(string $uri, array $context = []): callable;
38 38
 }
Please login to merge, or discard this patch.
config/defaults.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,35 +15,35 @@
 block discarded – undo
15 15
  * Engine finder default configuration.
16 16
  */
17 17
 $engineFinder = [
18
-    // Class to use for instantiating the EngineFinder implementation.
19
-    Engine\EngineFinder::CLASS_NAME_KEY => Engine\BaseEngineFinder::class,
20
-    // Engine implementations to register with the EngineFinder.
21
-    Engine\EngineFinder::ENGINES_KEY    => [
22
-        'PHPEngine' => Engine\PHPEngine::class,
23
-    ],
24
-    // Null object implementation to use with the EngineFinder.
25
-    Engine\EngineFinder::NULL_OBJECT    => Engine\NullEngine::class,
18
+	// Class to use for instantiating the EngineFinder implementation.
19
+	Engine\EngineFinder::CLASS_NAME_KEY => Engine\BaseEngineFinder::class,
20
+	// Engine implementations to register with the EngineFinder.
21
+	Engine\EngineFinder::ENGINES_KEY    => [
22
+		'PHPEngine' => Engine\PHPEngine::class,
23
+	],
24
+	// Null object implementation to use with the EngineFinder.
25
+	Engine\EngineFinder::NULL_OBJECT    => Engine\NullEngine::class,
26 26
 ];
27 27
 
28 28
 /*
29 29
  * View finder default configuration.
30 30
  */
31 31
 $viewFinder = [
32
-    // Class to use for instantiating the ViewFinder implementation.
33
-    View\ViewFinder::CLASS_NAME_KEY => View\BaseViewFinder::class,
34
-    // View implementations to register with the ViewFinder.
35
-    View\ViewFinder::VIEWS_KEY      => [
36
-        'BaseView' => View\BaseView::class,
37
-    ],
38
-    // Null object implementation to use with the ViewFinder.
39
-    View\ViewFinder::NULL_OBJECT    => View\NullView::class,
32
+	// Class to use for instantiating the ViewFinder implementation.
33
+	View\ViewFinder::CLASS_NAME_KEY => View\BaseViewFinder::class,
34
+	// View implementations to register with the ViewFinder.
35
+	View\ViewFinder::VIEWS_KEY      => [
36
+		'BaseView' => View\BaseView::class,
37
+	],
38
+	// Null object implementation to use with the ViewFinder.
39
+	View\ViewFinder::NULL_OBJECT    => View\NullView::class,
40 40
 ];
41 41
 
42 42
 return [
43
-    'BrightNucleus' => [
44
-        'View' => [
45
-            'EngineFinder' => $engineFinder,
46
-            'ViewFinder'   => $viewFinder,
47
-        ],
48
-    ],
43
+	'BrightNucleus' => [
44
+		'View' => [
45
+			'EngineFinder' => $engineFinder,
46
+			'ViewFinder'   => $viewFinder,
47
+		],
48
+	],
49 49
 ];
Please login to merge, or discard this patch.