• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

brick / geo / 14057076899

25 Mar 2025 10:14AM UTC coverage: 52.154% (-13.7%) from 65.828%
14057076899

push

github

BenMorel
Wip

0 of 383 new or added lines in 14 files covered. (0.0%)

141 existing lines in 12 files now uncovered.

1634 of 3133 relevant lines covered (52.15%)

396.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Proxy/MultiPointProxy.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Geo\Proxy;
6

7
use Brick\Geo\Exception\GeometryIoException;
8
use Brick\Geo\Exception\CoordinateSystemException;
9
use Brick\Geo\Exception\InvalidGeometryException;
10
use Brick\Geo\Exception\UnexpectedGeometryException;
11
use Brick\Geo\Geometry;
12
use Brick\Geo\MultiPoint;
13
use Brick\Geo\Internal\ProxyRegistry;
14
use Override;
15

16
/**
17
 * Proxy class for MultiPoint.
18
 *
19
 * @internal This class is not part of the public API and can change at any time.
20
 *           Please type-hint against Brick\Geo\MultiPoint in your projects.
21
 */
22
final readonly class MultiPointProxy extends MultiPoint implements ProxyInterface
23
{
24
    /**
25
     * The WKT or WKB data.
26
     */
27
    private readonly string $proxyData;
28

29
    /**
30
     * `true` if WKB, `false` if WKT.
31
     */
32
    private readonly bool $isProxyBinary;
33

34
    /**
35
     * The SRID of the underlying geometry.
36
     */
37
    private readonly int $proxySrid;
38

39
    /**
40
     * @param string $data     The WKT or WKB data.
41
     * @param bool   $isBinary Whether the data is binary (true) or text (false).
42
     * @param int    $srid     The SRID of the geometry.
43
     */
44
    public function __construct(string $data, bool $isBinary, int $srid = 0)
45
    {
UNCOV
46
        $this->proxyData     = $data;
×
UNCOV
47
        $this->isProxyBinary = $isBinary;
×
UNCOV
48
        $this->proxySrid     = $srid;
×
49
    }
50

51
    /**
52
     * Loads the underlying geometry.
53
     *
54
     * @throws GeometryIoException         If the proxy data is not valid.
55
     * @throws CoordinateSystemException   If the resulting geometry contains mixed coordinate systems.
56
     * @throws InvalidGeometryException    If the resulting geometry is not valid.
57
     * @throws UnexpectedGeometryException If the resulting geometry is not an instance of the proxied class.
58
     */
59
    private function load() : MultiPoint
60
    {
UNCOV
61
        return $this->isProxyBinary
×
UNCOV
62
            ? MultiPoint::fromBinary($this->proxyData, $this->proxySrid)
×
UNCOV
63
            : MultiPoint::fromText($this->proxyData, $this->proxySrid);
×
64
    }
65

66
    #[Override]
67
    public function isLoaded() : bool
68
    {
69
        return ProxyRegistry::hasProxiedGeometry($this);
×
70
    }
71

72
    #[Override]
73
    public function getGeometry() : MultiPoint
74
    {
UNCOV
75
        $geometry = ProxyRegistry::getProxiedGeometry($this);
×
76

UNCOV
77
        if ($geometry !== null) {
×
78
            return $geometry;
×
79
        }
80

UNCOV
81
        $geometry = $this->load();
×
UNCOV
82
        ProxyRegistry::setProxiedGeometry($this, $geometry);
×
83

UNCOV
84
        return $geometry;
×
85
    }
86

87
    #[Override]
88
    public function isProxyBinary() : bool
89
    {
90
        return $this->isProxyBinary;
×
91
    }
92

93
    #[Override]
94
    public static function fromText(string $wkt, int $srid = 0) : Geometry
95
    {
96
        return new self($wkt, false, $srid);
×
97
    }
98

99
    #[Override]
100
    public static function fromBinary(string $wkb, int $srid = 0) : Geometry
101
    {
102
        return new self($wkb, true, $srid);
×
103
    }
104

105
    #[Override]
106
    public function srid() : int
107
    {
108
        return $this->proxySrid;
×
109
    }
110

111
    #[Override]
112
    public function asText() : string
113
    {
UNCOV
114
        if (! $this->isProxyBinary) {
×
115
            return $this->proxyData;
×
116
        }
117

UNCOV
118
        return $this->getGeometry()->asText();
×
119
    }
120

121
    #[Override]
122
    public function asBinary() : string
123
    {
124
        if ($this->isProxyBinary) {
×
125
            return $this->proxyData;
×
126
        }
127

128
        return $this->getGeometry()->asBinary();
×
129
    }
130

131

132
    #[Override]
133
    public function toArray(): array
134
    {
135
        return $this->getGeometry()->toArray();
×
136
    }
137

138
    #[Override]
139
    public function dimension(): int
140
    {
141
        return $this->getGeometry()->dimension();
×
142
    }
143

144
    #[Override]
145
    public function project(\Brick\Geo\Projector\Projector $projector): \Brick\Geo\MultiPoint
146
    {
147
        return $this->getGeometry()->project($projector);
×
148
    }
149

150
    #[Override]
151
    public function numGeometries(): int
152
    {
153
        return $this->getGeometry()->numGeometries();
×
154
    }
155

156
    #[Override]
157
    public function geometryN(int $n): \Brick\Geo\Geometry
158
    {
159
        return $this->getGeometry()->geometryN($n);
×
160
    }
161

162
    #[Override]
163
    public function geometries(): array
164
    {
165
        return $this->getGeometry()->geometries();
×
166
    }
167

168
    #[Override]
169
    public function getBoundingBox(): \Brick\Geo\BoundingBox
170
    {
171
        return $this->getGeometry()->getBoundingBox();
×
172
    }
173

174
    #[Override]
175
    public function count(): int
176
    {
177
        return $this->getGeometry()->count();
×
178
    }
179

180
    #[Override]
181
    public function getIterator(): \ArrayIterator
182
    {
183
        return $this->getGeometry()->getIterator();
×
184
    }
185

186
    #[Override]
187
    public function withAddedGeometries(\Brick\Geo\Geometry ...$geometries): \Brick\Geo\GeometryCollection
188
    {
189
        return $this->getGeometry()->withAddedGeometries(...$geometries);
×
190
    }
191

192
    #[Override]
193
    public function coordinateDimension(): int
194
    {
195
        return $this->getGeometry()->coordinateDimension();
×
196
    }
197

198
    #[Override]
199
    public function spatialDimension(): int
200
    {
201
        return $this->getGeometry()->spatialDimension();
×
202
    }
203

204
    #[Override]
205
    public function isEmpty(): bool
206
    {
207
        return $this->getGeometry()->isEmpty();
×
208
    }
209

210
    #[Override]
211
    public function is3D(): bool
212
    {
213
        return $this->getGeometry()->is3D();
×
214
    }
215

216
    #[Override]
217
    public function isMeasured(): bool
218
    {
219
        return $this->getGeometry()->isMeasured();
×
220
    }
221

222
    #[Override]
223
    public function coordinateSystem(): \Brick\Geo\CoordinateSystem
224
    {
225
        return $this->getGeometry()->coordinateSystem();
×
226
    }
227

228
    #[Override]
229
    public function withSrid(int $srid): \Brick\Geo\Geometry
230
    {
231
        return $this->getGeometry()->withSrid($srid);
×
232
    }
233

234
    #[Override]
235
    public function toXy(): \Brick\Geo\Geometry
236
    {
237
        return $this->getGeometry()->toXy();
×
238
    }
239

240
    #[Override]
241
    public function withoutZ(): \Brick\Geo\Geometry
242
    {
243
        return $this->getGeometry()->withoutZ();
×
244
    }
245

246
    #[Override]
247
    public function withoutM(): \Brick\Geo\Geometry
248
    {
249
        return $this->getGeometry()->withoutM();
×
250
    }
251

252
    #[Override]
253
    public function withRoundedCoordinates(int $precision): \Brick\Geo\Geometry
254
    {
255
        return $this->getGeometry()->withRoundedCoordinates($precision);
×
256
    }
257

258
    #[Override]
259
    public function swapXy(): \Brick\Geo\Geometry
260
    {
261
        return $this->getGeometry()->swapXy();
×
262
    }
263

264
    #[Override]
265
    public function isIdenticalTo(\Brick\Geo\Geometry $that): bool
266
    {
267
        return $this->getGeometry()->isIdenticalTo($that);
×
268
    }
269

270
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc