Merge branch 'patch-2' of github.com:sujayjaju/PHP-FFMpeg into sujayjaju-patch-2
* 'patch-2' of github.com:sujayjaju/PHP-FFMpeg: Update AbstractData.php
This commit is contained in:
commit
92121bb804
1 changed files with 5 additions and 1 deletions
|
|
@ -37,13 +37,17 @@ abstract class AbstractData implements \Countable
|
||||||
* Returns the property value given its name.
|
* Returns the property value given its name.
|
||||||
*
|
*
|
||||||
* @param string $property
|
* @param string $property
|
||||||
|
* @param mixed $default [optional]
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException In case the data does not have the property
|
* @throws InvalidArgumentException In case the data does not have the property
|
||||||
*/
|
*/
|
||||||
public function get($property)
|
public function get($property, $default = null)
|
||||||
{
|
{
|
||||||
if (!isset($this->properties[$property])) {
|
if (!isset($this->properties[$property])) {
|
||||||
|
if(!is_null($default)){
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
throw new InvalidArgumentException(sprintf('Invalid property `%s`.', $property));
|
throw new InvalidArgumentException(sprintf('Invalid property `%s`.', $property));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue