Skip to content

Commit

Permalink
Apply formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brnskn authored and actions-user committed Nov 9, 2020
1 parent 96d01a6 commit fe6c2a2
Show file tree
Hide file tree
Showing 13 changed files with 372 additions and 374 deletions.
68 changes: 34 additions & 34 deletions src/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@
class Formatter
{
/**
* Text string
*
* @var string
*/
* Text string
*
* @var string
*/
private $text;

/**
* Text attributes
*
* @var array
*/
* Text attributes
*
* @var array
*/
private $attributes;

/**
* Initialize class.
*
* @param string $text
* @param array $attributes
* @return void
*/
* Initialize class.
*
* @param string $text
* @param array $attributes
* @return void
*/
public function __construct(string $text, array $attributes = [])
{
$this->text = $text;
$this->attributes = $attributes;
}

/**
* Process formatter.
*
* @return string
*/
* Process formatter.
*
* @return string
*/
public function process()
{
foreach ($this->attributes as $attribute => $value) {
Expand All @@ -54,11 +54,11 @@ public function process()
}

/**
* Clean attributes without quotes.
*
* @param string $value
* @return string
*/
* Clean attributes without quotes.
*
* @param string $value
* @return string
*/
private function cleanWithoutQuotes($value)
{
return preg_replace(
Expand All @@ -69,23 +69,23 @@ private function cleanWithoutQuotes($value)
}

/**
* Clean attributes.
*
* @param string $value
* @return string
*/
* Clean attributes.
*
* @param string $value
* @return string
*/
private function clean($value)
{
return escapeshellcmd(escapeshellarg($value));
}

/**
* Handle static call
*
* @param string $text
* @param array $attributes
* @return self
*/
* Handle static call
*
* @param string $text
* @param array $attributes
* @return self
*/
public static function run(string $text, array $attributes = [])
{
return (new self($text, $attributes))->process();
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ function validate($rules)
abort($errors->first(), 400);
}
}
}
}
120 changes: 60 additions & 60 deletions src/OS/Distro.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,55 @@
class Distro
{
/**
* Options came from chain methods
*
* @var array
*/
* Options came from chain methods
*
* @var array
*/
private $options = [];

/**
* Default option
*
* @var mixed
*/
* Default option
*
* @var mixed
*/
private $default = false;

/**
* Current instance
*
* @var Distro
*/
* Current instance
*
* @var Distro
*/
private static $instance = null;

/**
* Current DistroInfo instance
*
* @var DistroInfo
*/
* Current DistroInfo instance
*
* @var DistroInfo
*/
private static $distroInfo = null;

/**
* Current engine
*
* @var ICommandEngine
*/
* Current engine
*
* @var ICommandEngine
*/
private static $currentEngine = null;

/**
* Call getDistro function when it's initialized.
*
* @return void
*/
* Call getDistro function when it's initialized.
*
* @return void
*/
public function __construct()
{
self::getDistro();
}

/**
* Check if not exist current static distro info and engine, then load them.
*
* @return DistroInfo
*/
* Check if not exist current static distro info and engine, then load them.
*
* @return DistroInfo
*/
public static function getDistro()
{
if (
Expand All @@ -68,10 +68,10 @@ public static function getDistro()
}

/**
* Get suitable option according to current distro info.
*
* @return mixed
*/
* Get suitable option according to current distro info.
*
* @return mixed
*/
public function get()
{
$distro = self::getDistro();
Expand All @@ -88,11 +88,11 @@ public function get()
}

/**
* Run suitable option as a command.
*
* @param array $attributes
* @return string
*/
* Run suitable option as a command.
*
* @param array $attributes
* @return string
*/
public function run($attributes = [])
{
$result = $this->get();
Expand All @@ -103,11 +103,11 @@ public function run($attributes = [])
}

/**
* Run suitable option as a command as root.
*
* @param array $attributes
* @return string
*/
* Run suitable option as a command as root.
*
* @param array $attributes
* @return string
*/
public function runSudo($attributes = [])
{
$result = $this->get();
Expand All @@ -118,40 +118,40 @@ public function runSudo($attributes = [])
}

/**
* Set default option.
*
* @param mixed $default
* @return mixed
*/
* Set default option.
*
* @param mixed $default
* @return mixed
*/
public function default($default)
{
$this->default = $default;
return $this;
}

/**
* Add chained methods as option.
*
* @param string $method
* @param array $parameters
* @return self
*/
* Add chained methods as option.
*
* @param string $method
* @param array $parameters
* @return self
*/
public function __call($method, $parameters)
{
$this->options[$method] = $parameters[0];
return $this;
}

/**
* Handle statically callings.
*
* Handle statically callings.
*
* @param string $method
* @param array $parameters
* @return self
*/
* @param array $parameters
* @return self
*/
public static function __callStatic($method, $parameters)
{
if(self::$instance !== null){
if (self::$instance !== null) {
self::$instance = new self();
}
return self::$instance->$method(...$parameters);
Expand Down
Loading

0 comments on commit fe6c2a2

Please sign in to comment.