PHP Класс spoon2twig

Устаревший:
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( )
comma ( string $input ) : string
convertAllFiles ( boolean $force, array $path, string | null $input = null ) Project file converter Will locate ever file in the project and convert in automagicly
dePluralize ( string $noun ) : string Converts a noun until it's ready
displayErrors ( ) Displays all Errors or notices
error ( string $message ) Error or notice collector
fromCamelToSnake ( string $input ) : string
getCorrectSourceVersion ( ) : string Get Correct version looks a the project version to find and return it's source directory
getFile ( string $input ) : string Return the file content of a given file
isFile ( string $file ) : boolean File checker
pregReplaceIterations ( string $fileData ) : string Iteration Converter
pregReplaceSprintf ( string $regex, string $format, string $fileData, $extra = null ) : string preg_replace sprint_f Combines 2 function into one that's more ideal for parsing as it string replaces any found matches with a new given value
ruleParser ( string $fileData ) : string The actual conversion
start ( array $arguments ) Start Converter
timestamp ( integer $int = null ) : float Stamps the time it takes from start to finnish
write ( string $input, string $fileData ) Write saves to content to a new file

Приватные методы

Метод Описание
buildFiles ( array $templatePaths, boolean $force = false ) Builds new Files from a paths array
findFiles ( string $basePath, array $path, string $input = null ) : array Find files in given paths
findThemeFiles ( string $basePath, array $path, string $theme ) : array

Описание методов

__construct() публичный Метод

public __construct ( )

comma() публичный Метод

public comma ( string $input ) : string
$input string
Результат string

convertAllFiles() публичный Метод

Project file converter Will locate ever file in the project and convert in automagicly
public convertAllFiles ( boolean $force, array $path, string | null $input = null )
$force boolean allow forced overwrite
$path array
$input string | null

dePluralize() публичный Метод

Converts a noun until it's ready
public dePluralize ( string $noun ) : string
$noun string a noun
Результат string converted noun

displayErrors() публичный Метод

Displays all Errors or notices
public displayErrors ( )

error() публичный Метод

Error or notice collector
public error ( string $message )
$message string

fromCamelToSnake() публичный Метод

public fromCamelToSnake ( string $input ) : string
$input string
Результат string

getCorrectSourceVersion() публичный Метод

Get Correct version looks a the project version to find and return it's source directory
public getCorrectSourceVersion ( ) : string
Результат string returns the correct source dir

getFile() публичный Метод

Return the file content of a given file
public getFile ( string $input ) : string
$input string file full path
Результат string file content

isFile() публичный Метод

File checker
public isFile ( string $file ) : boolean
$file string file full path
Результат boolean

pregReplaceIterations() публичный Метод

Iteration Converter
public pregReplaceIterations ( string $fileData ) : string
$fileData string file to convert
Результат string file in converted form

pregReplaceSprintf() публичный Метод

preg_replace sprint_f Combines 2 function into one that's more ideal for parsing as it string replaces any found matches with a new given value
public pregReplaceSprintf ( string $regex, string $format, string $fileData, $extra = null ) : string
$regex string the regex
$format string the replace value
$fileData string file content
Результат string if successful returns file content with replaced data

ruleParser() публичный Метод

The actual conversion
public ruleParser ( string $fileData ) : string
$fileData string
Результат string

start() публичный Метод

Start Converter
public start ( array $arguments )
$arguments array A list of arguments from php command line

timestamp() публичный Метод

Stamps the time it takes from start to finnish
public timestamp ( integer $int = null ) : float
$int integer how precise you wish to measure
Результат float

write() публичный Метод

Write saves to content to a new file
public write ( string $input, string $fileData )
$input string file full path
$fileData string file content