Skip to content

Commit df6f6d4

Browse files
committed
Merge branch 'release/0.7.0'
2 parents fd2299a + f44c75c commit df6f6d4

28 files changed

+253
-154
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build-test:
7+
runs-on: ubuntu-latest
8+
container:
9+
image: php:8.4 # This forces the job to run in a Docker container
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Install System Dependencies (Git, Zip, Unzip)
16+
run: |
17+
apt-get update
18+
apt-get install -y unzip git zip
19+
20+
- name: Install and Enable extensions
21+
run: |
22+
docker-php-ext-install sockets calendar
23+
docker-php-ext-enable sockets calendar
24+
25+
- name: Install Composer
26+
run: |
27+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
28+
composer --version
29+
30+
- name: Install Dependencies
31+
run: composer install --prefer-dist --no-progress
32+
33+
- name: Run PHPUnit
34+
run: vendor/bin/phpunit tests

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.version.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"major":0,"minor":7,"patch":0,"build":0}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,14 @@ An ObserverableTrait and IObserver interface make up the Observer pattern implem
6060

6161
### Registry
6262

63+
64+
6365
### Singleton
6466

67+
The singleton is a mixture of singleton and memento patterns whereby it can
68+
serialize itself to both memcache and redis to be shared across applications.
69+
70+
6571
# More Information
6672

6773
You can read more about the Neuron components at [neuronphp.com](http://neuronphp.com)

VERSIONLOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
## 0.6.6 2025-01-27
2-
* Updated to data 0.7
1+
## 0.7.0
2+
3+
## 0.7.0
4+
* Refactoring.
5+
* Added Redis singleton.
36

7+
## 0.6.7
8+
## 0.6.6 2025-01-27
49
## 0.6.5
510
## 0.6.4
611
## 0.6.3

src/Patterns/Command/Cache.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace Neuron\Patterns\Command;
4+
5+
use Neuron\Core\Exceptions\CommandNotFound;
6+
use Neuron\Patterns\Singleton\Memory as Singleton;
7+
8+
/**
9+
* Maps strings to command classes.
10+
*/
11+
12+
class Cache extends Singleton
13+
{
14+
private static array $_Cache = [];
15+
16+
/**
17+
* @param string $Action
18+
* @param string $Command
19+
* @return Cache
20+
*/
21+
22+
public function set( string $Action, string $Command ): Cache
23+
{
24+
self::$_Cache[ $Action ] = $Command;
25+
26+
return self::instance();
27+
}
28+
29+
/**
30+
* @param string $Action
31+
* @return ICommand
32+
* @throws CommandNotFound
33+
*/
34+
35+
public function get( string $Action ): ICommand
36+
{
37+
if( !isset( self::$_Cache[ $Action ] ) )
38+
{
39+
throw new CommandNotFound( "No command found for action '{$Action}' in the cache." );
40+
}
41+
42+
return new self::$_Cache[ $Action ];
43+
}
44+
}

src/Patterns/Command/CommandCache.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/Patterns/Command/CommandFactory.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/Patterns/Command/CommandNotFoundException.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Patterns/Command/EmptyActionParameterException.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)