Skip to content

Commit

Permalink
Add WopiConfiguration class.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Aug 17, 2021
1 parent d729ec6 commit 3598fa7
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/Configuration/WopiConfiguration.php
@@ -0,0 +1,47 @@
<?php

/**
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace ChampsLibres\WopiLib\Configuration;

use function array_key_exists;

final class WopiConfiguration implements WopiConfigurationInterface
{
private array $properties;

public function __construct(array $properties)
{
$this->properties = $properties;
}

public function jsonSerialize(): array
{
return $this->properties;
}

public function offsetExists($offset)
{
return array_key_exists($offset, $this->properties);
}

public function offsetGet($offset)
{
return $this->properties[$offset];
}

public function offsetSet($offset, $value)
{
$this->properties[$offset] = $value;
}

public function offsetUnset($offset)
{
unset($this->properties[$offset]);
}
}
17 changes: 17 additions & 0 deletions src/Configuration/WopiConfigurationInterface.php
@@ -0,0 +1,17 @@
<?php

/**
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace ChampsLibres\WopiLib\Configuration;

use ArrayAccess;
use JsonSerializable;

interface WopiConfigurationInterface extends ArrayAccess, JsonSerializable
{
}

0 comments on commit 3598fa7

Please sign in to comment.