woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/Patch.php
Anton Ukhanev d4c8282518 Use Composer modules and convert modules to PSR-4
PSR-4 is much more robust and predictable. But to do this,
a source root dir must be specified for every module.
This could be done in the root file, but this is not very modular.
Instead, now every module declares its own source root by using
the amazing Composer Merge Plugin. This approach allows each module
to also declare its own dependencies. Together, these changes allow
modules to be easily extractable to separate pacakges when the need
arises, and in general improves modularity significantly.
2021-08-26 11:01:20 +02:00

100 lines
1.4 KiB
PHP

<?php
/**
* The Patch object.
*
* @package WooCommerce\PayPalCommerce\ApiClient\Entity
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
/**
* Class Patch
*/
class Patch {
/**
* The operation.
*
* @var string
*/
private $op;
/**
* The path to the change.
*
* @var string
*/
private $path;
/**
* The new value.
*
* @var array
*/
private $value;
/**
* Patch constructor.
*
* @param string $op The operation.
* @param string $path The path.
* @param array $value The new value.
*/
public function __construct( string $op, string $path, array $value ) {
$this->op = $op;
$this->path = $path;
$this->value = $value;
}
/**
* Returns the operation.
*
* @return string
*/
public function op(): string {
return $this->op;
}
/**
* Returns the path.
*
* @return string
*/
public function path(): string {
return $this->path;
}
/**
* Returns the value.
*
* @return array
*/
public function value() {
return $this->value;
}
/**
* Returns the object as array.
*
* @return array
*/
public function to_array(): array {
return array(
'op' => $this->op(),
'value' => $this->value(),
'path' => $this->path(),
);
}
/**
* Needed for the move operation. We currently do not
* support the move operation.
*
* @return string
*/
public function from(): string {
return '';
}
}