Passed
Push — master ( 80339c...7b002e )
by Luiz Kim
09:49 queued 02:01
created

OrderProductQueueService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 8
rs 10
1
<?php
2
3
namespace ControleOnline\Service;
4
5
use ControleOnline\Entity\Invoice;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Invoice 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use ControleOnline\Entity\OrderProduct;
7
use ControleOnline\Entity\OrderProductQueue;
8
use Doctrine\ORM\EntityManagerInterface;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\EntityManagerInterface 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Symfony\Component\Security\Core\Security;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Security\Core\Security 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Doctrine\ORM\QueryBuilder;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\QueryBuilder 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Symfony\Component\HttpFoundation\RequestStack;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\RequestStack 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
class OrderProductQueueService
14
{
15
    private $request;
16
    public function __construct(
17
        private EntityManagerInterface $manager,
18
        private Security $security,
19
        private PeopleService $PeopleService,
0 ignored issues
show
Bug introduced by
The type ControleOnline\Service\PeopleService 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
        RequestStack $requestStack
21
22
    ) {
23
        $this->request  = $requestStack->getCurrentRequest();
24
    }
25
26
    public function addProductToQueue(OrderProduct $orderProduct)
27
    {
28
        $product = $orderProduct->getProduct();
29
        $queue = $product->getQueue();
30
        if ($queue) {
31
32
            $orderProductQueue = $this->manager->getRepository(OrderProductQueue::class)->findOneBy([
33
                'order_product' => $orderProduct
34
            ]);
35
            if (!$orderProductQueue) {
36
                $orderProductQueue = new OrderProductQueue();
37
                $orderProductQueue->setPriority('priority');
38
                $orderProductQueue->setOrderProduct($orderProduct);
39
                $orderProductQueue->setStatus($queue->getStatusIn());
40
                $orderProductQueue->setQueue($queue);
41
                $this->manager->persist($orderProductQueue);
42
                $this->manager->flush();
43
            }
44
        }
45
    }
46
}
47