forked from magento/magento2-functional-testing-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumber.php
28 lines (26 loc) · 769 Bytes
/
Number.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FunctionalTestingFramework\Data\Argument\Interpreter;
use Magento\FunctionalTestingFramework\Data\Argument\InterpreterInterface;
/**
* Interpreter of numeric data, such as integer, float, or numeric string
*/
class Number implements InterpreterInterface
{
/**
* {@inheritdoc}
* @return string|integer|float
* @throws \InvalidArgumentException
*/
public function evaluate(array $data)
{
if (!isset($data['value']) || !is_numeric($data['value'])) {
throw new \InvalidArgumentException('Numeric value is expected.');
}
$result = $data['value'];
return $result;
}
}