Skip to content

Commit 467c6e1

Browse files
committed
Cleaning up
1 parent c43edf9 commit 467c6e1

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

src/mako/pixel/image/operations/gd/Border.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Border implements OperationInterface
2727
*/
2828
public function __construct(
2929
protected Color $color = new Color(0, 0, 0),
30-
protected int $thickness = 5
30+
protected int $size = 5
3131
) {
3232
}
3333

@@ -50,7 +50,7 @@ public function apply(object &$imageResource): void
5050
127 - (int) round($this->color->getAlpha() * 127 / 255)
5151
);
5252

53-
for ($i = 0; $i < $this->thickness; $i++) {
53+
for ($i = 0; $i < $this->size; $i++) {
5454
$x = --$width;
5555
$y = --$height;
5656

src/mako/pixel/image/operations/imagemagick/Border.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Border implements OperationInterface
2323
*/
2424
public function __construct(
2525
protected Color $color = new Color(0, 0, 0),
26-
protected int $thickness = 5
26+
protected int $size = 5
2727
) {
2828
}
2929

@@ -38,18 +38,18 @@ public function apply(object &$imageResource): void
3838
$draw = new ImagickDraw;
3939

4040
$draw->setStrokeColor(new ImagickPixel($this->color->toRgbaString()));
41-
$draw->setStrokeWidth($this->thickness);
41+
$draw->setStrokeWidth($this->size);
4242
$draw->setFillOpacity(0);
4343
$draw->setStrokeAntialias(true);
4444

4545
$width = $imageResource->getImageWidth();
4646
$height = $imageResource->getImageHeight();
4747

4848
$draw->rectangle(
49-
$this->thickness / 2,
50-
$this->thickness / 2,
51-
$width - $this->thickness / 2,
52-
$height - $this->thickness / 2
49+
$this->size / 2,
50+
$this->size / 2,
51+
$width - $this->size / 2,
52+
$height - $this->size / 2
5353
);
5454

5555
$imageResource->drawImage($draw);

src/mako/pixel/metadata/xmp/XmpReader.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,34 +195,34 @@ protected function loadXmp(string $file): CData
195195
}
196196

197197
/**
198-
* Returns an array of arrays containing the "raw" XMP properties matching the provided schema and property name.
198+
* Returns an array of arrays containing the "raw" XMP properties matching the provided namespace and property name.
199199
*
200-
* @return array<array{'schema': string, 'options': int, 'name': string, 'value': string}>
200+
* @return array<array{'namespace': string, 'options': int, 'name': string, 'value': string}>
201201
*/
202-
protected function getRawProperties(?string $schema, ?string $propertyName): array
202+
protected function getRawProperties(?string $namespace, ?string $propertyName): array
203203
{
204204
$properties = [];
205205

206-
$iterator = static::$ffi->xmp_iterator_new($this->xmp, $schema, $propertyName, 0);
206+
$iterator = static::$ffi->xmp_iterator_new($this->xmp, $namespace, $propertyName, 0);
207207

208208
if ($iterator === null) {
209209
return $properties;
210210
}
211211

212-
$schemaString = static::$ffi->xmp_string_new();
212+
$namespaceString = static::$ffi->xmp_string_new();
213213
$nameString = static::$ffi->xmp_string_new();
214214
$valueString = static::$ffi->xmp_string_new();
215215

216216
$options = static::$ffi->new('int');
217217

218218
while (static::$ffi->xmp_iterator_next(
219219
$iterator,
220-
$schemaString,
220+
$namespaceString,
221221
$nameString,
222222
$valueString,
223223
FFI::addr($options)
224224
) === 1) {
225-
$schema = static::$ffi->xmp_string_cstr($schemaString);
225+
$namespace = static::$ffi->xmp_string_cstr($namespaceString);
226226
$name = static::$ffi->xmp_string_cstr($nameString);
227227
$value = static::$ffi->xmp_string_cstr($valueString);
228228

@@ -231,14 +231,14 @@ protected function getRawProperties(?string $schema, ?string $propertyName): arr
231231
}
232232

233233
$properties[$name] = [
234-
'schema' => $schema,
234+
'namespace' => $namespace,
235235
'options' => (int) $options->cdata,
236236
'name' => $name,
237237
'value' => $value,
238238
];
239239
}
240240

241-
static::$ffi->xmp_string_free($schemaString);
241+
static::$ffi->xmp_string_free($namespaceString);
242242
static::$ffi->xmp_string_free($nameString);
243243
static::$ffi->xmp_string_free($valueString);
244244

@@ -250,37 +250,37 @@ protected function getRawProperties(?string $schema, ?string $propertyName): arr
250250
/**
251251
* Returns an array where the "raw" XMP properties have been hydrated to DTO objects.
252252
*
253-
* @param array<array{'schema': string, 'options': int, 'name': string, 'value': string}> $properties
253+
* @param array<array{'namespace': string, 'options': int, 'name': string, 'value': string}> $properties
254254
* @return array<ArrayProperty|QualifierProperty|StructProperty|ValueProperty>
255255
*/
256256
protected function hydrate(array $properties): array
257257
{
258258
foreach ($properties as &$property) {
259259
if ($property['options'] & Type::ARRAY->value) {
260260
$property = new ArrayProperty(
261-
$property['schema'],
261+
$property['namespace'],
262262
$property['options'],
263263
$property['name']
264264
);
265265
}
266266
elseif ($property['options'] & Type::QUALIFIER->value) {
267267
$property = new QualifierProperty(
268-
$property['schema'],
268+
$property['namespace'],
269269
$property['options'],
270270
$property['name'],
271271
$property['value']
272272
);
273273
}
274274
elseif ($property['options'] & Type::STRUCT->value) {
275275
$property = new StructProperty(
276-
$property['schema'],
276+
$property['namespace'],
277277
$property['options'],
278278
$property['name']
279279
);
280280
}
281281
else {
282282
$property = new ValueProperty(
283-
$property['schema'],
283+
$property['namespace'],
284284
$property['options'],
285285
$property['name'],
286286
$property['value']
@@ -378,17 +378,17 @@ public function getXml(): string
378378
}
379379

380380
/**
381-
* Returns an array contaning all properties matching the provided schema and property name.
381+
* Returns an array contaning all properties matching the provided namespace and property name.
382382
*
383383
* @return array<ArrayProperty|StructProperty|ValueProperty>
384384
*/
385-
public function getProperties(?string $schema = null, ?string $propertyName = null): array
385+
public function getProperties(?string $namespace = null, ?string $propertyName = null): array
386386
{
387-
return $this->nest($this->hydrate($this->getRawProperties($schema, $propertyName)));
387+
return $this->nest($this->hydrate($this->getRawProperties($namespace, $propertyName)));
388388
}
389389

390390
/**
391-
* Returns the property matching the provided schema and property name.
391+
* Returns the property matching the provided namespace and property name.
392392
*/
393393
public function getProperty(string $namespace, string $propertyName): null|ArrayProperty|StructProperty|ValueProperty
394394
{

src/mako/pixel/metadata/xmp/properties/CollectionProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class CollectionProperty implements Countable, IteratorAggregate
2626
* Constructor.
2727
*/
2828
public function __construct(
29-
public protected(set) string $schema,
29+
public protected(set) string $namespace,
3030
public protected(set) int $options,
3131
public protected(set) string $fullyQualifiedName,
3232
public protected(set) array $values = []

src/mako/pixel/metadata/xmp/properties/QualifierProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class QualifierProperty
2020
* Constructor.
2121
*/
2222
public function __construct(
23-
public protected(set) string $schema,
23+
public protected(set) string $namespace,
2424
public protected(set) int $options,
2525
public protected(set) string $fullyQualifiedName,
2626
public protected(set) string $value

src/mako/pixel/metadata/xmp/properties/ValueProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ValueProperty implements Stringable
2222
* Constructor.
2323
*/
2424
public function __construct(
25-
public protected(set) string $schema,
25+
public protected(set) string $namespace,
2626
public protected(set) int $options,
2727
public protected(set) string $fullyQualifiedName,
2828
public protected(set) string $value,

0 commit comments

Comments
 (0)