1 | <?php |
||
2 | |||
3 | declare( strict_types = 1 ); |
||
4 | |||
5 | namespace ModernTimeline\SlidePresenter; |
||
6 | |||
7 | use ModernTimeline\ResultFacade\Subject; |
||
8 | use SMW\DataValueFactory; |
||
0 ignored issues
–
show
|
|||
9 | use SMW\Query\PrintRequest; |
||
0 ignored issues
–
show
The type
SMW\Query\PrintRequest was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
10 | use Traversable; |
||
11 | |||
12 | class SimpleSlidePresenter implements SlidePresenter { |
||
13 | |||
14 | public function __construct( |
||
15 | 3 | private array $parameters |
|
16 | 3 | ) { |
|
17 | 3 | } |
|
18 | |||
19 | 2 | public function getText( Subject $subject ): string { |
|
20 | 2 | return implode( '<br>', iterator_to_array( $this->getDisplayValues( $subject ) ) ); |
|
21 | } |
||
22 | |||
23 | 2 | private function getDisplayValues( Subject $subject ): Traversable { |
|
24 | 2 | foreach ( $subject->getPropertyValueCollections() as $propertyValues ) { |
|
25 | 2 | foreach ( $propertyValues->getDataItems() as $dataItem ) { |
|
26 | 2 | if ( !$this->isHiddenPrintRequest( $propertyValues->getPrintRequest() ) ) { |
|
27 | 2 | yield $this->getDisplayValue( $propertyValues->getPrintRequest(), $dataItem ); |
|
28 | } |
||
29 | } |
||
30 | } |
||
31 | 2 | } |
|
32 | |||
33 | 2 | private function isHiddenPrintRequest( PrintRequest $pr ): bool { |
|
34 | 2 | return $pr->getText( null ) === $this->parameters['image property']; |
|
35 | } |
||
36 | |||
37 | 2 | private function getDisplayValue( PrintRequest $pr, \SMWDataItem $dataItem ): string { |
|
0 ignored issues
–
show
The type
SMWDataItem was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
38 | 2 | $property = $pr->getText( null ); |
|
39 | 2 | $value = $this->dataItemToText( $dataItem ); |
|
40 | |||
41 | 2 | if ( $property === '' ) { |
|
42 | return $value; |
||
43 | } |
||
44 | |||
45 | 2 | return $property . ': ' . $value; |
|
46 | } |
||
47 | |||
48 | 2 | private function dataItemToText( \SMWDataItem $dataItem ): string { |
|
49 | 2 | return DataValueFactory::getInstance()->newDataValueByItem( $dataItem )->getLongHTMLText(); |
|
50 | } |
||
51 | |||
52 | } |
||
53 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths