Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractObjects
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isEmpty
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isNotEmpty
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 size
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 clear
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @license MIT
5 * @author hazuki3417<hazuki3417@gmail.com>
6 * @copyright 2021 hazuki3417 all rights reserved.
7 */
8
9namespace Selen\Data\Structure;
10
11abstract class AbstractObjects implements ObjectsInterface
12{
13    /** @var array<mixed,mixed> オブジェクト */
14    protected array $objects = [];
15
16    /**
17     * 新しいオブジェクトを作成します。
18     *
19     * @param array<mixed,mixed> $objects オブジェクトを渡します
20     */
21    public function __construct(array $objects)
22    {
23        $this->objects = $objects;
24    }
25
26    public function isEmpty(): bool
27    {
28        return $this->size() <= 0;
29    }
30
31    public function isNotEmpty(): bool
32    {
33        return 0 < $this->size();
34    }
35
36    public function size(): int
37    {
38        return count($this->objects);
39    }
40
41    public function clear(): void
42    {
43        $this->objects = [];
44    }
45
46    public function toArray(): array
47    {
48        return $this->objects;
49    }
50}