Dumps feature example.

@param string  $keyword Item keyword
@param Boolean $short   Dump short version?

@return string
973825
protected function dumpFeature($keyword, $short = true, $excludeAsterisk = false)
    {
        $dump = <<<GHERKIN
{$keyword}: Internal operations
  In order to stay secret
  As a secret organization
  We need to be able to erase past agents' memory


GHERKIN;

        // Background
        $keywords = explode('|', $this->keywords->getBackgroundKeywords());
        if ($short) {
            $keywords = call_user_func($this->keywordsDumper, $keywords, $short);
            $dump .= $this->dumpBackground($keywords, $short, $excludeAsterisk);
        } else {
            $keyword = call_user_func($this->keywordsDumper, array($keywords[0]), $short);
            $dump .= $this->dumpBackground($keyword, $short, $excludeAsterisk);
        }

        // Scenario
        $keywords = explode('|', $this->keywords->getScenarioKeywords());
        if ($short) {
            $keywords = call_user_func($this->keywordsDumper, $keywords, $short);
            $dump .= $this->dumpScenario($keywords, $short, $excludeAsterisk);
        } else {
            foreach ($keywords as $keyword) {
                $keyword = call_user_func($this->keywordsDumper, array($keyword), $short);
                $dump .= $this->dumpScenario($keyword, $short, $excludeAsterisk);
            }
        }

        // Outline
        $keywords = explode('|', $this->keywords->getOutlineKeywords());
        if ($short) {
            $keywords = call_user_func($this->keywordsDumper, $keywords, $short);
            $dump .= $this->dumpOutline($keywords, $short, $excludeAsterisk);
        } else {
            foreach ($keywords as $keyword) {
                $keyword = call_user_func($this->keywordsDumper, array($keyword), $short);
                $dump .= $this->dumpOutline($keyword, $short, $excludeAsterisk);
            }
        }

        return $dump;
    }
1168515
public static function getClassName($extension, $shortName) {
        $url = _url('index', $shortName, $extension);
        return self::getClassNameByUrl($url);
    }
707233
public function _shortcode( $attributes ) {
		if ( ! isset( $attributes['post_id'] ) ) {
			return;
		}

		$title = wp_strip_all_tags( get_the_title( $attributes['post_id'] ) . ' - ' . get_bloginfo( 'name' ) );

		$attributes = shortcode_atts(
			[
				'type'     => 'balloon',
				'title'    => apply_filters( 'inc2734_wp_share_buttons_shared_title', $title, 'copy' ),
				'post_id'  => '',
				'hashtags' => apply_filters( 'inc2734_wp_share_buttons_shared_hashtags', '', 'copy' ),
			],
			$attributes
		);

		return $this->render(
			'copy/copy',
			[
				'type'     => $attributes['type'],
				'title'    => $attributes['title'],
				'post_id'  => $attributes['post_id'],
				'hashtags' => $attributes['hashtags'],
			]
		);
	}
175829
public function _shortcode( $attributes ) {
		if ( ! isset( $attributes['post_id'] ) ) {
			return;
		}

		$attributes = shortcode_atts(
			[
				'type'    => 'balloon',
				'post_id' => '',
			],
			$attributes
		);

		if ( 'official' === $attributes['type'] ) {
			$file = 'official';
		} else {
			$file = 'pinterest';
		}

		return $this->render(
			'pinterest/' . $file,
			[
				'type'    => $attributes['type'],
				'post_id' => $attributes['post_id'],
			]
		);
	}
337297
public static function replacePhpReservedKeyword($keyword, $context = null)
    {
        if (PhpReservedKeyword::instance()->is($keyword)) {
            if ($context !== null) {
                $keywordKey = $keyword . '_' . $context;
                if (!array_key_exists($keywordKey, self::$replacedPhpReservedKeywords)) {
                    self::$replacedPhpReservedKeywords[$keywordKey] = 0;
                } else {
                    self::$replacedPhpReservedKeywords[$keywordKey]++;
                }
                return '_' . $keyword . (self::$replacedPhpReservedKeywords[$keywordKey] ? '_' . self::$replacedPhpReservedKeywords[$keywordKey] : '');
            } else {
                return '_' . $keyword;
            }
        } else {
            return $keyword;
        }
    }
540962
public static function __($short, $chunks){
		$translated = self::_($short);
		foreach($chunks as $k=>$v){
			$translated = str_replace('%'.$k.'%', $v, $translated);
			}
		return $translated;
		}
323941
public function search($keyword = "")
    {
        Yii::trace("Begin searching...", __METHOD__);
        $matches = $this->match($keyword);
        $results = [];
        foreach ($matches as $extension) {
            $results[$extension->extension->id()] = $extension->extension->search($keyword);
        }
        return $results;
    }
395032
public function outputHelp($short = false)
    {
        echo "Usage: " . $this->getName() . " ";
        if (!empty($this->params)) {
            foreach ($this->params as $param) {
                if ($param['required'] == true) {
                    echo '<' . $param['name'] . '> ';
                } else {
                    echo '[' . $param['name'] . '] ';
                }
            }
        }
        echo "[options]";

        if (!$short) {
            echo PHP_EOL . PHP_EOL;

            if (!empty($this->params)) {
                echo "Parameters:" . PHP_EOL;
                foreach ($this->params as $param) {
                    echo "\t" . $param['help'] . PHP_EOL;
                }
                echo PHP_EOL;
            }

            echo "Options:" . PHP_EOL;
            foreach ($this->options as $option) {
                $output = "\t" . $option['help'];
                if (array_key_exists('required', $option) && $option['required'] == true) {
                    $output .= " [required]";
                }
                $output .= PHP_EOL;
                echo $output;
            }
            echo "\t" . $this->helpOption . PHP_EOL;
        } else {
            echo PHP_EOL;
        }
    }
505071
public function short(): string
    {
        if ($this->isPrimitive()) {
            return (string) $this->phpType;
        }

        return (string) $this->className->short();
    }
730958
public function buildTrigrams($keyword)
    {
        $t        = "__".$keyword."__";
        $trigrams = "";
        for ($i = 0; $i < strlen($t) - 2; $i++) {
            $trigrams .= mb_substr($t, $i, 3)." ";
        }

        return trim($trigrams);
    }
1170433
public function keyword($keyword)
    {
        $list = $this->keywordList($keyword);
        if (empty($list)) {
            throw new RuntimeException(sprintf('Keyword "%s" does not exist.', $keyword));
        }

        return $list[0];
    }
1369852
public function setShort($short)
    {
        $short = (string) $short;
        $this->short = function_exists('mb_substr')
            ? mb_substr($short, 0, 1)
            : substr($short, 0, 1)
        ;
        return $this;
    }
127544
protected static function _doShortcode($m)
    {
        // allow {{foo}} syntax for escaping a tag
        if ($m[1] == '{' && $m[6] == '}') {
            return substr($m[0], 1, -1);
        }

        $tag = $m[2];
        $atts = static::_parseAttributes($m[3]);
        $listeners = EventDispatcher::instance('Shortcode')
            ->eventManager()
            ->listeners($tag);

        if (!empty($listeners)) {
            $options = [
                'atts' => (array)$atts,
                'content' => null,
                'tag' => $tag
            ];

            if (isset($m[5])) {
                $options['content'] = $m[5];
            }

            $result = EventDispatcher::instance('Shortcode')
                ->triggerArray([$tag, static::cache('context')], $options)
                ->result;

            return $m[1] . $result . $m[6];
        }

        return '';
    }
750122
function toString( $short = false )
    {
        if ( $short )
            $str = $this->Locale->formatShortTime( $this->timeStamp() );
        else
            $str = $this->Locale->formatTime( $this->timeStamp() );
        return $str;
    }
447861
protected function dumpClass($namespace, $shortClassName, array $serviceDefinitions)
    {
        $joinedServiceDefinitions = implode("\n", $serviceDefinitions);

        $namespaceSource = $namespace !== '' ? "namespace $namespace;\n\n" : '';
        $classSource = <<<EOL
class $shortClassName implements \Pimple\ServiceProviderInterface
{
    public function register(\Pimple\Container \$c)
    {
$joinedServiceDefinitions
    }
}
EOL;

        return $namespaceSource . $classSource;
    }
717811
public function getSynopsis($short = false)
    {
        $key = $short ? 'short' : 'long';

        if (!isset($this->synopsis[$key])) {
            $this->synopsis[$key] = trim(sprintf(
                '%s %s',
                $_SERVER['PHP_SELF'],
                $this->getDefinition()->getSynopsis($short)
            ));
        }

        return $this->synopsis[$key];
    }
1047383
public static function convertShortFormType(?string $shortType): ?string
    {
        $mapping = [
            'choice' => ChoiceType::class,
            'string' => TextType::class,
            'entity' => EntityType::class,
            'date' => DateType::class,
            'datetime' => DateType::class,
            'text' => TextareaType::class,
            'number' => NumberType::class,
            'float' => NumberType::class,
            'integer' => IntegerType::class,
            'smallint' => IntegerType::class,
            'boolean' => CheckboxType::class,
            'bigint' => NumberType::class,
            'decimal' => NumberType::class,
            'guid' => TextType::class,
            'array' => TextareaType::class,
            'simple_array' => TextareaType::class,
            'json_array' => TextareaType::class,
        ];
        $type = $shortType;

        if (key_exists($shortType, $mapping)) {
            $type = $mapping[$shortType];
        }

        return $type;
    }