Prepare source.

@param   array   $source    Optional source data. If omitted, a copy of the server variable '_REQUEST' is used.
@param   boolean $reference If set to true, he source in first argument will be reference.

@return  void
776949
public function prepareSource(&$source = null, $reference = false)
    {
        if (is_null($source)) {
            $this->data = &$_REQUEST;
        } else {
            if ($reference) {
                $this->data = &$source;
            } else {
                $this->data = $source;
            }
        }
    }
962146
public function loadSource($source)
    {
        $parser = new Parser();

        list($this->headers, $this->content) = $parser->parsePart($source);
    }
546862
protected static function makeSource($source): SourceInterface
    {
        if (is_array($source) || $source instanceof \ArrayAccess) {
            return new ArraySource($source);
        }

        if (is_object($source)) {
            return new ObjectSource($source);
        }

        throw new InvalidSourceException(
            sprintf('Source type "%s" cannot be recognized as suitable storage', gettype($source))
        );
    }
203523
public function render($source, array $data = array())
    {
        parent::render($source, $data);

        //Load the template
        if($this->getObject('filter.path')->validate($source))
        {
            $source_file = $this->locateSource($source);

            if(!$cache_file = $this->isCached($source_file))
            {
                $source     = $this->loadSource($source_file);
                $source     = $this->compileSource($source);
                $cache_file = $this->cacheSource($source_file, $source);
            }
        }
        else
        {
            $name        = crc32($source);
            $source_file = '';

            if(!$cache_file = $this->isCached($name))
            {
                $source     = $this->compileSource($source);
                $cache_file = $this->cacheSource($name, $source);
            }
        }

        //Include the template
        $result = include $cache_file;

        //Render the debug information
        return  $this->renderDebug($result);
    }
119239
private function _setSourceQuery(array $sourceBody)
    {
        if (isset($sourceBody[self::QUERY]) && $sourceBody[self::QUERY] instanceof AbstractQuery) {
            $sourceBody[self::QUERY] = $sourceBody[self::QUERY]->toArray();
        }

        return $sourceBody;
    }
347945
public function setSource($source)
    {
        if ($this->memorize) {
            if (isset($_GET[$this->skip_var])) {
                $this->skip = $this->memorize('skip', (int) $_GET[$this->skip_var]);
            } else {
                $this->skip = (int) $this->recall('skip');
            }
        } else {
            $this->skip = @$_GET[$this->skip_var] + 0;
        }

        // Start iterating early ($source = DSQL of model)
        if ($source instanceof SQL_Model) {
            $source = $source->_preexec();
        }

        if ($source instanceof DB_dsql) {
            $source->limit($this->ipp, $this->skip);
            $source->calcFoundRows();
            $this->source = $source;
        } elseif ($source instanceof \atk4\data\Model) {
            $this->source = $source->setLimit($this->ipp, $this->skip);
        } elseif ($source instanceof Model) {
            $this->source = $source->setLimit($this->ipp, $this->skip);
        } else {
            // NOTE: no limiting enabled for unknown data source
            $this->source = &$source;
        }
    }
1210700
public function setReference($name, $reference)
    {
        $this->references[$name] = $reference;

        if ($this->hasIdentifier($reference)) {
            // in case if reference is set after flush, store its identity
            $uow = $this->manager->getUnitOfWork();
            $this->identities[$name] = $this->getIdentifier($reference, $uow);
        }
    }
582823
public function setSource($source)
    {
        $this->source = $this->getSourceAsArray($source);
        
        $this->updateViewportFields();
        
        return $this;
    }
485
public function set_html($source, $from_file = false)
    {
        if ($from_file && file_exists($source)) {
            $this->html = file_get_contents($source);
        } else {
            $this->html = $source;
        }

        $this->_converted = false;
    }
1073005
public function setSource($source)
    {
        if ($source instanceof ListSource) {
            $this->source = $source;
        }
        
        if ($source instanceof SS_List) {
            $this->source = ListWrapper::create($source);
        }
        
        return $this->owner;
    }
787086
protected function setInvoiceSource($source)
    {
        parent::setInvoiceSource($source);
        switch ($this->invoiceSource->getType()) {
            case Source::Order:
                $this->order = $this->invoiceSource->getSource();
                $this->creditNote = null;
                break;
            case Source::CreditNote:
                $this->creditNote = $this->invoiceSource->getSource();
                $this->order = $this->creditNote->getOrder();
                break;
        }
        $this->shopInvoices = $this->order->getInvoiceCollection();
        $this->shopInvoice = count($this->shopInvoices) > 0 ? $this->shopInvoices->getFirstItem() : null;
    }
651395
public function setReferenceContext(ReferenceContext $context)
    {
        foreach ($this->_responses as $k => $response) {
            if ($response instanceof Reference) {
                $response->setContext($context);
            } else {
                $response->setReferenceContext($context);
            }
        }
    }
1219607
public static function checkSourceAccess(Source $source = null, $edit = false): void
    {
        if ($source === null) {
            throw new SourceNotFoundException();
        }

        if (!$source->canShow()) {
            throw new SourceAccessDeniedException();
        }

        if ($edit && !$source->canEdit()) {
            throw new SourceAccessDeniedException();
        }
    }
904833
public static function setSource($source = null)
    {
        if (! is_resource($source) && ! is_null($source)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid source provided; must be a null or an resource, "%s" given.',
                is_object($source) ? get_class($source) : gettype($source)
            ));
        }
        static::$source = $source;
    }
1312188
public function setSource( $source )
	{
		if( !file_exists( $source ) )
			throw new InvalidArgumentException( 'Image File "'.$source.'" is not existing.' );
		$size = @getimagesize( $source );
		if( !$size )
			throw new Exception( 'Source File "'.$source.'" is not a supported Image.' );
		$this->size		= $size;
		$this->source	= $source;
	}
158623
public function setSource(Processable $source)
    {
        if ($source instanceof PrintedVariableEngine) {
            parent::setSource($source);
        } else {
            $msg = "PrintedVariableProcessingException::setSource only accepts PrintedVariableEngine objects.";
            throw new InvalidArgumentException($msg);
        }
    }
985544
public function setSourceData(array $source) {
		if ($this->_locked) {
			throw new ReadOnly('Config is read only');
		}
		
		foreach ($source as $key => $part) {
			if (is_array($part)) {
				$this->_data[$key] = new static($part, false);
			} else {
				$this->_data[$key] = $part;
			}
		}
		
		return $this;
	}