-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTemporaryAction.php
More file actions
48 lines (44 loc) · 1.29 KB
/
TemporaryAction.php
File metadata and controls
48 lines (44 loc) · 1.29 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
/**
* PHP Billing Library
*
* @link https://github.com/hiqdev/php-billing
* @package php-billing
* @license BSD-3-Clause
* @copyright Copyright (c) 2017-2020, HiQDev (http://hiqdev.com/)
*/
namespace hiqdev\php\billing\action;
use hiqdev\php\billing\customer\CustomerInterface;
/**
* Class TemporaryAction represents an action, that is generated for
* runtime-only purposes such as, but not limited to:
*
* - Extending primary action with TemporaryActions, that represent client billing hierarchy
* - Actions produced in ActionMux
*
* Actions of this class MUST NOT be saved into the database and SHOULD be used
* only for runtime calculations.
*
* @author Dmytro Naumenko <d.naumenko.a@gmail.com>
*/
class TemporaryAction extends Action implements TemporaryActionInterface
{
/**
* Creates Temporary Action out of generic $action
*/
public static function createAsSubaction(ActionInterface $action, CustomerInterface $customer): TemporaryAction
{
return new self(
null,
$action->getType(),
$action->getTarget(),
$action->getQuantity(),
$customer,
$action->getTime(),
null,
$action->getState(),
$action
);
}
}