Completed
Pull Request — master (#12)
by
unknown
01:57
created

AbstractHook::getConfigurationProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace Aoe\Asdis\Typo3\Hook;
3
4
use Aoe\Asdis\Domain\Model\Asset\Collection;
5
use Aoe\Asdis\Domain\Model\Page;
6
use Aoe\Asdis\System\Configuration\Provider;
7
use Aoe\Asdis\System\Log\Logger;
8
use TYPO3\CMS\Core\Utility\GeneralUtility;
9
use TYPO3\CMS\Extbase\Object\ObjectManager;
10
11
/**
12
 * Abstract hook class.
13
 */
14
abstract class AbstractHook
15
{
16
    /**
17
     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
18
     */
19
    private $objectManager;
20
21
    /**
22
     * @var \Aoe\Asdis\System\Log\Logger
23
     */
24
    private $logger;
25
26
    /**
27
     * @var \Aoe\Asdis\Domain\Model\Page
28
     */
29
    private $page;
30
31
    /**
32
     * @var \Aoe\Asdis\System\Configuration\Provider
33
     */
34
    private $configurationProvider;
35
36
    /**
37
     * Constructor.
38
     */
39
    public function __construct()
40
    {
41
        $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
42
        $this->configurationProvider = $this->objectManager->get(Provider::class);
43
        $this->logger = $this->objectManager->get(Logger::class);
44
    }
45
46
    /**
47
     * @return \Aoe\Asdis\System\Configuration\Provider
48
     */
49
    protected function getConfigurationProvider()
50
    {
51
        return $this->configurationProvider;
52
    }
53
54
    /**
55
     * @return \Aoe\Asdis\System\Log\Logger
56
     */
57
    protected function getLogger()
58
    {
59
        return $this->logger;
60
    }
61
62
    /**
63
     * @return void
64
     */
65
    protected function scrapeAssets()
66
    {
67
        $this->page->scrapeAssets();
68
    }
69
70
    /**
71
     * @return void
72
     */
73
    protected function replaceAssets()
74
    {
75
        $this->page->replaceAssets();
76
    }
77
78
    /**
79
     * Scrapes and replaces the assets of the current page.
80
     *
81
     * @return void
82
     */
83
    protected function scrapeAndReplace()
84
    {
85
        $this->scrapeAssets();
86
        $this->replaceAssets();
87
    }
88
89
    /**
90
     * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
91
     */
92
    protected function setPageObject(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj)
93
    {
94
        /** @var Tx_Asdis_Domain_Model_Page $page */
95
        $page = $this->objectManager->get(Page::class);
96
        $page->setAssets($this->objectManager->get(Collection::class));
97
        $page->setPageObject($pObj);
98
        $this->page = $page;
0 ignored issues
show
Documentation Bug introduced by
It seems like $page of type object<Aoe\Asdis\Typo3\H...sdis_Domain_Model_Page> is incompatible with the declared type object<Aoe\Asdis\Domain\Model\Page> of property $page.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
99
    }
100
}