for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Del\Booty;
class AssetManager
{
/** @var string[] $assetFolders */
private $assetFolders = [];
/** @var string $destinationFolder */
private $destinationFolder = '';
/** @var array $deployInfo */
private $deployInfo = [];
/**
* @return string
*/
public function addAssetsFolder(string $key, string $dir): void
$dir = realpath($dir);
if (is_dir($dir)) {
$this->assetFolders[$key] = $dir;
}
public function setDestinationFolder(string $dir): void
$this->destinationFolder = $dir;
* @return bool
public function deployAssets(): bool
foreach ($this->assetFolders as $key => $dir) {
$key = $this->camelCaseToDash($key);
symlink($dir, $this->destinationFolder . '/' . $key);
return true;
* @param string $key
private function camelCaseToDash(string $key): string
$newKey = '';
foreach (str_split($key) as $index => $letter) {
if (ctype_upper($letter)) {
$letter = strtolower($letter);
$letter = $index < 1 ? $letter : '-' . $letter;
$newKey .= $letter;
return $newKey;