Skip to content

Commit

Permalink
DOC: Added PHPDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Nery committed Apr 8, 2016
1 parent f23f5c1 commit aa3a2b4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/ArrayDebugger.php
Expand Up @@ -19,6 +19,14 @@ public function __construct() {
return call_user_func_array('parent::__construct', func_get_args());
}

/**
* Write log
*
* @param string $type
* @param string $key
* @param string $value
* @param array $backtrace
*/
public function sendLog($type, $key, $value = null, array $backtrace ) {

$logger = $this->logger;
Expand All @@ -30,28 +38,54 @@ public function sendLog($type, $key, $value = null, array $backtrace ) {
return $logger($retorno);
}

/**
* Defines logger
*
* @param \Closure $logger
*/
public function setLogger(\Closure $logger) {
$this->logger = $logger;
}

/**
* Called when getting a value from array
*
* @param mixed $name
*/
public function offsetGet($name) {

$this->sendLog(static::TYPE_GET, $name, null, debug_backtrace());
return call_user_func_array('parent::offsetGet', func_get_args());
}

/**
* Called when setting a value from array
*
* @param mixed $name
* @param mixed $value
*/
public function offsetSet($name, $value) {

$this->sendLog(static::TYPE_SET, $name, $value, debug_backtrace());
return call_user_func_array('parent::offsetSet', func_get_args());
}

/**
* Called when checking a value from array
*
* @param mixed $name
*/
public function offsetExists($name) {

$this->sendLog(static::TYPE_EXISTS, $name, null, debug_backtrace());
return call_user_func_array('parent::offsetExists', func_get_args());
}

/**
* Called when removing a value from array
*
* @param mixed $name
*/
public function offsetUnset($name) {

$this->sendLog(static::TYPE_UNSET, $name, null, debug_backtrace());
Expand Down

0 comments on commit aa3a2b4

Please sign in to comment.