Return doc for set method.

@param $name
@param Type $type
@param string $namespace

@return Doc
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)));
    }
857839
public function setColumnType($name, $type)
    {
        $this->_columns[$name]['type'] = $type;
        $this->_typeMap[$name] = $type;

        return $this;
    }
282272
protected function findDefinitionFileByRegex($type, $name)
    {
        $namespaceParts = explode('\\', $name);

        $definition = sprintf('%s %s[;\{\s]', $type, array_pop($namespaceParts));
        if (count($namespaceParts) > 0) {
            $namespace = sprintf('namespace %s', implode('\\\\', $namespaceParts));
        } else {
            $namespace = '';
        }

        $files = new Finder();
        $files
            ->name('*.php')
            ->contains(sprintf('/%s.*%s/s', $namespace, $definition))
            ->in($this->sourcePaths)
        ;

        if (!$namespace) {
            $files->notContains('/namespace\s[^;]+/');
        }

        $file = current(iterator_to_array($files));

        if (!$file instanceof SplFileInfo) {
            return;
        }

        $baseFile = PhpFileInfo::create($file);

        return $this->usageParser->parseFile($baseFile);
    }
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;
        }
    }
415312
public static function create($namespace = null, $name = null)
    {
        if (null === $namespace) {
            return self::createNamespacelessUuid();
        }

        return self::createNamespacedUuid($namespace, $name);
    }
1104831
public function RemoveTypeDef($name, $namespace="", $header="")
    {
        if($header)
        {
            if($namespace)
            {
                unset($this->headers[$header]->namespaces[$namespace]->type_definitions[$name]);
            }
            else
            {
                foreach($this->headers[$header]->namespaces as $namespace_object)
                {
                    unset($namespace_object->type_definitions[$name]);
                }
            }
        }
        elseif($namespace)
        {
            foreach($this->headers as $header_object)
            {
                unset($header_object->namespaces[$namespace]->type_definitions[$name]);
            }
        }
        else
        {
            foreach($this->headers as $header_object)
            {
                foreach($header_object->namespaces as $namespace_object)
                {
                    unset($namespace_object->type_definitions[$name]);
                }
            }
        }
    }
367691
public static function build($name, $type)
	{
		$factory = new BuildFactory(self::config($name), $type);
		$buildNode = $factory->build();
		$buildNode->build();
		return $buildNode->getNodes();
	}
1292612
protected function getDefinitionFile($type, $name)
    {
        if (array_key_exists($name, $this->definitionFiles)) {
            return $this->definitionFiles[$name];
        }

        $this->definitionFiles[$name] = null;
        $this->definitionFiles[$name] = $this->findDefinitionFileByComposer($name);

        if (null !== $this->definitionFiles[$name]) {
            return $this->definitionFiles[$name];
        }

        $this->definitionFiles[$name] = $this->findDefinitionFileByName($name);

        if (null !== $this->definitionFiles[$name]) {
            return $this->definitionFiles[$name];
        }

        $this->definitionFiles[$name] = $this->findDefinitionFileByRegex($type, $name);

        return $this->definitionFiles[$name];
    }
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);
    }
986491
public function getPrefixForDocumentNamespace( $namespace )
	{
		if ( is_null( $this->cacheDocumentNamespaces ) )
		{
			$this->cacheDocumentNamespaces = array_flip( $this->instance_xml->getDocNamespaces() );
			// If the default namespace is one of the standards ones then the prefix may be missing
			$standardNamespaces = array_flip( XBRL_Constants::$standardPrefixes );
			$docNamespace = array_search( '', $this->cacheDocumentNamespaces );
			if ( $docNamespace )
			{
				if ( isset( $standardNamespaces[ $docNamespace ] ) )
				{
					$this->cacheDocumentNamespaces[ $docNamespace ] = $standardNamespaces[ $docNamespace ];
				}
				else
				{
					// Get the namespace for the respective namespace
					$taxonomy = $this->getInstanceTaxonomy()->getTaxonomyForNamespace( $docNamespace );
					if ( $taxonomy )
					{
						$this->cacheDocumentNamespaces[ $docNamespace ] = $taxonomy->getPrefix();
					}
				}
			}
		}

		return isset( $this->cacheDocumentNamespaces[ $namespace ] )
			? $this->cacheDocumentNamespaces[ $namespace ]
			: false;
	}
164573
public function setTypeName(string $typeName, array $use = [], string $nameSpace = ''): TypeModel
    {
        $types = ['string', 'int', 'float', 'array', 'bool', 'callable'];
        $this->typeName = $typeName;
        if (!in_array($typeName, $types) && strpos($typeName, '|') === false) {
            foreach ($use as $item) {
                $items = explode('\\', $item);
                $className = array_pop($items);
                if ($className == $typeName) {
                    $this->setClassName('\\'.$item);
                    break;
                }
            }
            if (!$this->getClassName()) {
                if (strpos($typeName, '\\') !== false) {
                    $this->setClassName($typeName);
                } else {
                    $this->setClassName($nameSpace.'\\'.$typeName);
                }
            }
        }

        return $this;
    }
1315033
public function preCompileInterface($namespace, $topStatement, $docblock)
    {
        $classDefinition = new ClassDefinition($namespace, $topStatement['name']);
        $classDefinition->setIsExternal($this->external);

        if (isset($topStatement['extends'])) {
            foreach ($topStatement['extends'] as &$extend) {
                $extend['value'] = $this->getFullName($extend['value']);
            }
            $classDefinition->setImplementsInterfaces($topStatement['extends']);
        }

        $classDefinition->setType('interface');

        if (\is_array($docblock)) {
            $classDefinition->setDocBlock($docblock['value']);
        }

        if (isset($topStatement['definition'])) {
            $definition = $topStatement['definition'];

            /*
             * Register constants
             */
            if (isset($definition['constants'])) {
                foreach ($definition['constants'] as $constant) {
                    $classConstant = new ClassConstant(
                        $constant['name'],
                        isset($constant['default']) ? $constant['default'] : null,
                        isset($constant['docblock']) ? $constant['docblock'] : null
                    );
                    $classDefinition->addConstant($classConstant);
                }
            }

            /*
             * Register methods
             */
            if (isset($definition['methods'])) {
                foreach ($definition['methods'] as $method) {
                    $classMethod = new ClassMethod(
                        $classDefinition,
                        $method['visibility'],
                        $method['name'],
                        isset($method['parameters']) ? new ClassMethodParameters($method['parameters']) : null,
                        null,
                        isset($method['docblock']) ? $method['docblock'] : null,
                        isset($method['return-type']) ? $method['return-type'] : null,
                        $method
                    );
                    $classDefinition->addMethod($classMethod, $method);
                }
            }
        }

        $this->classDefinition = $classDefinition;
    }
1278485
private function generateGetter(string $name, string $type): ServiceDTOGenerator
    {
        if ('datetime' === $type) {
            $type = '\DateTime';
        }

        $this->DTOClass
            ->addMethod(('bool' === $type) ? 'is' . ucfirst($name) : 'get' . ucfirst($name))
            ->setVisibility('public')
            ->addComment('Returns ' . strtolower($this->inputData['class']) . ' ' . $name . PHP_EOL)
            ->addComment('@return ' . $type)
            ->setReturnType($type)
            ->addBody('return $this->' . $name . ';');

        return $this;
    }
521557
public static function findFirstByNameType( $name, $type, $config = [] ) {

		return self::queryByNameType( $name, $type, $config )->one();
	}
1156232
public function getFrom($namespace, $key = null, $default = null)
    {
        if (isset($_SESSION[$namespace])) {
            $oldNamespace = $this->namespace;
            $this->setNamespace($namespace);
            $result = $this->get($key, $default);
            $this->setNamespace($oldNamespace);

            return $result;
        }
        return $default;
    }
69342
static public function buildClass($type, $module, $name, $namespace = 'App')
    {
        $appPath    = static::getAppPath();
        
        $type       = ucfirst($type);
        $name       = ucfirst($name);
        $suffix     = $type;
        $filename   = $appPath . ($module ? strtolower($module) . '/' : '') . 'src/' . $type . '/' . $name . $suffix . '.php';
        
        if (!is_file($filename)) {
            if (!is_dir(dirname($filename))) {
                mkdir(dirname($filename), 0755, true);
            }
            
            $content = '<?php\n namespace {namespace};\n class {name}{suffix}\n {\n}';
            $namespace = $namespace . ($module ? '\\' . ucfirst($module) : '') . '\\' . $type;
            $module    = strtolower($module);
            $content = str_replace(['{namespace}', '{module}', '{name}', '{suffix}'], [$namespace, $module, $name, $suffix], $content);
            file_put_contents($filename, $content);
        }
    }
1309859
public function getItems($name, $type)
	{
		$namespaced = $this->namespace.':'.$name;

		$key = ($type === 'queued') ? $namespaced : $namespaced.':'.$type;

		if ( ! $this->exists($key)) throw new QueueNotFoundException($key);

		$type = $this->type($key);
		$length = $this->length($key, $type);

		$method = 'get'.ucwords($type).'Items';
		$items = $this->{$method}($key, $length);

		return Collection::make($items);
	}