| @@ 427-455 (lines=29) @@ | ||
| 424 | * |
|
| 425 | * @return mixed|null The, almost formatted, value |
|
| 426 | */ |
|
| 427 | protected function getValue($name, $default = null, callable $callback = null) |
|
| 428 | { |
|
| 429 | ||
| 430 | // initialize the value |
|
| 431 | $value = null; |
|
| 432 | ||
| 433 | // query whether or not the header is available |
|
| 434 | if ($this->hasHeader($name)) { |
|
| 435 | // load the header value |
|
| 436 | $headerValue = $this->getHeader($name); |
|
| 437 | // query wheter or not, the value with the requested key is available |
|
| 438 | if ((isset($this->row[$headerValue]) && $this->row[$headerValue] != '')) { |
|
| 439 | $value = $this->row[$headerValue]; |
|
| 440 | } |
|
| 441 | } |
|
| 442 | ||
| 443 | // query whether or not, a callback has been passed |
|
| 444 | if ($value != null && is_callable($callback)) { |
|
| 445 | $value = call_user_func($callback, $value); |
|
| 446 | } |
|
| 447 | ||
| 448 | // query whether or not |
|
| 449 | if ($value == null && $default !== null) { |
|
| 450 | $value = $default; |
|
| 451 | } |
|
| 452 | ||
| 453 | // return the value |
|
| 454 | return $value; |
|
| 455 | } |
|
| 456 | ||
| 457 | /** |
|
| 458 | * Return's the Magento configuration value. |
|
| @@ 381-409 (lines=29) @@ | ||
| 378 | * |
|
| 379 | * @return mixed|null The, almost formatted, value |
|
| 380 | */ |
|
| 381 | public function getValue($name, $default = null, callable $callback = null) |
|
| 382 | { |
|
| 383 | ||
| 384 | // initialize the value |
|
| 385 | $value = null; |
|
| 386 | ||
| 387 | // query whether or not the header is available |
|
| 388 | if ($this->hasHeader($name)) { |
|
| 389 | // load the header value |
|
| 390 | $headerValue = $this->getHeader($name); |
|
| 391 | // query wheter or not, the value with the requested key is available |
|
| 392 | if ((isset($this->row[$headerValue]) && $this->row[$headerValue] != '')) { |
|
| 393 | $value = $this->row[$headerValue]; |
|
| 394 | } |
|
| 395 | } |
|
| 396 | ||
| 397 | // query whether or not, a callback has been passed |
|
| 398 | if ($value != null && is_callable($callback)) { |
|
| 399 | $value = call_user_func($callback, $value); |
|
| 400 | } |
|
| 401 | ||
| 402 | // query whether or not |
|
| 403 | if ($value == null && $default !== null) { |
|
| 404 | $value = $default; |
|
| 405 | } |
|
| 406 | ||
| 407 | // return the value |
|
| 408 | return $value; |
|
| 409 | } |
|
| 410 | ||
| 411 | /** |
|
| 412 | * Tries to format the passed value to a valid date with format 'Y-m-d H:i:s'. |
|