Skip to content

Commit

Permalink
minor refactor, and add docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul M. Jones committed Jan 27, 2016
1 parent cca2559 commit b717bf9
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/Spec/Spec.php
Expand Up @@ -319,24 +319,38 @@ protected function init($args)
*/
protected function getDefaultMessage()
{
$message = $this->rule;
if (! $this->args) {
return $message;
};

$message .= $this->argsToString($this->args);
return $message;
return $this->rule . $this->argsToString();
}

protected function argsToString($args)
/**
*
* Converts the args to a string.
*
* @return string
*
*/
protected function argsToString()
{
if (! $this->args) {
return '';
}

$vals = array();
foreach ($args as $arg) {
foreach ($this->args as $arg) {
$vals[] = $this->argToString($arg);
}
return '(' . implode(', ', $vals) . ')';
}

/**
*
* Converts one arg to a string.
*
* @param mixed $arg The arg.
*
* @return string
*
*/
protected function argToString($arg)
{
switch (true) {
Expand Down

0 comments on commit b717bf9

Please sign in to comment.