Skip to content

Commit

Permalink
Merge pull request #16 from alex-patterson-webdev/feature/1.0.1
Browse files Browse the repository at this point in the history
Fix line separator issues (to LF) and add licence information to composer.json
  • Loading branch information
alex-patterson-webdev authored Jul 18, 2020
2 parents f18f392 + f90abd7 commit cee31c6
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 412 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"minimum-stability": "dev",
"prefer-stable": true,
"license": "MIT",
"authors": [
{
"name": "Alex Patterson",
Expand Down
90 changes: 45 additions & 45 deletions src/Event/AbstractEvent.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<?php

declare(strict_types=1);

namespace Arp\EventDispatcher\Event;

/**
* @author Alex Patterson <[email protected]>
* @package Arp\EventDispatcher\Event
*/
abstract class AbstractEvent
{
/**
* @var ParametersInterface
*/
protected $params;

/**
* @param array $params
*/
public function __construct(array $params = [])
{
$this->setParameters(new Parameters($params));
}

/**
* Set the parameters collection.
*
* @param ParametersInterface $params
*/
public function setParameters(ParametersInterface $params): void
{
$this->params = $params;
}

/**
* Return the parameters collection.
*
* @return ParametersInterface
*/
public function getParameters(): ParametersInterface
{
return $this->params;
}
}
<?php

declare(strict_types=1);

namespace Arp\EventDispatcher\Event;

/**
* @author Alex Patterson <[email protected]>
* @package Arp\EventDispatcher\Event
*/
abstract class AbstractEvent
{
/**
* @var ParametersInterface
*/
protected $params;

/**
* @param array $params
*/
public function __construct(array $params = [])
{
$this->setParameters(new Parameters($params));
}

/**
* Set the parameters collection.
*
* @param ParametersInterface $params
*/
public function setParameters(ParametersInterface $params): void
{
$this->params = $params;
}

/**
* Return the parameters collection.
*
* @return ParametersInterface
*/
public function getParameters(): ParametersInterface
{
return $this->params;
}
}
80 changes: 40 additions & 40 deletions src/Event/NamedEvent.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<?php

declare(strict_types=1);

namespace Arp\EventDispatcher\Event;

use Arp\EventDispatcher\Resolver\EventNameAwareInterface;

/**
* @author Alex Patterson <[email protected]>
* @package Arp\EventDispatcher\Event
*/
class NamedEvent extends AbstractEvent implements EventNameAwareInterface
{
/**
* @var string
*/
protected $eventName;

/**
* @param string $eventName
* @param array $params
*/
public function __construct(string $eventName, array $params = [])
{
parent::__construct($params);

$this->eventName = $eventName;
}

/**
* Return the event name.
*
* @return string
*/
public function getEventName(): string
{
return $this->eventName;
}
}
<?php

declare(strict_types=1);

namespace Arp\EventDispatcher\Event;

use Arp\EventDispatcher\Resolver\EventNameAwareInterface;

/**
* @author Alex Patterson <[email protected]>
* @package Arp\EventDispatcher\Event
*/
class NamedEvent extends AbstractEvent implements EventNameAwareInterface
{
/**
* @var string
*/
protected $eventName;

/**
* @param string $eventName
* @param array $params
*/
public function __construct(string $eventName, array $params = [])
{
parent::__construct($params);

$this->eventName = $eventName;
}

/**
* Return the event name.
*
* @return string
*/
public function getEventName(): string
{
return $this->eventName;
}
}
150 changes: 75 additions & 75 deletions src/Event/ParametersInterface.php
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
<?php

declare(strict_types=1);

namespace Arp\EventDispatcher\Event;

/**
* @author Alex Patterson <[email protected]>
* @package Arp\EventDispatcher\Event
*/
interface ParametersInterface extends \IteratorAggregate, \Countable, \ArrayAccess
{
/**
* @param string $name
*
* @return bool
*/
public function hasParam(string $name): bool;

/**
* @param string $name
* @param mixed $default
*
* @return mixed
*/
public function getParam(string $name, $default = null);

/**
* @return array
*/
public function getParams(): array;

/**
* @param array $params
*/
public function setParams(array $params): void;

/**
* @param string $name
* @param mixed $value
*/
public function setParam(string $name, $value): void;

/**
* @param array $params
*/
public function removeParams(array $params = []): void;

/**
* @param string $name
*
* @return bool
*/
public function removeParam(string $name): bool;

/**
* @return int
*/
public function count(): int;

/**
* @return bool
*/
public function isEmpty(): bool;

/**
* @return array
*/
public function getKeys(): array;

/**
* @return array
*/
public function getValues(): array;
}
<?php

declare(strict_types=1);

namespace Arp\EventDispatcher\Event;

/**
* @author Alex Patterson <[email protected]>
* @package Arp\EventDispatcher\Event
*/
interface ParametersInterface extends \IteratorAggregate, \Countable, \ArrayAccess
{
/**
* @param string $name
*
* @return bool
*/
public function hasParam(string $name): bool;

/**
* @param string $name
* @param mixed $default
*
* @return mixed
*/
public function getParam(string $name, $default = null);

/**
* @return array
*/
public function getParams(): array;

/**
* @param array $params
*/
public function setParams(array $params): void;

/**
* @param string $name
* @param mixed $value
*/
public function setParam(string $name, $value): void;

/**
* @param array $params
*/
public function removeParams(array $params = []): void;

/**
* @param string $name
*
* @return bool
*/
public function removeParam(string $name): bool;

/**
* @return int
*/
public function count(): int;

/**
* @return bool
*/
public function isEmpty(): bool;

/**
* @return array
*/
public function getKeys(): array;

/**
* @return array
*/
public function getValues(): array;
}
Loading

0 comments on commit cee31c6

Please sign in to comment.