Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractTable
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
8 / 8
9
100.00% covered (success)
100.00%
1 / 1
 offsetSet
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 offsetGet
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 offsetExists
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 offsetUnset
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 __set
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __get
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __isset
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __unset
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Pdf\Build\Font\TrueType\Table;
16
17use ReturnTypeWillChange;
18
19/**
20 * Abstract table class
21 *
22 * @category   Pop
23 * @package    Pop\Pdf
24 * @author     Nick Sagona, III <nick@popphp.org>
25 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
26 * @license    https://www.popphp.org/license     New BSD License
27 * @version    6.0.0
28 */
29abstract class AbstractTable implements \ArrayAccess, TableInterface
30{
31
32    /**
33     * Font table properties
34     * @var array
35     */
36    protected array $properties = [];
37
38    /**
39     * Read-only properties
40     * @var array
41     */
42    protected array $readOnly = [];
43
44    /**
45     * Offset set method
46     *
47     * @param  mixed $offset
48     * @param  mixed $value
49     * @return void
50     */
51    public function offsetSet(mixed $offset, mixed $value): void
52    {
53        $this->properties[$offset] = $value;
54    }
55
56    /**
57     * Offset get method
58     *
59     * @param  mixed $offset
60     * @return mixed
61     */
62    public function offsetGet(mixed $offset): mixed
63    {
64        return $this->properties[$offset] ?? null;
65    }
66
67    /**
68     * Offset exists method
69     *
70     * @param  mixed $offset
71     * @return bool
72     */
73    public function offsetExists(mixed $offset): bool
74    {
75        return isset($this->properties[$offset]);
76    }
77
78    /**
79     * Offset unset method
80     *
81     * @param  mixed $offset
82     * @return void
83     */
84    public function offsetUnset(mixed $offset): void
85    {
86        if (isset($this->properties[$offset])) {
87            unset($this->properties[$offset]);
88        }
89    }
90
91    /**
92     * Set method
93     *
94     * @param  string $name
95     * @param  mixed $value
96     * @return void
97     */
98    public function __set(string $name, mixed $value): void
99    {
100        $this->offsetSet($name, $value);
101    }
102
103    /**
104     * Get method
105     *
106     * @param  string $name
107     * @return mixed
108     */
109    public function __get(string $name): mixed
110    {
111        return $this->offsetGet($name);
112    }
113    /**
114     * Isset method
115     *
116     * @param  string $name
117     * @return bool
118     */
119    public function __isset(string $name): bool
120    {
121        return $this->offsetExists($name);
122    }
123    /**
124     * Unset fields[$name]
125     *
126     * @param  string $name
127     * @return void
128     */
129    public function __unset(string $name): void
130    {
131        $this->offsetUnset($name);
132    }
133
134}