Skip to content

Commit

Permalink
deprecate Get\getValue() and Get\getValueOrFail() use instead Get\val…
Browse files Browse the repository at this point in the history
…ue() and Get\valueOrFail() respectively
  • Loading branch information
schnittstabil committed May 26, 2017
1 parent ec09ea5 commit d6deace
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 140 deletions.
50 changes: 16 additions & 34 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@

namespace Schnittstabil\Get;

if (!function_exists('Schnittstabil\Get\getValue')) {
/**
* Return array values and object properties.
*
* @param string|int|mixed[] $path the path
* @param object|array|null $target the target
* @param mixed $default default value if $path is not valid
*
* @return mixed the value determined by `$path` or otherwise `$default`
*
* @SuppressWarnings(PHPMD.StaticAccess)
*/
function getValue($path, $target, $default = null)
{
return Get::value($path, $target, $default);
}
}

if (!function_exists('Schnittstabil\Get\value')) {
/**
* Return array values and object properties.
Expand All @@ -38,7 +20,7 @@ function value($path, $target, $default = null)
}
}

if (!function_exists('Schnittstabil\Get\getValueOrFail')) {
if (!function_exists('Schnittstabil\Get\valueOrFail')) {
/**
* Return array values and object properties.
*
Expand All @@ -52,28 +34,28 @@ function value($path, $target, $default = null)
*
* @SuppressWarnings(PHPMD.StaticAccess)
*/
function getValueOrFail($path, $target, $message = null)
function valueOrFail($path, $target, $message = null)
{
return Get::valueOrFail($path, $target, $message);
}
}

if (!function_exists('Schnittstabil\Get\valueOrFail')) {
if (!function_exists('Schnittstabil\Get\getValue')) {
/**
* Return array values and object properties.
*
* @param string|int|mixed[] $path the path
* @param object|array|null $target the target
* @param mixed $message exception message
*
* @throws \OutOfBoundsException if the `$path` does not determine a member of `$target`
*
* @return mixed the value determined by `$path`
*
* @SuppressWarnings(PHPMD.StaticAccess)
* @deprecated Use `Schnittstabil\Get\value()` instead of `Schnittstabil\Get\getValue()`
*/
function valueOrFail($path, $target, $message = null)
function getValue($path, $target, $default = null)
{
return Get::valueOrFail($path, $target, $message);
return value($path, $target, $default);
}
}

if (!function_exists('Schnittstabil\Get\getValueOrFail')) {
/**
* @deprecated Use `Schnittstabil\Get\valueOrFail()` instead of `Schnittstabil\Get\getValueOrFail()`
*/
function getValueOrFail($path, $target, $message = null)
{
return valueOrFail($path, $target, $message);
}
}
Loading

0 comments on commit d6deace

Please sign in to comment.