Pluck a property from the collection
@param string Property
@return mixed Bond\Container | mixed[]
484360
public function pluck( $property, $ifEmptyDefaultToContainer = false )
    {

        $mapper = $this->getPropertyMapper($property);
        $isAllObjects = true;

        $output = [];
        foreach( $this->collection as $obj ) {
            $propertyValue = $mapper->get($obj);
            $isAllObjects = $isAllObjects and is_object($propertyValue);
            $output[] = $propertyValue;
        }
        if( $output ) {
            if( $isAllObjects ) {
                try {
                    return new Container($output);
                } catch ( \Exception $e ) {
                }
            }
        } elseif( $ifEmptyDefaultToContainer) {
            return new Container();
        }
        return $output;

    }
1114828
private function existenceValidation(Property $property)
    {
        $key = $property->key;

        return [
            $key,
            'exist',
            'targetClass' => $this->getRelatedClass($property),
            'targetAttribute' => 'id',
            'allowArray' => $property->allow_multiple_values,
            'skipOnEmpty' => true,
        ];

    }
340973
public function getProperty(string $property)
  {
    if (\property_exists(__CLASS__, $property)) {
      return $this->$property;
    }

    return $this->container($property) ?? null;
  }
776644
public function getPropertyAnnotations($property)
    {
        if (!$this->hasProperty($property)) {
            $name = $this->_getReflection()->getName();
            throw new Exception\InvalidArgumentException(
                "The class {$name} doesn't have a property called {$property}"
            );
        }

        if (empty($this->_annotations['properties'][$property])) {
            $comment = $this->_getReflection()
                ->getProperty($property)
                ->getDocComment();
            $data = AnnotationParser::getAnnotations($comment);
            $propertyAnnotations = new AnnotationsList();
            foreach ($data as $property => $parsedData) {
                $propertyAnnotations->append(
                    $this->_createAnnotation($property, $parsedData)
                );
            }
            $this->_annotations['properties'][$property] = $propertyAnnotations;
        }
        return $this->_annotations['properties'][$property];
    }
769952
public function getRelationMappedToProperty(string $property)
    {
        InvalidArgumentException::verify(is_string($property), 'property must be a string');
        $relations = $this->getRelationMappings();

        foreach ($relations as $mapping) {
            $accessor = $mapping->getAccessor();

            if ($accessor instanceof PropertyAccessor) {
                if ($accessor->getPropertyName() === $property) {

                    return $mapping->getRelation();
                }
            }
        }

        return null;
    }
716329
public function getProperty($classname, $property)
    {
        return $this->hasProperty($classname, $property)
            ? $this->properties[$classname . '$' . $property]
            : [];
    }
51387
public function get($property)
    {
        // CodeIgniter property aliasing
        if ($property === 'load') {
            $property = 'loader';
        }

        if (services()->has($property)) {
            return services()->get($property);
        } elseif ($property === 'model') {
            return models('controller');
        } elseif ($property === 'services' || $property === 'libraries') {
            return services();
        } elseif (method_exists($this, $property)) {
            return call_user_func([&$this, $property]);
        }

        return parent::get($property);
    }
1117747
public function getCheckedUidsAsArray($property)
    {
        $array = array();
        $entities = $this->{'get' . ucfirst($property)}();

        foreach ($entities as $item) {
            $array[$item->getUid()] = $item->getUid();
        }

        return $array;
    }
955481
public function getTransferProperty($property)
    {
        if (!is_string($property)) {
            return [$property, 0];
        }

        // 正则匹配
        $injectProperty = $property;
        $isRef = preg_match('/^\$\{(.*)\}$/', $property, $match);

        // 解析
        if (!empty($match)) {
            $isRef = strpos($match[1], 'config') === 0 ? 0 : $isRef;
            $injectProperty = $this->getInjectProperty($match[1]);
        }

        return [$injectProperty, $isRef];
    }
299138
public function &__get($property)
    {
        $get[ $property ] = false;

        if (services()->has($property)) {
            $get[ $property ] = services()->get($property);
        }

        return $get[ $property ];
    }
129517
public static function pluck( $array, $key ) {
		$return = array();
		foreach ( $array as $obj ) {
			if ( is_object($obj) && method_exists($obj, $key) ) {
				$return[] = $obj->$key();
			} elseif ( is_object($obj) && property_exists($obj, $key) ) {
				$return[] = $obj->$key;
			} elseif ( is_array($obj) && isset($obj[$key]) ) {
				$return[] = $obj[$key];
			}
		}
		return $return;
	}
122521
private function get_alias( $property )
	{
		if ( in_array( $property, $this->aliases ) )
			return array_search( $property, $this->aliases );

		return $property;
	}
234831
private function getKeyValueProperty($property)
    {
        $result = array();

        // extract key/value pairs
        $valuePairs = explode(',', $property);
        foreach ($valuePairs as $valuePair) {
            // extract key/value of a single value
            $keyValue = explode(':', $valuePair);

            // key and value must be present
            if (!isset($keyValue[1]) || !isset($keyValue[0])) {
                continue;
            }

            $key = trim($keyValue[0]);
            $value = trim($keyValue[1]);

            // key and value must be present
            if (!strlen($key) || !strlen($value)) {
                continue;
            }

            $result[$key] = $value;
        }

        return $result;
    }
1311926
public function pluck(string $value, $key = null): Collection
    {
        $results = [];

        list($value, $key) = static::explodePluckParameters($value, $key);

        foreach ($this->items as $item) {
            $itemValue = self::dataGet($item, $value);

            if (is_null($key)) {
                $results[] = $itemValue;
            } else {
                $itemKey = self::dataGet($item, $key);
                $results[$itemKey] = $itemValue;
            }
        }

        return new static($results);
    }
126633
public function pluck($value, $key = null): array
    {
        return $this
            ->collect(...\array_filter([$value, $key]))
            ->pluck($value, $key)
            ->toArray();
    }
33095
public static function fromProperty(
        string $class,
        string $property
    ): array
    {
        try {

            $property = new \ReflectionProperty($class, $property);
        }
        catch (\ReflectionException $e) {

            throw new Exception(
                "Property '{$class}::{$property}' not found.",
                Exception::PROPERTY_NOT_FOUND
            );
        }

        $docComment = $property->getDocComment();

        unset($property);

        if ($docComment === false) {

            return [];
        }

        return Parser::parseDocComment($docComment);
    }
207792
public function pluck($collection=null, $key=null) {
    list($collection, $key) = self::_wrapArgs(func_get_args(), 2);
    
    $collection = (array) self::_collection($collection);
        
    $return = array();
    foreach($collection as $item) {
      foreach($item as $k=>$v) {
        if($k === $key) $return[] = $v;
      }
    }
    return self::_wrap($return);
  }