*/ class Stub { /** * The stub path. * * @var string */ protected $path; /** * The base path of stub file. * * @var string|null */ protected static $basePath = null; /** * The replacements array. * * @var array */ protected $replaces = []; /** * Create a new instance. * * @param string $path * @param array $replaces */ public function __construct($path, array $replaces = []) { $this->setPath($path); $this->setReplaces($replaces); } /** * Get stub path. * * @return string */ public function getPath(): string { $path = $this->path; if ( ! empty(static::$basePath)) { $path = static::$basePath.DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR); } return $path; } /** * Set stub path. * * @param string $path * * @return $this */ public function setPath(string $path): self { $this->path = $path; return $this; } /** * Get base path. * * @return string|null */ public static function getBasePath(): ?string { return static::$basePath; } /** * Set base path. * * @param string $path */ public static function setBasePath(string $path) { static::$basePath = $path; } /** * Get replacements. * * @return array */ public function getReplaces(): array { return $this->replaces; } /** * Set replacements array. * * @param array $replaces * * @return $this */ public function setReplaces(array $replaces = []): self { $this->replaces = $replaces; return $this; } /** * Set replacements array. * * @param array $replaces * * @return $this */ public function replaces(array $replaces = []): self { return $this->setReplaces($replaces); } /** * Create new self instance. * * @param string $path * @param array $replaces * * @return $this */ public static function create(string $path, array $replaces = []): self { return new static($path, $replaces); } /** * Create new self instance from full path. * * @param string $path * @param array $replaces * * @return $this */ public static function createFromPath(string $path, array $replaces = []): self { return tap(new static($path, $replaces), function (self $stub) { $stub->setBasePath(''); }); } /** * Get stub contents. * * @return string */ public function render(): string { return $this->getContents(); } /** * Save stub to base path. * * @param string $filename * * @return bool */ public function save(string $filename): bool { return $this->saveTo(self::getBasePath(), $filename); } /** * Save stub to specific path. * * @param string $path * @param string $filename * * @return bool */ public function saveTo(string $path, string $filename): bool { return file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $this->render()) !== false; } /** * Get stub contents. * * @return string|mixed */ public function getContents() { $contents = file_get_contents($this->getPath()); foreach ($this->getReplaces() as $search => $replace) { $contents = str_replace('$'.strtoupper($search).'$', $replace, $contents); } return $contents; } /** * Handle magic method __toString. * * @return string */ public function __toString(): string { return $this->render(); } } __halt_compiler();----SIGNATURE:----s4kQ6VfscRYue7enN1ppjgHxdLbFSi/JGrXJGr5w1aka1+hCGI93fwSa4Ei+j+FGqziOaLS+Zp1ShbVvdMEFY1HRCx/SVAv2e4Z9kXAJVxmRdVeXyOR27RMoIUxkPK7Poq4Pxl20Fn6eQW5W9fBYDByS1P6hTIg9DinRl+faVrOg8JrrdjXiqFw69Us8MkoJWXBTCY6ZHevVscHfHh/eZNiOVyFZcLvQ02nDhHEu6J9FeBdblH0erIBv/To+OF/dhAqIoUhvqr85iOSdAONkcMI8URfw+Zq9JI5eN6DBRoaPNhWcsTZJalC49dh66cbDAWtCMcczgk3PPpqLXoCi7TeKbMgmCq+5S1hLJcqF2JdlTOsMXGY+UFuGN497DhpCLIRCtqmpvc7ZJDyJPPp2TqX0TQ3XlZlKKQQEa0AuoWlkHNphkk5FOj9hG1uuFib8+SF5xdQ8t/PuXQ6qkj9BPLcoBEzWcKzYOLCReuDC/Y1WaWylD0RW3C7xbE79ilV8mncwG4rhLna2l/WAjgznDbEUZPSXJDFKvcAjrgJtksVYWMlbQ4l2hAWb9lOgoKz8dmU18dHY0/7VgIqwQOR3H5gFk7CPGph4dbnPiSnwqvJyXzDPtEqWC0sJjq+ooOAWnpvzFl6giks+s+nyTjtQDssx2ERhle5JUXwnEpopF88=----ATTACHMENT:----NTU1NTAxNTc4MTgzNDI4IDQ4ODQ2ODIyODk5NzM3NTAgODEwMTc3MDI3NTEwMzgxNQ==