Completed
Push — DomainModel ( 00021a...22bcef )
by
unknown
04:25
created

ContextMenuActionController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace AOE\Crawler\ContextMenu;
4
5
/***************************************************************
6
 *  Copyright notice
7
 *
8
 *  (c) 2017 AOE GmbH <[email protected]>
9
 *
10
 *  All rights reserved
11
 *
12
 *  This script is part of the TYPO3 project. The TYPO3 project is
13
 *  free software; you can redistribute it and/or modify
14
 *  it under the terms of the GNU General Public License as published by
15
 *  the Free Software Foundation; either version 3 of the License, or
16
 *  (at your option) any later version.
17
 *
18
 *  The GNU General Public License can be found at
19
 *  http://www.gnu.org/copyleft/gpl.html.
20
 *
21
 *  This script is distributed in the hope that it will be useful,
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 *  GNU General Public License for more details.
25
 *
26
 *  This copyright notice MUST APPEAR in all copies of the script!
27
 ***************************************************************/
28
29
use AOE\Crawler\Domain\Model\CrawlerQueueItem;
30
use AOE\Crawler\Domain\Repository\CrawlerQueueItemRepository;
31
use Psr\Http\Message\ResponseInterface;
32
use Psr\Http\Message\ServerRequestInterface;
33
use TYPO3\CMS\Core\Utility\GeneralUtility;
34
use TYPO3\CMS\Extbase\Object\ObjectManager;
35
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
36
37
/**
38
 * Class ContextMenuActionController
39
 *
40
 * @package Crawler
41
 */
42
class ContextMenuActionController
43
{
44
45
    /**
46
     * @var CrawlerQueueItemRepository
47
     */
48
    protected $crawlerQueueItemRepository;
49
50
    /**
51
     * @var PersistenceManager
52
     */
53
    protected $persistenceManager;
54
55
    /**
56
     * ContextMenuActionController constructor
57
     */
58
    public function __construct()
59
    {
60
        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
61
        $this->crawlerQueueItemRepository = $objectManager->get(CrawlerQueueItemRepository::class);
62
        $this->persistenceManager = $objectManager->get(PersistenceManager::class);
63
    }
64
65
    /**
66
     * @param ServerRequestInterface $request
67
     * @param ResponseInterface $response
68
     *
69
     * @return ResponseInterface
70
     */
71
    public function addPageToQueue(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
    {
73
        $crawlerQueueItem = new CrawlerQueueItem(123);
74
        $this->crawlerQueueItemRepository->add($crawlerQueueItem);
75
76
        $this->persistenceManager->persistAll();
77
78
        return $response;
79
    }
80
}
81