prepareSource

@param array $source
@param bool  $reference

@return  void
185864
public function prepareSource(&$source = null, $reference = false)
    {
        $headers = [];

        foreach ((array) $source as $key => $value) {
            $headers[HeaderHelper::normalizeHeaderName($key)] = implode(', ', $value);
        }

        parent::prepareSource($headers, $reference);
    }
1356405
public function applyStrategy(Source $source) {
		if ($this->_built) {
			return;
		}
		$this->_built = true;
		if (!$this->_config['with']) {
			return;
		}
		$options = [];
		if (isset($this->_config['strategy'])) {
			$options['strategy'] = $this->_config['strategy'];
		}
		$source->applyStrategy($options, $this);
	}
157915
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
    {
        $source->filepath = $this->buildFilepath($source, $_template);

        if ($source->filepath !== false) {
            if (is_object($source->smarty->security_policy)) {
                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);
            }

            $source->uid = sha1($source->filepath);
            if ($source->smarty->compile_check) {
                $source->timestamp = @filemtime($source->filepath);
                $source->exists = !!$source->timestamp;
            }
        }
    }
1025978
public static function staticToStatic(string $sourceName, string $targetName): void
  {
    $source      = file_get_contents($sourceName);
    $sourceClass = basename($sourceName, '.php');
    $targetClass = basename($targetName, '.php');

    $source = NonStatic::nonStatic($source, $sourceClass, $targetClass);

    file_put_contents($targetName, $source);
  }
764114
public function addReferenceCache($reference)
    {
        $cache = $this->getMandango()->getCache();

        foreach ($this->getQueryHashes() as $hash) {
            $value = $cache->has($hash) ? $cache->get($hash) : array();
            if (!isset($value['references']) || !in_array($reference, $value['references'])) {
                $value['references'][] = $reference;
                $cache->set($hash, $value);
            }
        }
    }
1087587
private function initSource($source)
    {
        if (empty($this->source)) {
            $this->source = new Source();
        }

        if (!empty($source)) {
            if (is_array($source)) {
                $this->source->setLines($source);
            } elseif (is_string($source)) {
                $this->source->setString($source);
            }
        }
    }
935171
public function fillSource($source)
    {
        $ki = $this->keyIndex;
        $kn = $this->keyName;
        $index = $source->$ki;
        $name = $source->$kn;
        if ($index !== null) {
            if (!isset($this->names[$index])) {
                $message = 'Invalid index '.$this->contextKey.'#'.$index;
                throw new InvalidIndexed($message);
            }
            $newName = $this->names[$index];
            if ($name === null) {
                $source->$kn = $newName;
            } elseif ($name !== $newName) {
                $message = 'Mismatch '.$this->contextKey.'#'.$index.' and "'.$name.'"';
                throw new InvalidIndexed($message);
            }
            return true;
        } elseif ($name !== null) {
            $source->$ki = $this->add($name);
            return true;
        }
        return false;
    }
793192
protected function writeSource($filename, array $source)
    {
        $source = str_replace(['  ', "\n"], ["\t", "\n\t"], var_export($source, true));
        $source = <<<FILE
<?php
	return $source;
FILE;

        return @file_put_contents($filename, $source) != 0;
    }
302892
public function setSource($source)
    {
        if (!$source instanceof Collection) {
            $source = collect($source);
        }

        $this->source = $source;
        return $this;
    }
478028
private function _setSourceType(array $sourceBody)
    {
        if (isset($sourceBody[self::TYPE]) && !\is_array($sourceBody[self::TYPE])) {
            $sourceBody[self::TYPE] = [$sourceBody[self::TYPE]];
        }
        if (isset($sourceBody[self::TYPE])) {
            foreach ($sourceBody[self::TYPE] as $key => $type) {
                if ($type instanceof Type) {
                    $sourceBody[self::TYPE][$key] = $type->getName();
                }
            }
        }

        return $sourceBody;
    }
833842
public function setSource($source): Method
    {
        if (!empty($source)) {
            if (is_array($source)) {
                $this->source->setLines($source);
            } elseif (is_string($source)) {
                $this->source->setString($source);
            }
        }

        return $this;
    }
501765
public function set_source($source) {
        $filerecord = new stdClass;
        $filerecord->source = $source;
        $this->update($filerecord);
    }
1021022
public function source($source, $sourceType = 'local')
    {
        $this->sourcePath = $source;
        $this->sourceType = $sourceType;

        return $this;
    }
105008
public function setSource($source): void
    {
        if (!$source instanceof Db\Query\Select) {
            throw new Grid\GridException('Source of `SelectSource` should be `Db\\Query\\Select` object');
        }
        parent::setSource($source);
    }
573487
public function compileSource($source)
    {
        $result = false;

        $compiler = $this->getCompiler();
        if(is_callable($compiler)) {
            $result = call_user_func($compiler, $source);
        }

        if(!is_string($result)) {
            throw new \RuntimeException(sprintf('The template content cannot be compiled.'));
        }

        return $result;
    }
1350272
public function hasInSource( $key, $source )
	{
		$source	= strtolower( $source );
		return isset( $this->sources[$source][$key] );
	}
846494
public function beforeRun(SourceSetEvent $sourceSetEvent)
    {
        $sourceSet = $sourceSetEvent->sourceSet();

        /** @var FileSource $source */
        foreach ($sourceSetEvent->updatedSources() as $source) {

            if (!$this->shouldBeConverted($source)) {
                continue;
            }

            $source->setShouldBeSkipped();

            $css = $this->parseLess($source->file()->getPathname());
            if (!$css) {
                continue;
            }

            $generatedSource = $this->createDuplicate($source);
            $generatedSource->setContent($css);

            $sourceSet->mergeSource($generatedSource);
        }
    }