Completed
Push — master ( 2baed6...2076df )
by WEBEWEB
01:22
created

Document::hasPages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2020 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\ThirdParty\OcrLad\Model;
13
14
use WBW\Library\Core\Model\Attribute\StringFilenameTrait;
15
use WBW\Library\Core\ThirdParty\OcrLad\Model\Attribute\ArrayWordsTrait;
16
17
/**
18
 * Document.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Library\Core\ThirdParty\OcrLad\Model
22
 */
23
class Document {
24
25
    use ArrayWordsTrait;
26
    use StringFilenameTrait;
27
28
    /**
29
     * Pages.
30
     *
31
     * @var Page[]
32
     */
33
    private $pages;
34
35
    /**
36
     * Constructor.
37
     */
38
    public function __construct() {
39
        $this->setPages([]);
40
        $this->setWords([]);
41
    }
42
43
    /**
44
     * Add a page.
45
     *
46
     * @param Page $page The page.
47
     * @return Document Returns this document.
48
     */
49
    public function addPage(Page $page) {
50
        $this->pages[] = $page;
51
        return $this;
52
    }
53
54
    /**
55
     * Get the number of pages.
56
     *
57
     * @return int Returns the number of pages.
58
     */
59
    public function getNumberPages() {
60
        return count($this->pages);
61
    }
62
63
    /**
64
     * Get the pages.
65
     *
66
     * @return Page[] Returns the pages.
67
     */
68
    public function getPages() {
69
        return $this->pages;
70
    }
71
72
    /**
73
     * Determines if this instance has pages.
74
     *
75
     * @return bool Returns true in case of success, false otherwise.
76
     */
77
    public function hasPages() {
78
        return 1 <= $this->getNumberPages();
79
    }
80
81
    /**
82
     * Set the pages.
83
     *
84
     * @param Page[] $pages The pages.
85
     * @return Document Returns this document.
86
     */
87
    protected function setPages(array $pages) {
88
        $this->pages = $pages;
89
        return $this;
90
    }
91
}