Skip to content

Commit

Permalink
Update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
e-oz committed Oct 27, 2014
1 parent 68bf942 commit 35a2aea
Show file tree
Hide file tree
Showing 8 changed files with 842 additions and 883 deletions.
211 changes: 104 additions & 107 deletions Assertion.php
Expand Up @@ -3,111 +3,108 @@

class Assertion
{
protected $expected_result;
protected $actual_result;
protected $commentary;
protected $name;
protected $successful = true;
protected $debug_line;
protected $debug_file;
protected $debug_method;
protected $debug_trace_level = 4;

public function __construct($name = '')
{
$this->parseDebugInfo();
if (empty($name))
{
$name = $this->debug_method;
}
$this->name = $name;
}

public function setActualResult($actual_result)
{
$this->actual_result = $actual_result;
}

public function getActualResult()
{
return $this->actual_result;
}

public function addCommentary($commentary)
{
if (!is_scalar($commentary))
{
$commentary = print_r($commentary, 1);
}
if (!empty($this->commentary))
{
$this->commentary .= PHP_EOL;
}
$this->commentary .= $commentary;
return $this;
}

public function getCommentary()
{
return $this->commentary;
}

public function setExpectedResult($expected_result)
{
$this->expected_result = $expected_result;
}

public function getExpectedResult()
{
return $this->expected_result;
}

public function setName($name)
{
$this->name = $name;
}

public function getName()
{
return $this->name;
}

private function parseDebugInfo()
{
$level = $this->debug_trace_level;
$debug_info = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
$this->debug_line = $debug_info[$level]['line'];
$this->debug_method = $debug_info[$level]['function'];
$this->debug_file = $debug_info[$level]['file'];
}

public function getDebugFile()
{
return $this->debug_file;
}

public function getDebugLine()
{
return $this->debug_line;
}

public function getDebugMethod()
{
return $this->debug_method;
}

public function Assert($successful = true)
{
$this->successful = $successful;
}

public function isSuccessful()
{
return $this->successful;
}

public function setDebugTraceLevel($debug_trace_level)
{
$this->debug_trace_level = $debug_trace_level;
}
protected $expected_result;
protected $actual_result;
protected $commentary;
protected $name;
protected $successful = true;
protected $debug_line;
protected $debug_file;
protected $debug_method;
protected $debug_trace_level = 4;

public function __construct($name = '')
{
$this->parseDebugInfo();
if (empty($name)) {
$name = $this->debug_method;
}
$this->name = $name;
}

public function getActualResult()
{
return $this->actual_result;
}

public function setActualResult($actual_result)
{
$this->actual_result = $actual_result;
}

public function addCommentary($commentary)
{
if (!is_scalar($commentary)) {
$commentary = print_r($commentary, 1);
}
if (!empty($this->commentary)) {
$this->commentary .= PHP_EOL;
}
$this->commentary .= $commentary;
return $this;
}

public function getCommentary()
{
return $this->commentary;
}

public function getExpectedResult()
{
return $this->expected_result;
}

public function setExpectedResult($expected_result)
{
$this->expected_result = $expected_result;
}

public function getName()
{
return $this->name;
}

public function setName($name)
{
$this->name = $name;
}

public function getDebugFile()
{
return $this->debug_file;
}

public function getDebugLine()
{
return $this->debug_line;
}

public function getDebugMethod()
{
return $this->debug_method;
}

public function Assert($successful = true)
{
$this->successful = $successful;
}

public function isSuccessful()
{
return $this->successful;
}

public function setDebugTraceLevel($debug_trace_level)
{
$this->debug_trace_level = $debug_trace_level;
}

private function parseDebugInfo()
{
$level = $this->debug_trace_level;
$debug_info = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
$this->debug_line = $debug_info[$level]['line'];
$this->debug_method = $debug_info[$level]['function'];
$this->debug_file = $debug_info[$level]['file'];
}
}

0 comments on commit 35a2aea

Please sign in to comment.