Return methods that this field needs to inject in base class.

@param string $indent
@param array  $result
346057
public function getBaseClassMethods($indent, array &$result)
    {
        $methods = [];

        $methods[] = '/**';
        $methods[] = ' * Return position mode.';
        $methods[] = ' *';
        $methods[] = ' * There are two modes:';
        $methods[] = ' *';
        $methods[] = ' * * head for new records to be added in front of the other records, or';
        $methods[] = ' * * tail when new records are added after existing records.';
        $methods[] = ' *';
        $methods[] = ' * @return string';
        $methods[] = ' */';
        $methods[] = 'public function getPositionMode()';
        $methods[] = '{';
        $methods[] = '    return ' . var_export($this->mode, true) . ';';
        $methods[] = '}';
        $methods[] = '';
        $methods[] = '/**';
        $methods[] = ' * Return context in which position should be set.';
        $methods[] = ' *';
        $methods[] = ' * @return array';
        $methods[] = ' */';
        $methods[] = 'public function getPositionContext()';
        $methods[] = '{';
        $methods[] = '    return [' . implode(', ', array_map(function ($field_name) {
            return var_export($field_name, true);
        }, $this->getContext())) . '];';
        $methods[] = '}';

        foreach ($methods as $line) {
            if ($line) {
                $result[] = "$indent$line";
            } else {
                $result[] = '';
            }
        }
    }
645337
private function createGetIteratorCallable(stdClass $result, Server $server)
    {
        // Inline results can be wrapped with an ArrayIterator
        if (isset($result->results) && is_array($result->results)) {
            $results = $result->results;

            return function() use ($results) {
                if (isset($this->options['typeMap'])) {
                    return new TypeMapArrayIterator($results, $this->options['typeMap']);
                }

                return new ArrayIterator($results);
            };
        }

        if (isset($result->result) && (is_string($result->result) || is_object($result->result))) {
            $options = isset($this->options['typeMap']) ? ['typeMap' => $this->options['typeMap']] : [];

            $find = is_string($result->result)
                ? new Find($this->databaseName, $result->result, [], $options)
                : new Find($result->result->db, $result->result->collection, [], $options);

            return function() use ($find, $server) {
                return $find->execute($server);
            };
        }

        throw new UnexpectedValueException('mapReduce command did not return inline results or an output collection');
    }
1262734
public function toString($indent = null)
    {
        $helperManager = $this->getView()->getHelperPluginManager();
        if ($helperManager->has('dojo')) {
            $dojo = $helperManager->get('dojo');
            $dojo->initialize();
        }
        return parent::toString($indent);
    }
658218
public function indent( $indent = 4 )
    {
        $indent = $this->generateIndent( $indent );
        foreach( $this->lines as &$line ) {
            $line = $indent . $line;
        }
        return $this;
    }
1175617
private function generateIndent( $indent )
    {
        if( is_integer( $indent ) ) {
            $indent = str_repeat( $this->indentChar, $indent );
        } elseif( !is_string($indent) ) {
            throw new BadTypeException( $indent, 'int|string' );
        }
        return $indent;
    }
383913
private function partial($id, $indent, $level)
    {
        if ($indent !== '') {
            $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
        } else {
            $indentParam = '';
        }

        return sprintf(
            $this->prepare(self::PARTIAL, $level),
            var_export($id, true),
            $indentParam
        );
    }
673832
protected static function _export($var, $depth, $indent)
    {
        switch (static::getType($var)) {
            case 'boolean':
                return $var ? 'true' : 'false';
            case 'integer':
                return '(int) ' . $var;
            case 'float':
                return '(float) ' . $var;
            case 'string':
                if (trim($var) === '' && ctype_space($var) === false) {
                    return "''";
                }

                return "'" . $var . "'";
            case 'array':
                return static::_array($var, $depth - 1, $indent + 1);
            case 'resource':
                return strtolower(gettype($var));
            case 'null':
                return 'null';
            case 'unknown':
                return 'unknown';
            default:
                return static::_object($var, $depth - 1, $indent + 1);
        }
    }
42572
public function toString($indent = null)
    {
        $output = parent::toString($indent);
        $output = str_replace(
            ['<title>', '</title>'], ['<h1>', '</h1>'], $output
        );

        return $output;
    }
793500
private function buildGeneratedFieldGetter($field_name, $caster, $indent, array &$result)
    {
        $short_getter = null;

        switch ($caster) {
            case ValueCasterInterface::CAST_INT:
                $return_type = 'int';
                break;
            case ValueCasterInterface::CAST_FLOAT:
                $return_type = 'float';
                break;
            case ValueCasterInterface::CAST_BOOL:
                $return_type = 'bool';
                break;
            case ValueCasterInterface::CAST_DATE:
                $return_type = '\\' . DateValueInterface::class;
                break;
            case ValueCasterInterface::CAST_DATETIME:
                $return_type = '\\' . DateTimeValueInterface::class;
                break;
            case ValueCasterInterface::CAST_JSON:
                $return_type = 'mixed';
                break;
            default:
                $return_type = 'string';
        }

        if ($this->useShortGetterName($field_name)) {
            $short_getter = $this->getShortGetterName($field_name);

            $lines[] = '';
            $lines[] = '/**';
            $lines[] = ' * Return value of ' . $field_name . ' field.';
            $lines[] = ' *';
            $lines[] = ' * @return ' . $return_type;
            $lines[] = ' */';
            $lines[] = 'public function ' . $short_getter . '()';
            $lines[] = '{';
            $lines[] = '    return $this->getFieldValue(' . var_export($field_name, true) . ');';
            $lines[] = '}';
        }

        $lines[] = '';
        $lines[] = '/**';
        $lines[] = ' * Return value of ' . $field_name . ' field.';
        $lines[] = ' *';
        $lines[] = ' * @return ' . $return_type;

        if ($short_getter && $this->getStructure()->getConfig('deprecate_long_bool_field_getter')) {
            $lines[] = " * @deprecated use $short_getter()";
        }

        $lines[] = ' */';
        $lines[] = 'public function ' . $this->getGetterName($field_name) . '()';
        $lines[] = '{';
        $lines[] = '    return $this->getFieldValue(' . var_export($field_name, true) . ');';
        $lines[] = '}';
        $lines[] = '';

        foreach ($lines as $line) {
            $result[] = $line ? $indent . $line : '';
        }
    }
94791
protected function addIndent(string $string, int $indent = 0): string
    {
        return str_repeat(self::INDENT, max($indent, 0)) . $string;
    }
1128847
private function process(IdentResult &$result)
    {
        if (isset($result->person)) {
            foreach ($result->person as $p) {
                $attachments = $p->attachments;
                if (!empty($attachments)) {
                    foreach ($attachments as $attachment) {
                        $this->initMediaResource($attachment);
                    }
                }
            }
        }
    }
917342
public static function emit($input, $inline = 0, $indent = 0)
	{
		$output = '';
		$prefix = $indent ? \str_repeat(' ', $indent) : '';
        $dumpObjectAsInlineMap = true;

        if ($input instanceof \ArrayObject || $input instanceof \stdClass) {
            $dumpObjectAsInlineMap = empty((array) $input);
        }

        if ($inline <= 0 || (!\is_array($input) && $dumpObjectAsInlineMap) || empty($input)) {
			$output .= $prefix . self::dump($input);
		} else {
			$dumpAsMap = self::isHash($input);

			foreach ($input as $key => $value) {
				if ($inline >= 1 && \is_string($value) && false !== \strpos($value, "\n")) {
					$output .= \sprintf("%s%s%s |\n", $prefix, $dumpAsMap ? self::dump($key) . ':' : '-', '');

					foreach (\preg_split('/\n|\r\n/', $value) as $row) {
						$output .= \sprintf("%s%s%s\n", $prefix, \str_repeat(' ', self::$indentation), $row);
					}

					continue;
				}

                $dumpObjectAsInlineMap = true;

                if ($value instanceof \ArrayObject || $value instanceof \stdClass) {
                    $dumpObjectAsInlineMap = empty((array) $value);
                }

                $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);

				$output .= \sprintf('%s%s%s%s',
						$prefix,
						$dumpAsMap ? self::dump($key) . ':' : '-',
						$willBeInlined ? ' ' : "\n",
						self::emit($value, $inline - 1, $willBeInlined ? 0 : $indent + self::$indentation)
					) . ($willBeInlined ? "\n" : '');
			}
		}

		return $output;
	}
795060
public function getAsYaml($indent = 4)
    {
        $driver = new YamlDriver($this->toArray());

        return $driver->setIndent($indent)->getString();
    }
842746
protected function _makeResult(array $result) {
        return Result::make($result, $this->getClient())->setModelClass($this->_fullModelClassNamePattern());
    }
30115
private function indentFrom(Console\Input\InputInterface $input): ?Normalizer\Format\Indent
    {
        /** @var null|string $indentSize */
        $indentSize = $input->getOption('indent-size');

        /** @var null|string $indentStyle */
        $indentStyle = $input->getOption('indent-style');

        if (null === $indentSize && null === $indentStyle) {
            return null;
        }

        if (null === $indentSize) {
            throw new \RuntimeException('When using the indent-style option, an indent size needs to be specified using the indent-size option.');
        }

        if (null === $indentStyle) {
            throw new \RuntimeException(\sprintf(
                'When using the indent-size option, an indent style (one of "%s") needs to be specified using the indent-style option.',
                \implode('", "', \array_keys(self::$indentStyles))
            ));
        }

        if ((string) (int) $indentSize !== $indentSize || 1 > $indentSize) {
            throw new \RuntimeException(\sprintf(
                'Indent size needs to be an integer greater than 0, but "%s" is not.',
                $indentSize
            ));
        }

        try {
            $indent = Normalizer\Format\Indent::fromSizeAndStyle(
                (int) $indentSize,
                $indentStyle
            );
        } catch (Normalizer\Exception\InvalidIndentSizeException $exception) {
            throw new \RuntimeException(\sprintf(
                'Indent size needs to be an integer greater than %d, but "%s" is not.',
                $exception->minimumSize(),
                $exception->size()
            ));
        } catch (Normalizer\Exception\InvalidIndentStyleException $exception) {
            throw new \RuntimeException(\sprintf(
                'Indent style needs to be one of "%s", but "%s" is not.',
                \implode('", "', \array_keys(self::$indentStyles)),
                $indentStyle
            ));
        }

        return $indent;
    }
705088
public function createCredentials(Result $result)
    {
        if (!$result->hasKey('Credentials')) {
            throw new \InvalidArgumentException('Result contains no credentials');
        }

        $c = $result['Credentials'];

        return new Credentials(
            $c['AccessKeyId'],
            $c['SecretAccessKey'],
            isset($c['SessionToken']) ? $c['SessionToken'] : null,
            isset($c['Expiration']) && $c['Expiration'] instanceof \DateTimeInterface
                ? (int) $c['Expiration']->format('U')
                : null
        );
    }
905226
public function setIndent($indent)
    {
        if (!$this->isNumber($indent)) {
            throw new ConfigException(ConfigException::MSG_INVALID_ARG, [
                                                                          '$indent',
                                                                          'integer'
                                                                      ]
            );
        }
        $this->indent = $indent;

        return $this;
    }