Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing BrokerApi from namespace #7

Merged
merged 1 commit into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ template/vendor
template/phpcs.xml
template/.phpunit.result.cache
.env
template/.env
template/.env
.idea/
2 changes: 1 addition & 1 deletion template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Refer to the examples folder for further details on PHP usage
$brokerAPI = new BrokerAPI();
$factory = $brokerAPI->init();

/** @var \{{ params.packageName }}\BrokerAPI\Applications\Producer $producer */
/** @var \{{ params.packageName }}\Applications\Producer $producer */
$producer = $factory->createApplication(
PRODUCER_KEY,
[
Expand Down
4 changes: 2 additions & 2 deletions template/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
},
"autoload": {
"psr-4": {
"{{ params.packageName }}\\BrokerAPI\\": "src"
"{{ params.packageName }}\\": "src"
},
"files": [
"configs/consts.php"
]
},
"autoload-dev": {
"psr-4": {
"{{ params.packageName }}\\BrokerAPI\\Tests\\": "tests"
"{{ params.packageName }}\\Tests\\": "tests"
}
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Examples\Basic\Consumer\Handlers;

use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Messages\MessageContract;
use PhpAmqpLib\Message\AMQPMessage;

class ExampleHandler implements HandlerContract
Expand All @@ -24,4 +24,4 @@ public function handle($message): bool
}

}
}
}
4 changes: 2 additions & 2 deletions template/examples/basic/consumer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
require "../../../vendor/autoload.php";
require "Handlers/ExampleHandler.php";

use {{ params.packageName }}\BrokerAPI\BrokerAPI;
use {{ params.packageName }};

$brokerAPI = new BrokerAPI();
$factory = $brokerAPI->init();

/** @var \{{ params.packageName }}\BrokerAPI\Applications\Consumer $consumer */
/** @var \{{ params.packageName }}\Applications\Consumer $consumer */
$consumer = $factory->createApplication(
CONSUMER_KEY,
[
Expand Down
6 changes: 3 additions & 3 deletions template/examples/basic/producer/index.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
require "../../../vendor/autoload.php";

use {{ params.packageName }}\BrokerAPI\BrokerAPI;
use {{ params.packageName }}\BrokerAPI\Messages\Example;
use {{ params.packageName }};
use {{ params.packageName }}\Messages\Example;

$brokerAPI = new BrokerAPI();
$factory = $brokerAPI->init();

/** @var \{{ params.packageName }}\BrokerAPI\Applications\Producer $producer */
/** @var \{{ params.packageName }}\Applications\Producer $producer */
$producer = $factory->createApplication(
PRODUCER_KEY,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Examples\RPC\Consumer\Handlers;

use PhpAmqpLib\Message\AMQPMessage;
use {{ params.packageName }}\BrokerAPI\Common\AMQPFactory;
use {{ params.packageName }}\BrokerAPI\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\BrokerAPI\Messages\Example;
use {{ params.packageName }}\Common\AMQPFactory;
use {{ params.packageName }}\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\Messages\Example;

/**
* Created by PhpStorm.
Expand Down Expand Up @@ -40,4 +40,4 @@ public function handle($message): bool
$this->sendRPCResponse($message, $newMessage);
return true;
}
}
}
4 changes: 2 additions & 2 deletions template/examples/rpc/consumer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
require "../../../vendor/autoload.php";
require "Handlers/RPCExampleHandler.php";

use {{ params.packageName }}\BrokerAPI\BrokerAPI;
use {{ params.packageName }};

$brokerAPI = new BrokerAPI();
$factory = $brokerAPI->init();

/** @var \{{ params.packageName }}\BrokerAPI\Applications\Consumer $consumer */
/** @var \{{ params.packageName }}\Applications\Consumer $consumer */
$consumer = $factory->createApplication(
CONSUMER_KEY,
[
Expand Down
8 changes: 4 additions & 4 deletions template/examples/rpc/producer/index.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
require "../../../vendor/autoload.php";

use {{ params.packageName }}\BrokerAPI\BrokerAPI;
use {{ params.packageName }}\BrokerAPI\Messages\Example;
use {{ params.packageName }};
use {{ params.packageName }}\Messages\Example;

$brokerAPI = new BrokerAPI();
$factory = $brokerAPI->init();

/** @var \{{ params.packageName }}\BrokerAPI\Applications\Producer $producer */
/** @var \{{ params.packageName }}\Applications\Producer $producer */
$producer = $factory->createApplication(
PRODUCER_KEY,
[
Expand All @@ -27,4 +27,4 @@
);
/** @var \PhpAmqpLib\Message\AMQPMessage $return */
$return = $producer->requestExampleByIdRPC($message);
print_r($return->getBody());
print_r($return->getBody());
8 changes: 4 additions & 4 deletions template/src/Applications/ApplicationContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* Time: 14:38
*/

namespace {{ params.packageName }}\BrokerAPI\Applications;
namespace {{ params.packageName }}\Applications;

use {{ params.packageName }}\BrokerAPI\Common\FactoryContract;
use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\Common\FactoryContract;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Infrastructure\BrokerClientContract;

abstract class ApplicationContract
{
Expand Down
6 changes: 3 additions & 3 deletions template/src/Applications/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* Time: 12:24
*/

namespace {{ params.packageName }}\BrokerAPI\Applications;
namespace {{ params.packageName }}\Applications;

use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Handlers\AMQPRPCServerHandler;

final class Consumer extends ApplicationContract
{
Expand Down
6 changes: 3 additions & 3 deletions template/src/Applications/Producer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
* Time: 20:22
*/

namespace {{ params.packageName }}\BrokerAPI\Applications;
namespace {{ params.packageName }}\Applications;

use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\BrokerAPI\Handlers\AMQPRPCClientHandler;
use {{ params.packageName }}\Messages\MessageContract;
use {{ params.packageName }}\Handlers\AMQPRPCClientHandler;

final class Producer extends ApplicationContract
{
Expand Down
6 changes: 3 additions & 3 deletions template/src/BrokerAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* Time: 10:41
*/

namespace {{ params.packageName }}\BrokerAPI;
namespace {{ params.packageName }};

use Dotenv\Dotenv;
use {{ params.packageName }}\BrokerAPI\Common\AMQPFactory;
use {{ params.packageName }}\BrokerAPI\Common\FactoryContract;
use {{ params.packageName }}\Common\AMQPFactory;
use {{ params.packageName }}\Common\FactoryContract;

final class BrokerAPI
{
Expand Down
16 changes: 8 additions & 8 deletions template/src/Common/AMQPFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
* Time: 11:39
*/

namespace {{ params.packageName }}\BrokerAPI\Common;
namespace {{ params.packageName }}\Common;

use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\BrokerAPI\Infrastructure\AMQPBrokerClient;
use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\BrokerAPI\Applications\ApplicationContract;
use {{ params.packageName }}\BrokerAPI\Applications\Consumer;
use {{ params.packageName }}\BrokerAPI\Applications\Producer;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\Infrastructure\AMQPBrokerClient;
use {{ params.packageName }}\Messages\MessageContract;
use {{ params.packageName }}\Applications\ApplicationContract;
use {{ params.packageName }}\Applications\Consumer;
use {{ params.packageName }}\Applications\Producer;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

Expand Down
10 changes: 5 additions & 5 deletions template/src/Common/FactoryContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* Time: 11:35
*/

namespace {{ params.packageName }}\BrokerAPI\Common;
namespace {{ params.packageName }}\Common;

use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\BrokerAPI\Applications\ApplicationContract;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\Messages\MessageContract;
use {{ params.packageName }}\Applications\ApplicationContract;

interface FactoryContract
{
Expand Down
4 changes: 2 additions & 2 deletions template/src/Handlers/AMQPRPCClientHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* Time: 11:03
*/

namespace {{ params.packageName }}\BrokerAPI\Handlers;
namespace {{ params.packageName }}\Handlers;

use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\Messages\MessageContract;
use PhpAmqpLib\Message\AMQPMessage;

class AMQPRPCClientHandler implements HandlerContract
Expand Down
4 changes: 2 additions & 2 deletions template/src/Handlers/AMQPRPCServerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* Time: 11:03
*/

namespace {{ params.packageName }}\BrokerAPI\Handlers;
namespace {{ params.packageName }}\Handlers;

use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\Messages\MessageContract;
use PhpAmqpLib\Message\AMQPMessage;

abstract class AMQPRPCServerHandler implements HandlerContract
Expand Down
4 changes: 2 additions & 2 deletions template/src/Handlers/HandlerContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* Time: 11:03
*/

namespace {{ params.packageName }}\BrokerAPI\Handlers;
namespace {{ params.packageName }}\Handlers;

use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\Messages\MessageContract;

interface HandlerContract
{
Expand Down
12 changes: 6 additions & 6 deletions template/src/Infrastructure/AMQPBrokerClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
* Time: 14:37
*/

namespace {{ params.packageName }}\BrokerAPI\Infrastructure;
namespace {{ params.packageName }}\Infrastructure;

use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
use Ramsey\Uuid\Uuid;
use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\BrokerAPI\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\BrokerAPI\Handlers\AMQPRPCClientHandler;
use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Common\FactoryContract;
use {{ params.packageName }}\Messages\MessageContract;
use {{ params.packageName }}\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\Handlers\AMQPRPCClientHandler;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Common\FactoryContract;

class AMQPBrokerClient implements BrokerClientContract
{
Expand Down
10 changes: 5 additions & 5 deletions template/src/Infrastructure/BrokerClientContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
* Time: 11:11
*/

namespace {{ params.packageName }}\BrokerAPI\Infrastructure;
namespace {{ params.packageName }}\Infrastructure;

use {{ params.packageName }}\BrokerAPI\Messages\MessageContract;
use {{ params.packageName }}\BrokerAPI\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Common\FactoryContract;
use {{ params.packageName }}\Messages\MessageContract;
use {{ params.packageName }}\Handlers\AMQPRPCServerHandler;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Common\FactoryContract;


interface BrokerClientContract
Expand Down
4 changes: 2 additions & 2 deletions template/src/Messages/$$message$$.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace {{ params.packageName }}\BrokerAPI\Messages;
namespace {{ params.packageName }}\Messages;
{%- if message.description() or message.examples() %}/**{%- for line in message.description() | splitByLines %}
* {{- line | safe }}{%- endfor %}{%- if message.examples() %}
* Examples: {{- message.examples() | examplesToString | safe }}{%- endif %}
Expand Down Expand Up @@ -70,4 +70,4 @@ public function jsonSerialize()
{
return get_object_vars($this);
}
}
}
2 changes: 1 addition & 1 deletion template/src/Messages/MessageContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Time: 11:03
*/

namespace {{ params.packageName }}\BrokerAPI\Messages;
namespace {{ params.packageName }}\Messages;

abstract class MessageContract implements \JsonSerializable
{
Expand Down
16 changes: 8 additions & 8 deletions template/tests/Applications/BaseApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Time: 19:18
*/

namespace {{ params.packageName }}\BrokerAPI\Tests\Applications;
namespace {{ params.packageName }}\Tests\Applications;

use {{ params.packageName }}\BrokerAPI\Applications\Consumer;
use {{ params.packageName }}\BrokerAPI\Applications\Producer;
use {{ params.packageName }}\BrokerAPI\Common\FactoryContract;
use {{ params.packageName }}\BrokerAPI\Handlers\HandlerContract;
use {{ params.packageName }}\BrokerAPI\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\BrokerAPI\Tests\BaseTest;
use {{ params.packageName }}\Applications\Consumer;
use {{ params.packageName }}\Applications\Producer;
use {{ params.packageName }}\Common\FactoryContract;
use {{ params.packageName }}\Handlers\HandlerContract;
use {{ params.packageName }}\Infrastructure\BrokerClientContract;
use {{ params.packageName }}\Tests\BaseTest;

class BaseApplicationTest extends BaseTest
{
Expand Down Expand Up @@ -111,4 +111,4 @@ private function assertDependenciesFromDataProvider($producer, $brokerClient, $f
$this->assertTrue($consumer->$brokerGetter() instanceof $brokerClient['dependency']);
$this->assertTrue($consumer->$factoryGetter() instanceof $factory['dependency']);
}
}
}
4 changes: 2 additions & 2 deletions template/tests/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* Time: 11:02
*/

namespace {{ params.packageName }}\BrokerAPI\Tests;
namespace {{ params.packageName }}\Tests;

use Prophecy\PhpUnit\ProphecyTrait;


abstract class BaseTest extends \PHPUnit\Framework\TestCase
{
use ProphecyTrait;
}
}
Loading