PHP Класс Burgomaster, instantanalytics

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

Открытые свойства

Свойство Тип Описание
$projectRoot Root directory of the project
$stageDir Base staging directory of the project

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

Метод Описание
__construct ( string $stageDir, string $projectRoot = null )
__destruct ( ) Cleanup if the last section was not already closed.
createAutoloader ( array $files = [], string $filename = 'autoloader.php' ) Creates a class-map autoloader to the staging directory in a file named autoloader.php
createPhar ( string $dest, string | boolean | null $stub = null, string $autoloaderFilename = 'autoloader.php' ) Creates a phar that automatically registers an autoloader.
createZip ( string $dest ) Creates a zip file containing the staged files of your project.
debug ( string $message ) Prints a debug message to STDERR bound to the current section.
deepCopy ( string $from, string $to ) Copies a file and creates the destination directory if needed.
endSection ( ) Call this method when leaving the last pushed section of the packager.
exec ( string $command ) : string Execute a command and throw an exception if the return code is not 0.
recursiveCopy ( string $sourceDir, string $destDir, array $extensions = ['php'] ) Recursively copy one folder to another.
startSection ( string $section ) Call this method when starting a specific section of the packager.

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

Метод Описание
createDirIfNeeded ( $dir )
createStub ( $dest, string $autoloaderFilename = 'autoloader.php' ) : string Creates a default stub for the phar that includeds the generated autoloader.

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

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

public __construct ( string $stageDir, string $projectRoot = null )
$stageDir string Staging base directory where your packaging takes place. This folder will be created for you if it does not exist. If it exists, it will be deleted and recreated to start fresh.
$projectRoot string Root directory of the project.

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

Cleanup if the last section was not already closed.
public __destruct ( )

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

Creates a class-map autoloader to the staging directory in a file named autoloader.php
public createAutoloader ( array $files = [], string $filename = 'autoloader.php' )
$files array Files to explicitly require in the autoloader. This is similar to Composer's "files" "autoload" section.
$filename string Name of the autoloader file.

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

Call this only after your staging directory is built.
public createPhar ( string $dest, string | boolean | null $stub = null, string $autoloaderFilename = 'autoloader.php' )
$dest string Where to save the file. The basename of the file is also used as the alias name in the phar (e.g., /path/to/guzzle.phar => guzzle.phar).
$stub string | boolean | null The path to the phar stub file. Pass or leave null to automatically have one created for you. Pass false to no use a stub in the generated phar.
$autoloaderFilename string Name of the autolaoder filename.

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

Call this only after your staging directory is built.
public createZip ( string $dest )
$dest string Where to save the zip file

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

Prints a debug message to STDERR bound to the current section.
public debug ( string $message )
$message string Message to echo to STDERR

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

Copies a file and creates the destination directory if needed.
public deepCopy ( string $from, string $to )
$from string File to copy
$to string Destination to copy the file to, relative to the base staging directory.

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

Call this method when leaving the last pushed section of the packager.
public endSection ( )

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

Execute a command and throw an exception if the return code is not 0.
public exec ( string $command ) : string
$command string Command to execute
Результат string Returns the output of the command as a string

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

Any LICENSE file is automatically copied.
public recursiveCopy ( string $sourceDir, string $destDir, array $extensions = ['php'] )
$sourceDir string Source directory to copy from
$destDir string Directory to copy the files to that is relative to the the stage base directory.
$extensions array File extensions to copy from the $sourceDir. Defaults to "php" files only (e.g., ['php']).

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

This makes the debug messages used in your script more meaningful and adds context when things go wrong. Be sure to call endSection() when you have finished a section of your packaging script.
public startSection ( string $section )
$section string Part of the packager that is running

Описание свойств

$projectRoot публичное свойство

Root directory of the project
public $projectRoot

$stageDir публичное свойство

Base staging directory of the project
public $stageDir