Takes a generic build and returns a type-specific build model.
@param Build $build The build from which to get a more specific build type.
@return Build
10751
public static function getBuild(Build $build)
    {
        $project = $build->getProject();

        if (!empty($project)) {
            switch ($project->getType()) {
                case 'remote':
                    $type = 'RemoteGitBuild';
                    break;
                case 'local':
                    $type = 'LocalBuild';
                    break;
                case 'github':
                    $type = 'GithubBuild';
                    break;
                case 'bitbucket':
                    $type = 'BitbucketBuild';
                    break;
                case 'gitlab':
                    $type = 'GitlabBuild';
                    break;
                case 'hg':
                    $type = 'MercurialBuild';
                    break;
                case 'svn':
                    $type = 'SubversionBuild';
                    break;
                default:
                    return $build;
            }

            $class = '\\PHPCI\\Model\\Build\\' . $type;
            $build = new $class($build->getDataArray());
        }

        return $build;
    }
942274
public function filter(Builder $builder): Builder
    {
        if (is_null($this->parameters) || $this->request->filled($this->parameters)) {
            return $this->run($builder);
        }

        return $builder;
    }
31254
protected function getPropertyBuilder($prefix)
    {
        $build = function ($value, $key, $sub = null) use (&$prefix, &$build) {
            $sub = ($sub ? $sub : $prefix);

            if (!is_numeric($key)) {
                $sub .= static::SEP_MAJOR . $this->fixString($key);
            }

            if (is_array($value)) {
                return array_map(
                    $build,
                    $value,
                    array_keys($value),
                    array_fill(0, count($value), $sub)
                );
            }

            $sep = (
                $prefix === $sub
                ? static::SEP_MINOR
                : str_repeat(static::SEP_MAJOR, static::SEP_MULTI)
            );

            return $sub . $sep . $this->fixString($value);
        };

        return $build;
    }
231578
@Nonnull
	public static <T1, T2> LBiObjFltPredicate<T1, T2> biObjFltPredicateFrom(Consumer<LBiObjFltPredicateBuilder<T1, T2>> buildingFunction) {
		LBiObjFltPredicateBuilder builder = new LBiObjFltPredicateBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
443214
def get_build_spec(self):
        """"""
        if BaseSpecification.BUILD not in self._data:
            return None
        return BuildConfig.from_dict(self._data[BaseSpecification.BUILD])
246458
protected function build(Blueprint $blueprint)
    {
        return $blueprint->build(
            $this->getConnection(),
            $this->conn->getSchemaGrammar()
        );
    }
877941
public function getNextBuild()
    {
        //if (count($this->_queue)<1) {
        //    $this->getNextBuildTime();
        //}
        usort($this->queue, array($this, 'sortQueue'));
        if (isset($this->queue[0])) {
            if ($this->queue[0]->getNextBuildTime() <= time()) {
                $build = array_shift($this->queue);
                $build->dequeue();

                return $build;
            }
        }

        return;
    }
632295
public function run(Builder $builder): Builder
    {
        if ($builder->getQuery()->getConnection() instanceof PostgresConnection) {
            return $builder->whereRaw('content::TEXT ILIKE ?', '%'.$this->request->get('search').'%');
        }

        return $builder->where('content', 'LIKE', '%'.$this->request->get('search').'%');
    }
562349
protected function getMappedFile($from)
    {
        if (!$this->mapperElement) {
            throw new BuildException("This task requires you to use a <mapper/> element to describe how filename changes should be handled.");
        }

        $mapper = $this->mapperElement->getImplementation();
        $mapped = $mapper->main($from);
        if (!$mapped) {
            throw new BuildException("Cannot create new filename based on: " . $from);
        }
        // Mappers always return arrays since it's possible for some mappers to map to multiple names.
        $outFilename = array_shift($mapped);
        $outFile = new PhingFile($this->getOutputDirectory(), $outFilename);

        return $outFile;
    }
1199240
protected function _buildTarget($factory, $build)
    {
        $writer = $factory->writer();
        $compiler = $factory->cachedCompiler();

        $name = $writer->buildFileName($build);
        if ($writer->isFresh($build) && !$this->cli->arguments->defined('force')) {
            $this->verbose('<light_blue>Skip building</light_blue> ' . $name . ' existing file is still fresh.', 'S');
            return;
        }

        $writer->invalidate($build);
        $name = $writer->buildFileName($build);
        try {
            $contents = $compiler->generate($build);
            $writer->write($build, $contents);
            $this->verbose('<green>Saved file</green> for ' . $name, '.');
        } catch (Exception $e) {
            $this->cli->err('<red>Error:</red> ' . $e->getMessage());
        }
    }
766779
public function addBuildToQueue(Build $build)
    {
        $buildId = $build->getId();

        if (empty($buildId)) {
            return;
        }

        $config = Config::getInstance();
        $settings = $config->get('phpci.worker', []);

        if (!empty($settings['host']) && !empty($settings['queue'])) {
            try {
                $jobData = array(
                    'type' => 'phpci.build',
                    'build_id' => $build->getId(),
                );

                if ($config->get('using_custom_file')) {
                    $jobData['config'] = $config->getArray();
                }

                $pheanstalk = new Pheanstalk($settings['host']);
                $pheanstalk->useTube($settings['queue']);
                $pheanstalk->put(
                    json_encode($jobData),
                    PheanstalkInterface::DEFAULT_PRIORITY,
                    PheanstalkInterface::DEFAULT_DELAY,
                    $config->get('phpci.worker.job_timeout', 600)
                );
            } catch (\Exception $ex) {
                $this->queueError = true;
            }
        }
    }
920281
public static function getPlatformType()
    {
        $container = self::getContainer();
        $builder = CollectionBuilder::create($container, false);

        return $container->get('projectXPlatform')
            ->setBuilder($builder);
    }
151475
public function build()
    {
        Debug::enterScope('build');
        $traverser = $this->createNodeCreatorTraverser($this->config);
        $result = $traverser->traverse();

        $node = new ContainerNode();
        $gatherer = $this->createNodeGathererTraverser($result, $node);
        $gatherer->traverse();
        Debug::exitScope('build');

        return $node;
    }
896090
public function build()
    {
        $mapping = $this->mapping;
        if ($this->joinColumns) {
            $mapping['joinColumns'] = $this->joinColumns;
        }
        $cm = $this->builder->getClassMetadata();
        if ($this->type == ClassMetadata::MANY_TO_ONE) {
            $cm->mapManyToOne($mapping);
        } else if ($this->type == ClassMetadata::ONE_TO_ONE) {
            $cm->mapOneToOne($mapping);
        } else {
            throw new \InvalidArgumentException("Type should be a ToOne Association here");
        }
        return $this->builder;
    }
264200
public function build(): GetObjectByHeapObjectIdRequest
	{
		$instance = new GetObjectByHeapObjectIdRequest();
		if ($this->objectId === null) {
			throw new BuilderException('Property [objectId] is required.');
		}
		$instance->objectId = $this->objectId;
		$instance->objectGroup = $this->objectGroup;
		return $instance;
	}
1364276
public static function build($name)
    {
        if (isset(static::$_builtTypes[$name])) {
            return static::$_builtTypes[$name];
        }
        if (!isset(static::$_types[$name])) {
            throw new InvalidArgumentException(sprintf('Unknown type "%s"', $name));
        }
        if (is_string(static::$_types[$name])) {
            return static::$_builtTypes[$name] = new static::$_types[$name]($name);
        }

        return static::$_builtTypes[$name] = static::$_types[$name];
    }
983911
public function build()
    {
        $cm = $this->builder->getClassMetadata();
        if ($this->generatedValue) {
            $cm->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $this->generatedValue));
        }
        if ($this->version) {
            $cm->setVersionMapping($this->mapping);
        }
        $cm->mapField($this->mapping);
        if ($this->sequenceDef) {
            $cm->setSequenceGeneratorDefinition($this->sequenceDef);
        }
        return $this->builder;
    }