projects/packages/sync/src/modules/class-callables.php 1 location
|
@@ 584-603 (lines=20) @@
|
581 |
|
* @param array $ids Object IDs. |
582 |
|
* @return array Array of objects. |
583 |
|
*/ |
584 |
|
public function get_objects_by_id( $object_type, $ids ) { |
585 |
|
if ( empty( $ids ) || empty( $object_type ) || 'callable' !== $object_type ) { |
586 |
|
return array(); |
587 |
|
} |
588 |
|
|
589 |
|
$objects = array(); |
590 |
|
foreach ( (array) $ids as $id ) { |
591 |
|
$object = $this->get_object_by_id( $object_type, $id ); |
592 |
|
|
593 |
|
if ( 'CALLABLE-DOES-NOT-EXIST' !== $object ) { |
594 |
|
if ( 'all' === $id ) { |
595 |
|
// If all was requested it contains all options and can simply be returned. |
596 |
|
return $object; |
597 |
|
} |
598 |
|
$objects[ $id ] = $object; |
599 |
|
} |
600 |
|
} |
601 |
|
|
602 |
|
return $objects; |
603 |
|
} |
604 |
|
|
605 |
|
/** |
606 |
|
* Retrieve a callable by its name. |
projects/packages/sync/src/modules/class-constants.php 1 location
|
@@ 295-312 (lines=18) @@
|
292 |
|
* @param array $ids Object IDs. |
293 |
|
* @return array Array of objects. |
294 |
|
*/ |
295 |
|
public function get_objects_by_id( $object_type, $ids ) { |
296 |
|
if ( empty( $ids ) || empty( $object_type ) || 'constant' !== $object_type ) { |
297 |
|
return array(); |
298 |
|
} |
299 |
|
|
300 |
|
$objects = array(); |
301 |
|
foreach ( (array) $ids as $id ) { |
302 |
|
$object = $this->get_object_by_id( $object_type, $id ); |
303 |
|
|
304 |
|
if ( 'all' === $id ) { |
305 |
|
// If all was requested it contains all options and can simply be returned. |
306 |
|
return $object; |
307 |
|
} |
308 |
|
$objects[ $id ] = $object; |
309 |
|
} |
310 |
|
|
311 |
|
return $objects; |
312 |
|
} |
313 |
|
|
314 |
|
/** |
315 |
|
* Retrieve a constant by its name. |
projects/packages/sync/src/modules/class-options.php 1 location
|
@@ 420-440 (lines=21) @@
|
417 |
|
* @param array $ids Object IDs. |
418 |
|
* @return array Array of objects. |
419 |
|
*/ |
420 |
|
public function get_objects_by_id( $object_type, $ids ) { |
421 |
|
if ( empty( $ids ) || empty( $object_type ) || 'option' !== $object_type ) { |
422 |
|
return array(); |
423 |
|
} |
424 |
|
|
425 |
|
$objects = array(); |
426 |
|
foreach ( (array) $ids as $id ) { |
427 |
|
$object = $this->get_object_by_id( $object_type, $id ); |
428 |
|
|
429 |
|
// Only add object if we have the object. |
430 |
|
if ( 'OPTION-DOES-NOT-EXIST' !== $object ) { |
431 |
|
if ( 'all' === $id ) { |
432 |
|
// If all was requested it contains all options and can simply be returned. |
433 |
|
return $object; |
434 |
|
} |
435 |
|
$objects[ $id ] = $object; |
436 |
|
} |
437 |
|
} |
438 |
|
|
439 |
|
return $objects; |
440 |
|
} |
441 |
|
|
442 |
|
/** |
443 |
|
* Retrieve an option by its name. |
projects/packages/sync/src/modules/class-updates.php 1 location
|
@@ 536-553 (lines=18) @@
|
533 |
|
* @param array $ids Object IDs. |
534 |
|
* @return array Array of objects. |
535 |
|
*/ |
536 |
|
public function get_objects_by_id( $object_type, $ids ) { |
537 |
|
if ( empty( $ids ) || empty( $object_type ) || 'update' !== $object_type ) { |
538 |
|
return array(); |
539 |
|
} |
540 |
|
|
541 |
|
$objects = array(); |
542 |
|
foreach ( (array) $ids as $id ) { |
543 |
|
$object = $this->get_object_by_id( $object_type, $id ); |
544 |
|
|
545 |
|
if ( 'all' === $id ) { |
546 |
|
// If all was requested it contains all updates and can simply be returned. |
547 |
|
return $object; |
548 |
|
} |
549 |
|
$objects[ $id ] = $object; |
550 |
|
} |
551 |
|
|
552 |
|
return $objects; |
553 |
|
} |
554 |
|
|
555 |
|
/** |
556 |
|
* Retrieve a update by its id. |