@param SourceInterface $source

@return mixed
@throws IgnoreFieldException
@throws SourceFieldMissingException
325847
public function getValue(SourceInterface $source)
    {
        if (!$source->has($this->field)) {
            if ($this->isIgnoreMissing) {
                throw new IgnoreFieldException();
            }

            if ($this->isDefaultValueSet) {
                return $this->defaultValue;
            }

            throw new SourceFieldMissingException(sprintf('Field "%s" does not exists in source', $this->field));
        }

        $value = $source->get($this->field);

        if ($this->converter) {
            $value = call_user_func($this->converter, $value);
        }

        if ($this->isTrim) {
            $value = trim($value);
        }

        if ($this->isIgnoreEmpty && empty($value)) {
            throw new IgnoreFieldException();
        }

        return $value;
    }
648959
public static function compact($source, $fields)
    {
        $data = array();
        foreach ($fields as $field) {
            if (isset($source[$field])) $data[$field] = $source[$field];
        }
        return $data;
    }
1037410
public function remove($source)
    {
        $loopCounter = 0;

        // Iteration provides nested tag protection
        while ($source != $this->cleanTags($source)) {
            $source = $this->cleanTags($source);
            $loopCounter++;
        }

        return $source;
    }
599582
private function setValuesFromDatafields(array $source): array
    {
        $values = [];
        foreach ($this->datafields as $fieldname => $field) {
            $values[$fieldname] = $this->castValueWithCommonType(
                array_key_exists($fieldname, $source) ? $source[$fieldname] : null,
                $field['commontype']
            );
        }
        return $values;
    }
661450
protected function unserialize($source)
    {
        $source = base64_decode($source);
        $result = @unserialize($source);
        if ($result === false && $source !== serialize(false)) {
            throw new \UnexpectedValueException();
        }
        return $result;
    }
44293
public function convertSource(SourceInterface $source): void
    {
        $converters = $source->data()->get('converters');
        if (!$converters || !is_array($converters)) {
            $converters = ['null'];
        }

        foreach ($converters as $converter) {
            $this->eventDispatcher->dispatch(
                Sculpin::EVENT_BEFORE_CONVERT,
                new ConvertEvent($source, $converter, $this->formatterManager->defaultFormatter())
            );
            $this->converter($converter)->convert(new SourceConverterContext($source));
            $this->eventDispatcher->dispatch(
                Sculpin::EVENT_AFTER_CONVERT,
                new ConvertEvent($source, $converter, $this->formatterManager->defaultFormatter())
            );
        }
    }
1274398
public function getResourcesBySourceName($sourceName)
    {
        // Getting source object first
        $source = $this->getSourceByName($sourceName);

        // Getting the data
        if ($source instanceof SourceInterface) {
            // Getting result iterator
            try {
                return $source->getContentIterator();
            } catch (\Exception $e) {
                throw new Exception\SourceGetDataException(
                    sprintf(
                        'Exception caught while getting the content for the following source object: %s',
                        $source->toString()
                    )
                );
            }
        }
        return null;
    }
814257
public function getDataSource(string  $source) : Source
	{
		switch ($source) {
			case 'form':
			case 'forms':
				return $this
					->getDataSources()
					->getFormsDataSource();
				break;
			case 'entry':
			case 'entries':
				return $this
					->getDataSources()
					->getEntryDataSource();
				break;
			case 'entryValue':
			case 'entryValues':
				return $this
					->getDataSources()
					->getEntryValuesDataSource();
		}
	}
1006891
public function fieldValue(EntityInterface $data, $field)
    {
        if (empty($data)) {
            $data = $this->getContext();
        }

        return $data->get($field);
    }
302892
public function setSource($source)
    {
        if (!$source instanceof Collection) {
            $source = collect($source);
        }

        $this->source = $source;
        return $this;
    }
185030
protected function castStream($source): StreamInterface
    {
        if ($source instanceof UploadedFileInterface || $source instanceof StreamableInterface) {
            $source = $source->getStream();
        }

        if ($source instanceof StreamInterface) {
            //This step is important to prevent user errors
            $source->rewind();

            return $source;
        }

        if (is_resource($source)) {
            return stream_for($source);
        }

        if (empty($source)) {
            //Guzzle?
            return stream_for('');
        }

        if ($this->isFilename($source)) {
            //Must never pass user string in here, use Stream
            return stream_for(fopen($source, 'rb'));
        }

        //We do not allow source names in a string form
        throw new BucketException(
            "Source must be a valid resource, stream or filename, invalid value given"
        );
    }
382968
private function parse($source)
    {
        $parser = $this->getParser();
        $parser->setPragmas($this->getPragmas());

        return $parser->parse($this->tokenize($source));
    }
1352529
private function getRequestAdapter($source)
    {
        if ($source instanceof RequestAdapter) {
            return $source;
        } elseif ($source instanceof ServerRequestInterface) {
            return new Psr7RequestAdapter($source);
        } elseif (is_array($source)) {
            return new SuperglobalRequestAdapter($source);
        }

        throw new \InvalidArgumentException("Unknown IP source.");
    }
534128
public function getSourceChildPropertiesToBeConverted($source)
    {
        $sourceChildPropertiesToBeConverted = [
            'resource' => $source->getResource()
        ];

        if ($source instanceof AssetVariantInterface) {
            $sourceChildPropertiesToBeConverted['originalAsset'] = $source->getOriginalAsset();
        }
        if ($source instanceof ImageVariant) {
            $sourceChildPropertiesToBeConverted['adjustments'] = $source->getAdjustments();
        }

        return $sourceChildPropertiesToBeConverted;
    }
1071683
public function source($source = null)
    {
        if (!func_num_args()) {
            return $this->_source;
        }
        $this->_source = $source;
        return $this;
    }
577910
public static function source($source = '')
    {
        $ins = new static();
        if (is_object($source) && is_a($source, "\Illuminate\Database\Eloquent\Model")) {
            $ins->model = $source;
        }
        $ins->cid = $ins->getIdentifier();
        $ins->sniffStatus();
        $ins->sniffAction();

        return $ins;
    }
591472
private function getPermaLinkTemplate(SourceInterface $source): string
    {
        $permalink = $source->data()->get('permalink');

        if (!$permalink) {
            $permalink = $this->defaultPermalink;
        }

        return $permalink;
    }