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