@param string $property
@param bool   $needed [optional]

@return $this
@throws InvalidArgumentException
@throws LogicException
481322
protected function validateProperty(string $property, bool $needed = false)
    {
        if (!property_exists($this, $property)) {
            throw new InvalidArgumentException("Property {$property} does not exist");
        }

        if ($needed && !isset($this->{$property})) {
            throw new LogicException("Property {$property} could not be calculated");
        }

        return $this;
    }
329312
public function set($property, $value = null)
    {
        if (is_array($property)) {
            foreach ($property as $k => $v) {
                $this->set($k, $v);
            }

            return $this;
        }

        if ($this->has($property)) {
            $method = 'set' . Str::studly($property);
            $value  = $this->sanitizeSetterValue($method, $value);

            $this->message->{$method}($value);
        }

        return $this;
    }
430672
public function get($property)
    {
        if (!$this->has($property)) {
            throw new \InvalidArgumentException(sprintf('Unknown property "%s"', $property));
        }

        $schema = $this->resolve();
        return pointer($schema)->get($property);
    }
262423
private function addCondition($property, $condition)
    {
        $currentCondition = $property->getVisibleCondition();
        if ((!($currentCondition instanceof ConditionChainInterface))
            || ($currentCondition->getConjunction() != ConditionChainInterface::OR_CONJUNCTION)
        ) {
            if ($currentCondition === null) {
                $currentCondition = new PropertyConditionChain([$condition]);
            } else {
                $currentCondition = new PropertyConditionChain([$currentCondition, $condition]);
            }
            $currentCondition->setConjunction(ConditionChainInterface::OR_CONJUNCTION);
            $property->setVisibleCondition($currentCondition);
        } else {
            $currentCondition->addCondition($condition);
        }
    }
860098
public function update($needed)
    {
        //====================================================================//
        // Save
        if ($needed) {
            $this->entityManager->flush($this->object);
        }

        return $this->getObjectIdentifier();
    }
577221
public function set($property, $value = null)
        {
            $this->One->set($property, $value);

            return $this;
        }
825654
public function setRequired(bool $required): BaseAttribute
    {
        parent::setRequired($required);

        if ($this->getMinLength() === 0) {
            $this->setMinLength(1);
        }

        return $this;
    }
711423
public function set($property, $value)
    {
        // we need to convert booleans into string, because these are query parameters
        if (is_bool($value)) {
            $value = $value
                ? 'true'
                : 'false';
        }

        $this->container[$property] = $value;

        return $this;
    }
438813
public function appendProperty($property) {
    if (is_string($property)) {
      $property = ClassMemberListNode::create($property);
    }
    $properties = $this->statements->children(Filter::isInstanceOf('\Pharborist\ClassMemberListNode'));
    if ($properties->count() === 0) {
      $this->statements->firstChild()->after($property);
    }
    else {
      $properties->last()->after($property);
    }
    FormatterFactory::format($this);
    return $this;
  }
240423
function setFulfillmentBy($property)
    {
        $this->fulfillment_property = (string) StdString::of((string)$property)->under_score();
        return $this;
    }
161452
public static function missingProperty($property, $keyword, $pointer)
    {
        $message = sprintf(
            'The schema must contain the property %s',
            $property
        );

        return new self($message, $keyword, $pointer);
    }
834218
public function validateProperty(string $property, $allowed): bool
    {
        if (is_string($allowed)) {
            $allowed = explode('|', $allowed);
        }

        if (!is_array($allowed)) {
            throw new InvalidTypeException('$allowed must be a string or array');
        }

        $valid = false;
        $optional = in_array('optional', $allowed);

        if ($optional && (!isset($this->{$property}) || $this->{$property} === null)) {
            return true;
        }

        foreach ($allowed as $index => $type) {
            if ($type === 'optional') {
                continue;
            }

            if ($valid = $this->validatePropertyType($property, $type)) {
                break;
            }
        }

        if (!$valid) {
            $this->throwInvalidTypeException($property, $allowed, $optional);
        }

        return true;
    }
158694
private function getEntityGetter($entity, $property)
    {
        $getter = null;

        $prefixes = ['get', 'is', 'has', ''];

        foreach ($prefixes as $prefix) {
            $test = $prefix.ucfirst($property);
            if (method_exists($entity, $test)) {
                $getter = $test;
                break;
            }
        }

        if (null === $getter) {
            throw new \LogicException("Entity has no getter for property `{$property}`.");
        }

        return $getter;
    }
1084351
public function add($property)
    {
        if (!$property instanceof PropertyInterface) {
            throw new \InvalidArgumentException(
                'This Property must be a instance of \ClassGeneration\PropertyInterface'
            );
        }
        if ($property->getName() === null) {
            $property->setName('property' . ($this->count() + 1));
        }

        parent::set($property->getName(), $property);

        return true;
    }
661541
public function setProperty($property)
    {
        $this->_properties[$property->getName()] = $property;

        //if property name is the same as the identity property
        //then set the identity property
        if (
            is_string($this->_identity_property) &&
            $property->getName() == $this->_identity_property
        ) {
            $this->setIdentityProperty($property);
        }

        return $this;
    }
142633
final protected static function get_property_error_message($property) {
        $properties = static::properties_definition();
        if (!isset($properties[$property]['message'])) {
            return new lang_string('invaliddata', 'error');
        }
        return $properties[$property]['message'];
    }
879081
public function setPropertyType($type)
    {
        if (empty($type)) {
            $this->propertyType = null;
            return $this;
        }

        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Property type must be a string'
            );
        }

        $this->propertyType = $type;

        return $this;
    }