| @@ 380-408 (lines=29) @@ | ||
| 377 | * |
|
| 378 | * @return mixed|null The, almost formatted, value |
|
| 379 | */ |
|
| 380 | public function getValue($name, $default = null, callable $callback = null) |
|
| 381 | { |
|
| 382 | ||
| 383 | // initialize the value |
|
| 384 | $value = null; |
|
| 385 | ||
| 386 | // query whether or not the header is available |
|
| 387 | if ($this->hasHeader($name)) { |
|
| 388 | // load the header value |
|
| 389 | $headerValue = $this->getHeader($name); |
|
| 390 | // query wheter or not, the value with the requested key is available |
|
| 391 | if ((isset($this->row[$headerValue]) && $this->row[$headerValue] != '')) { |
|
| 392 | $value = $this->row[$headerValue]; |
|
| 393 | } |
|
| 394 | } |
|
| 395 | ||
| 396 | // query whether or not, a callback has been passed |
|
| 397 | if ($value != null && is_callable($callback)) { |
|
| 398 | $value = call_user_func($callback, $value); |
|
| 399 | } |
|
| 400 | ||
| 401 | // query whether or not |
|
| 402 | if ($value == null && $default !== null) { |
|
| 403 | $value = $default; |
|
| 404 | } |
|
| 405 | ||
| 406 | // return the value |
|
| 407 | return $value; |
|
| 408 | } |
|
| 409 | ||
| 410 | /** |
|
| 411 | * Tries to format the passed value to a valid date with format 'Y-m-d H:i:s'. |
|
| @@ 463-491 (lines=29) @@ | ||
| 460 | * |
|
| 461 | * @return mixed|null The, almost formatted, value |
|
| 462 | */ |
|
| 463 | protected function getValue($name, $default = null, callable $callback = null) |
|
| 464 | { |
|
| 465 | ||
| 466 | // initialize the value |
|
| 467 | $value = null; |
|
| 468 | ||
| 469 | // query whether or not the header is available |
|
| 470 | if ($this->hasHeader($name)) { |
|
| 471 | // load the header value |
|
| 472 | $headerValue = $this->getHeader($name); |
|
| 473 | // query wheter or not, the value with the requested key is available |
|
| 474 | if ((isset($this->row[$headerValue]) && $this->row[$headerValue] != '')) { |
|
| 475 | $value = $this->row[$headerValue]; |
|
| 476 | } |
|
| 477 | } |
|
| 478 | ||
| 479 | // query whether or not, a callback has been passed |
|
| 480 | if ($value != null && is_callable($callback)) { |
|
| 481 | $value = call_user_func($callback, $value); |
|
| 482 | } |
|
| 483 | ||
| 484 | // query whether or not |
|
| 485 | if ($value == null && $default !== null) { |
|
| 486 | $value = $default; |
|
| 487 | } |
|
| 488 | ||
| 489 | // return the value |
|
| 490 | return $value; |
|
| 491 | } |
|
| 492 | ||
| 493 | /** |
|
| 494 | * Return's the Magento configuration value. |
|