LaravelSeoMetaBox   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getObjectOnPage() 0 7 2
A addObjectOnPage() 0 5 1
1
<?php
2
3
namespace Giuga\LaravelSeoMetaBox;
4
5
class LaravelSeoMetaBox
6
{
7
    private array $objectsOnPage = [];
8
9
    public function addObjectOnPage(string $type, int $id): void
10
    {
11
        $this->objectsOnPage[] = [
12
            'type' => $type,
13
            'id' => $id,
14
        ];
15
    }
16
17
    /**
18
     * Retrieve the last object added to the page that can have Seo.
19
     */
20
    public function getObjectOnPage(): ?array
21
    {
22
        if (count($this->objectsOnPage)) {
23
            return end($this->objectsOnPage);
24
        }
25
26
        return null;
27
    }
28
}
29