src/Utilities/Reflection.php
public static function getPropertyValues($objects, $property, $force = false)
    {
        /*
         * No objects?
         * Nothing to do
         */
        if (empty($objects)) {
            return [];
        }

        if ($objects instanceof Collection) {
            $objects = $objects->toArray();
        }

        $values = [];
        $objects = Arrays::makeArray($objects);

        foreach ($objects as $object) {
            $value = self::getPropertyValue($object, $property, $force);

            if (null !== $value) {
                $values[] = $value;
            }
        }

        return $values;
    }
public static function getPropertyValues($objects, $property, $force = false)
    {
        /*
         * No objects?
         * Nothing to do
         */
        if (empty($objects)) {
            return [];
        }

        if ($objects instanceof Collection) {
            $objects = $objects->toArray();
        }

        $values = [];
        $objects = Arrays::makeArray($objects);

        foreach ($objects as $object) {
            $value = self::getPropertyValue($object, $property, $force);

            if (null !== $value) {
                $values[] = $value;
            }
        }

        return $values;
    }
public static function getPropertyValues ( $ objects , $ property , $ force = false ) { /*
         * No objects?
         * Nothing to do
         */ if ( empty ( $ objects ) ) { return [ ] ; } if ( $ objects instanceof Collection ) { $ objects = $ objects -> toArray ( ) ; } $ values = [ ] ; $ objects = Arrays :: makeArray ( $ objects ) ; foreach ( $ objects as $ object ) { $ value = self :: getPropertyValue ( $ object , $ property , $ force ) ; if ( null !== $ value ) { $ values [ ] = $ value ; } } return $ values ; }
Returns values of given property for given objects.
Looks for proper getter for the property.

@param array|Collection|object $objects  The objects that should contain given property. It may be also one
object.
@param string                  $property Name of the property that contains a value
@param bool                    $force    (optional) If is set to true, try to retrieve value even if the
object does not have property. Otherwise - not.
@return array
Returns values of given property for given objects . Looks for proper getter for the property .