@param $name
@param $visibility
@param $default
@param $type

@return PropertyGenerator
162117
public static function property(
    $name,
    $visibility = 'public',
    $default = null,
    $type = 'mixed'
  )
  {
    $property = (new PropertyGenerator($name, $default))
    ->setVisibility($visibility);

    $property->setIndentation(Generator::$indentation);

    $docBlock = new DocBlockGenerator();
    $docBlock->setIndentation(Generator::$indentation);

    $tag = new Tag();
    $tag->setName('var');
    $tag->setContent($type);
    $tag->setIndentation(Generator::$indentation);

    $docBlock->setTag($tag);

    $property->setDocBlock($docBlock);

    return $property;
  }
1071270
public function createFilter($name, $type = null, array $options = [])
    {
        $this->preventIfLocked();

        if (null !== $type) {
            return $this->getFactory()->createFilterBuilder($name, $type, $options);
        }

        throw new \InvalidArgumentException('Filter type guessing is not yet supported.');
        // TODO return $this->getFormFactory()->createFilterBuilderForProperty($this->getDataClass(), $name, $options);
    }
1012016
public function searchByNameAndType($name = null, $type = null)
    {
        $searchResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('models/searches'),
            [
                'model_query' => [
                    'name' => $name,
                    'type' => $type,
                ],

            ]
        );

        return $this->getModelsFromResult($searchResult);
    }
366316
public function get($property, $type = null, $default = null)
    {
        if (!isset($this->param[$property])) {
            return $default;
        }

        if (isset($type)) {
            $method = TypeCast::METHODPREFIX . $type;

            return TypeCast::$method($this->param[$property]);
        }

        return $this->param[$property];
    }
15481
protected function createProperty($name, $value = null, $options = [], $type = '', $children = null)
    {
        $property = [
            'name' => $name,
            'type' => $type,
            'options' => $options,
        ];

        if ($children) {
            $property['children'] = $children;
        } else {
            $property['value'] = $value;
        }

        return $property;
    }
415738
public function property($name, $type = null, $db_location = null, $with_form = 0, $restrictions = array(), $form_components = array()) {

    if (is_a($name, 'XClassProperty')) {
      $this->properties[$name->name()] = $name;
    } else {
      if (is_array($name)) {
        $current_property = new XClassProperty($name);
        $this->properties[$current_property->name()] = $current_property;
      } else {

        $current_property = new XClassProperty(
                                                array(
                                                  'name'  =>  $name,
                                                  'type'  =>  $type,
                                                  'defaultValue'  =>  null,
                                                  'value'   =>  null,
                                                  'db_location' => $db_location
                                                )
                                              );

        $this->properties[$name] = $current_property;

      }
    }
	}
1198930
public function getPost(string $name, string $type = null, $default = null)
    {
        $value = $this->getUserData($this->post, $name);

        if ($type) {
            $value = $this->validateType($value, $type, $default);
        }

        return $value;
    }
372385
public static function getConverter($name, $propertyName)
    {
        $objectK = $name.$propertyName;
        if ( ! isset(self::$converterObjects[$objectK])) {
            if ( ! isset(self::$converterMap[$name])) {
                throw new \InvalidArgumentException(sprintf('No converter named "%s" found', $name));
            }

            self::$converterObjects[$objectK] = new self::$converterMap[$name]($propertyName);
        }

        return self::$converterObjects[$objectK];
    }
372419
public function create($name, $type = null, array $initOptions = array(), array $execOptions = array())
    {
        if (null === $type) {
            $type = 'job';
        }

        return $this->getJobFactory()->createNamedBuilder($name, $type, $initOptions, $execOptions);
    }
637981
public function createProperty($name, $modifiers = GProperty::MODIFIER_PROTECTED, $default = 'undefined') {
    $gProperty = new GProperty($this);
    $gProperty->setName($name);
    $gProperty->setModifiers($modifiers);
    if (func_num_args() == 3) {
      $this->setDefaultValue($gProperty,$default);
    }
    $this->addProperty($gProperty);
    return $gProperty;
  }
991518
public function withProperty($name, $wireName, TypeInfo $typeInfo)
    {
        $this->propertyInfoArray[] = new PropertyInfo($name, $wireName, $typeInfo);
        return $this;
    }
186868
protected function ___getterSetterCheckAccess ($type, $name)
    {
        // Check for explicit definition
        if (isset($this->_getterSetterAccessMap)) {
            if (array_key_exists($name, $this->_getterSetterAccessMap)) {
                if (array_key_exists($type, $this->_getterSetterAccessMap[$name])) {
                    return $this->_getterSetterAccessMap[$name][$type];
                }
            }
        }

        // Check for default privilege setting
        $typeUcf = ucfirst($type);
        $defaultAccessPropertyName = "_getterSetterDefault{$typeUcf}Allow";
        if (isset($this->{$defaultAccessPropertyName})) {
            return $this->{$defaultAccessPropertyName};
        }

        // Otherwise return default sensible answer (write no, read yes)
        if ('read' == $type) {
            return true;
        } else {
            return false;
        }
    }
187469
public static function getBlueprint($name, $type, $override = array(), $persisted = true)
    {
        $factory = self::loader()->load($name);

        return $factory->create($type, $override, $persisted);
    }
334154
protected function createSetterDoc($name, Type $type, $namespace)
    {
        return new Doc(sprintf(<<<EOD
/**
 * @param %s %s
 *
 * @return self
 */
EOD
        , $type->getDocTypeHint($namespace), '$'.$this->getNaming()->getPropertyName($name)));
    }
959223
protected static function init(string $type = 'string', string $key = null, string $name = null)
    {
        $instance = new static();

        $instance->key($key);
        $instance->field['type'] = $type;

        if ($name) $instance->field['name'] = $name;

        return $instance;
    }
1092527
protected function loadDefaultValues($name, $type = 'metadata')
    {
        $defaultValue = $this->getFileManager()->getContents(array($this->pathToDefaults, $type, $name.'.json') );
        if ($defaultValue !== false) {
            if ($this->useObjects) {
                return Utils\Json::decode($defaultValue);
            } else {
                return Utils\Json::decode($defaultValue, true);
            }
        }
        if ($this->useObjects) {
            return (object) [];
        } else {
            return array();
        }
    }
1136569
private function generateSetter(string $name, string $type): EntityGenerator
    {
        if ('datetime' === $type) {
            $type = '\DateTime';
        }

        $setter = $this->entityClass
            ->addMethod('set' . ucfirst($name))
            ->setVisibility('public')
            ->addComment('Sets ' . strtolower($this->entityData['class']) . ' ' . $name . PHP_EOL)
            ->addComment('@param ' . $type . ' $' . $name)
            ->addComment('@return ' . ucfirst($this->entityData['class']))
            ->addBody('$this->' . $name . ' = $' . $name . ';' . PHP_EOL)
            ->addBody('return $this;')
            ->setReturnType($this->entityData['namespace'] . '\\' . ucfirst($this->entityData['class']));

        $setter
            ->addParameter($name)
            ->setTypeHint($type);

        return $this;
    }