Passed
Push — master ( 6b8ca8...3384db )
by Paul
04:57
created

Partial   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 24
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 9 2
A render() 0 3 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Modules\Html;
4
5
use GeminiLabs\SiteReviews\Helper;
6
7
class Partial
8
{
9
	/**
10
	 * @param string $partialPath
11
	 * @return string
12
	 */
13
	public function build( $partialPath, array $args = [] )
14
	{
15
		$className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' );
16
		if( !class_exists( $className )) {
17
			glsr_log()->error( 'Partial missing: '.$className );
18
			return;
19
		}
20
		$partial = glsr( $className )->build( $partialPath, $args );
1 ignored issue
show
Bug introduced by
The method build() does not exist on GeminiLabs\SiteReviews\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
		$partial = glsr( $className )->/** @scrutinizer ignore-call */ build( $partialPath, $args );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
		return apply_filters( 'site-reviews/rendered/partial', $partial, $partialPath, $args );
22
	}
23
24
	/**
25
	 * @param string $partialPath
26
	 * @return void
27
	 */
28
	public function render( $partialPath, array $args = [] )
29
	{
30
		echo $this->build( $partialPath, $args );
31
	}
32
}
33