├── tests
├── Http
│ ├── Psr
│ │ ├── Stream
│ │ │ └── resource.txt
│ │ ├── MessageTest.php
│ │ ├── ResponseTest.php
│ │ └── RequestTest.php
│ ├── Issues
│ │ └── Issue12Test.php
│ ├── Session
│ │ └── Handler
│ │ │ ├── GlobalHandlerTest.php
│ │ │ └── FileHandlerTest.php
│ └── Parameters
│ │ ├── ParsedBodyTest.php
│ │ └── QueryParamsTest.php
├── View
│ ├── views
│ │ ├── hello-stranger.php
│ │ ├── exception-error.php
│ │ ├── layout.php
│ │ └── home.php
│ ├── PhpViewServiceProviderTest.php
│ └── Phiew
│ │ └── FileResolverTest.php
├── Config
│ ├── test_env.env
│ ├── test_path
│ │ └── app.yml
│ ├── test_json.json
│ ├── test_yml.yml
│ └── test_php.php
├── Router
│ └── Responsifier
│ │ └── stub-text.txt
├── Restifier
│ └── Sample
│ │ ├── SampleAuthInterface.php
│ │ ├── SampleCustomer.php
│ │ ├── SampleCustomerTransformer.php
│ │ ├── SampleUser.php
│ │ └── SampleUserTransformer.php
├── bootstrap.php
├── Q
│ ├── Adapter
│ │ ├── ArrayAdapterTest.php
│ │ └── BeanstalkdAdapterTest.php
│ └── QueueTest.php
├── Validator
│ ├── Sample
│ │ ├── SampleOverTenTester.php
│ │ ├── SamplePointRule.php
│ │ ├── SampleCharterRule.php
│ │ └── SampleCharterValidator.php
│ └── ValidatorServiceProviderTest.php
├── Caster
│ └── Caster
│ │ ├── DateCasterTest.php
│ │ └── TimeCasterTest.php
├── Sanitizer
│ └── Sample
│ │ ├── SamplePoint.php
│ │ ├── SampleCharter.php
│ │ └── SamplePointRule.php
├── DI
│ └── Descriptor
│ │ └── FreezeTest.php
└── Database
│ └── Entity
│ └── MetadataTest.php
├── readme.png
├── src
└── Wandu
│ ├── Database
│ ├── Events
│ │ ├── Connect.php
│ │ └── ExecuteQuery.php
│ ├── Contracts
│ │ ├── QueryInterface.php
│ │ ├── ExpressionInterface.php
│ │ ├── Entity
│ │ │ └── MetadataReaderInterface.php
│ │ └── DumperInterface.php
│ ├── Exception
│ │ ├── EntityNotFoundException.php
│ │ ├── IdentifierNotFoundException.php
│ │ ├── ClassNotFoundException.php
│ │ └── DriverNotFoundException.php
│ ├── Annotations
│ │ ├── Column.php
│ │ ├── Cast.php
│ │ ├── RelationInterface.php
│ │ ├── Table.php
│ │ ├── HasMany.php
│ │ ├── HasOne.php
│ │ └── BelongsTo.php
│ ├── composer.json
│ ├── README.md
│ ├── README.ok.md
│ └── Query
│ │ ├── Expression
│ │ ├── WhereExpression.php
│ │ └── RawExpression.php
│ │ ├── TruncateQuery.php
│ │ ├── DeleteQuery.php
│ │ ├── RawQuery.php
│ │ └── RenameQuery.php
│ ├── Event
│ ├── Contracts
│ │ ├── ViaQueue.php
│ │ ├── Listener.php
│ │ └── EventEmitter.php
│ ├── Commands
│ │ ├── Events
│ │ │ ├── QueuePing.php
│ │ │ └── NormalPing.php
│ │ └── Listeners
│ │ │ ├── NormalPong.php
│ │ │ └── QueuePong.php
│ ├── Listener
│ │ ├── ListenHandler.php
│ │ ├── CallableListener.php
│ │ └── WorkerListener.php
│ ├── composer.json
│ ├── README.md
│ ├── README.ok.md
│ └── EventServiceProvider.php
│ ├── Http
│ ├── Contracts
│ │ ├── ParsedBodyInterface.php
│ │ ├── QueryParamsInterface.php
│ │ ├── AttributeInterface.php
│ │ ├── CookieJarInterface.php
│ │ ├── ServerParamsInterface.php
│ │ ├── SessionInterface.php
│ │ └── ParameterInterface.php
│ ├── Factory
│ │ └── Exception
│ │ │ ├── CannotCreateRequestException.php
│ │ │ └── AbstractFactoryException.php
│ ├── Psr
│ │ ├── Stream
│ │ │ └── PhpInputStream.php
│ │ ├── Stream.php
│ │ ├── Message.php
│ │ └── Request.php
│ ├── Exception
│ │ ├── BadRequestException.php
│ │ ├── ForbiddenException.php
│ │ ├── NotFoundException.php
│ │ ├── UnauthorizedException.php
│ │ ├── MethodNotAllowedException.php
│ │ ├── InternalServerErrorException.php
│ │ └── CannotCallMethodException.php
│ ├── Attribute
│ │ └── LazyAttribute.php
│ ├── Parameters
│ │ ├── ParsedBody.php
│ │ └── QueryParams.php
│ ├── composer.json
│ ├── README.md
│ └── README.ok.md
│ ├── View
│ ├── FileNotFoundException.php
│ ├── Phiew
│ │ ├── PhiewException.php
│ │ ├── Contracts
│ │ │ └── ResolverInterface.php
│ │ └── Configuration.php
│ ├── Contracts
│ │ ├── PresenterInterface.php
│ │ └── RenderInterface.php
│ ├── composer.json
│ ├── README.md
│ ├── README.ok.md
│ ├── PhpViewServiceProvider.php
│ ├── Phiew.php
│ └── PhiewServiceProvider.php
│ ├── Validator
│ ├── Contracts
│ │ ├── Sanitized.php
│ │ ├── Rule.php
│ │ ├── ErrorThrowable.php
│ │ ├── Tester.php
│ │ ├── RuleNormalizable.php
│ │ └── Validatable.php
│ ├── Testers
│ │ ├── FloatTester.php
│ │ ├── BooleanTester.php
│ │ ├── IntegerTester.php
│ │ ├── StringTester.php
│ │ ├── NumericTester.php
│ │ ├── StringableTester.php
│ │ ├── AlwaysTrueTester.php
│ │ ├── IntegerableTester.php
│ │ ├── AlwaysFalseTester.php
│ │ ├── EqualToTester.php
│ │ ├── LessThanTester.php
│ │ ├── GreaterThanTester.php
│ │ ├── LessThanOrEqualTester.php
│ │ ├── GreaterThanOrEqualTester.php
│ │ ├── PrintableTester.php
│ │ ├── AfterTester.php
│ │ ├── BeforeTester.php
│ │ ├── MinTester.php
│ │ ├── MaxTester.php
│ │ ├── RegExpTester.php
│ │ ├── LengthMinTester.php
│ │ ├── LengthMaxTester.php
│ │ ├── PropertyTesterAbstract.php
│ │ ├── EmailTester.php
│ │ ├── LengthBetweenTester.php
│ │ └── BetweenTester.php
│ ├── SingleValidatorAbstract.php
│ ├── Throwable
│ │ └── ErrorThrower.php
│ ├── functions.php
│ ├── Exception
│ │ ├── TesterNotFoundException.php
│ │ └── InvalidValueException.php
│ ├── composer.json
│ ├── ValidatorServiceProvider.php
│ ├── README.md
│ ├── README.ok.md
│ └── ValidatorFactory.php
│ ├── Q
│ ├── Exception
│ │ └── WorkerStopException.php
│ ├── Contracts
│ │ ├── AdapterJob.php
│ │ ├── Serializer.php
│ │ └── Adapter.php
│ ├── WorkerStopper.php
│ ├── Commands
│ │ ├── WorkerFlushCommand.php
│ │ └── WorkerListenCommand.php
│ ├── Serializer
│ │ ├── PhpSerializer.php
│ │ └── JsonSerializer.php
│ ├── composer.json
│ ├── Adapter
│ │ ├── NullAdapter.php
│ │ ├── BeanstalkdJob.php
│ │ ├── ArrayJob.php
│ │ └── SqsJob.php
│ ├── Job.php
│ └── Providers
│ │ ├── SqsServiceProvider.php
│ │ └── BeanstalkServiceProvider.php
│ ├── Console
│ ├── Exception
│ │ └── ConsoleException.php
│ ├── Contracts
│ │ └── CommandAttachable.php
│ ├── composer.json
│ ├── Commands
│ │ └── PsyshCommand.php
│ ├── README.md
│ ├── README.ok.md
│ └── ConsoleServiceProvider.php
│ ├── DI
│ ├── functions.php
│ ├── Annotations
│ │ ├── Factory.php
│ │ ├── Alias.php
│ │ ├── Wire.php
│ │ ├── WireValue.php
│ │ ├── Assign.php
│ │ └── AssignValue.php
│ ├── ServiceProviderInterface.php
│ ├── ServiceProvider.php
│ ├── .phpstorm.meta.php
│ ├── Exception
│ │ ├── CannotFindParameterException.php
│ │ ├── CannotChangeException.php
│ │ ├── NullReferenceException.php
│ │ └── CannotInjectException.php
│ ├── Providers
│ │ ├── Predis
│ │ │ └── PredisServiceProvider.php
│ │ ├── Cleentfaar
│ │ │ └── SlackServiceProvider.php
│ │ └── Doctrine
│ │ │ └── AnnotationServiceProvider.php
│ ├── README.md
│ ├── README.ok.md
│ └── composer.json
│ ├── Migrator
│ ├── Contracts
│ │ ├── Migration.php
│ │ ├── MigrationTemplate.php
│ │ ├── MigrationInformation.php
│ │ └── Adapter.php
│ ├── composer.json
│ ├── README.md
│ ├── README.ok.md
│ ├── UnknownMigrationInformation.php
│ ├── MigratorServiceProvider.php
│ ├── Configuration.php
│ ├── Commands
│ │ ├── CreateCommand.php
│ │ ├── DownCommand.php
│ │ └── MigrateCommand.php
│ └── FileMigrationInformation.php
│ ├── Restifier
│ ├── Exception
│ │ └── NotFoundTransformerException.php
│ ├── composer.json
│ └── Contracts
│ │ └── Restifiable.php
│ ├── Caster
│ ├── CasterInterface.php
│ ├── Caster
│ │ ├── DateCaster.php
│ │ ├── IntegerCaster.php
│ │ ├── FloatCaster.php
│ │ ├── CarbonCaster.php
│ │ ├── StringCaster.php
│ │ ├── TimeCaster.php
│ │ ├── ArrayCaster.php
│ │ └── BooleanCatser.php
│ ├── CastManagerInterface.php
│ ├── UnsupportTypeException.php
│ ├── README.md
│ ├── README.ok.md
│ ├── composer.json
│ └── CasterServiceProvider.php
│ ├── Router
│ ├── Contracts
│ │ ├── RouteGroupInterface.php
│ │ ├── ResponsifierInterface.php
│ │ ├── MiddlewareInterface.php
│ │ ├── RouteInformation.php
│ │ ├── RouteFluent.php
│ │ ├── Dispatchable.php
│ │ └── LoaderInterface.php
│ ├── Exception
│ │ ├── RouteNotFoundException.php
│ │ ├── MethodNotAllowedException.php
│ │ └── CannotGetPathException.php
│ ├── Responsifier
│ │ ├── NullResponsifier.php
│ │ └── PsrResponsifier.php
│ ├── composer.json
│ ├── RouterServiceProvider.php
│ └── Loader
│ │ └── SimpleLoader.php
│ ├── Config
│ ├── Contracts
│ │ ├── Loader.php
│ │ └── Config.php
│ ├── composer.json
│ ├── Exception
│ │ ├── CannotLoadException.php
│ │ └── NotAllowedMethodException.php
│ ├── Loader
│ │ ├── JsonLoader.php
│ │ ├── EnvLoader.php
│ │ ├── YmlLoader.php
│ │ └── PhpLoader.php
│ └── ConfigServiceProvider.php
│ ├── Sanitizer
│ ├── Contracts
│ │ └── Rule.php
│ ├── Http
│ │ └── HttpRule.php
│ ├── composer.json
│ ├── SanitizerNormalizer.php
│ ├── Sanitizer.php
│ ├── README.md
│ ├── README.ok.md
│ └── SanitizerFactory.php
│ ├── Service
│ ├── Monolog
│ │ ├── composer.json
│ │ ├── README.md
│ │ ├── README.ok.md
│ │ └── MonologServiceProvider.php
│ ├── GuzzleHttp
│ │ ├── composer.json
│ │ ├── GuzzleServiceProvider.php
│ │ ├── README.md
│ │ └── README.ok.md
│ ├── NeomerxCors
│ │ ├── composer.json
│ │ ├── README.md
│ │ └── README.ok.md
│ └── Eloquent
│ │ ├── composer.json
│ │ ├── README.md
│ │ ├── README.ok.md
│ │ └── EloquentTemplate.php
│ ├── Collection
│ ├── composer.json
│ └── README.ok.md
│ ├── Foundation
│ ├── WebApp
│ │ └── Contracts
│ │ │ └── HttpErrorHandler.php
│ ├── composer.json
│ ├── Contracts
│ │ └── Bootstrap.php
│ ├── README.md
│ ├── README.ok.md
│ ├── functions.php
│ └── Application.php
│ ├── Annotation
│ ├── composer.json
│ ├── README.md
│ └── README.ok.md
│ └── DateTime
│ ├── composer.json
│ ├── README.ok.md
│ └── README.md
├── .phpstorm.meta.php
├── .gitignore
├── .scrutinizer.yml
├── CONTRIBUTING.md
├── phpunit.xml
├── LICENSE
└── .travis.yml
/tests/Http/Psr/Stream/resource.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/View/views/hello-stranger.php:
--------------------------------------------------------------------------------
1 | hello =$who?>
2 |
--------------------------------------------------------------------------------
/tests/Config/test_env.env:
--------------------------------------------------------------------------------
1 | env1 = 'what the'
2 | env2 = false
3 |
--------------------------------------------------------------------------------
/tests/Config/test_path/app.yml:
--------------------------------------------------------------------------------
1 |
2 | debug: true
3 | env: test
4 |
--------------------------------------------------------------------------------
/tests/Router/Responsifier/stub-text.txt:
--------------------------------------------------------------------------------
1 | stub-text.txt contents
2 |
--------------------------------------------------------------------------------
/readme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Wandu/Framework/HEAD/readme.png
--------------------------------------------------------------------------------
/tests/View/views/exception-error.php:
--------------------------------------------------------------------------------
1 | hello world
2 |
--------------------------------------------------------------------------------
/tests/Config/test_json.json:
--------------------------------------------------------------------------------
1 | {
2 | "json1": "json 1 string",
3 | "json2": ["json2-1", "json2-2"]
4 | }
5 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Events/Connect.php:
--------------------------------------------------------------------------------
1 | queue = new ArrayAdapter();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/CasterInterface.php:
--------------------------------------------------------------------------------
1 | message = "Identifier not found from entity";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/Contracts/MigrationInformation.php:
--------------------------------------------------------------------------------
1 | [
5 | "session" instanceof \Wandu\Http\Contracts\SessionInterface,
6 | "cookie" instanceof \Wandu\Http\Contracts\CookieJarInterface,
7 | ],
8 | ];
9 | }
10 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Annotations/Alias.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | =$title?>
7 | =$this->content('styles')?>
8 | =$this->content('nothing')?>
9 |
10 |
11 | =$this->content('contents')?>
12 |
13 | =$this->content('scripts')?>
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/FloatTester.php:
--------------------------------------------------------------------------------
1 | =7.1"
6 | },
7 | "autoload": {
8 | "psr-4": {
9 | "Wandu\\View\\": ""
10 | }
11 | },
12 | "extra": {
13 | "branch-alias": {
14 | "dev-master": "4.0-dev"
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Contracts/Serializer.php:
--------------------------------------------------------------------------------
1 | 10;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Contracts/Entity/MetadataReaderInterface.php:
--------------------------------------------------------------------------------
1 | getMessage()}\n";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Contracts/AttributeInterface.php:
--------------------------------------------------------------------------------
1 | [
6 | "" == "@",
7 | ],
8 | \Wandu\DI\Container::get('') => [
9 | "" == "@",
10 | ],
11 | \Wandu\DI\ContainerInterface::get('') => [
12 | "" == "@",
13 | ],
14 | ];
15 | }
16 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/AlwaysFalseTester.php:
--------------------------------------------------------------------------------
1 | getProp($origin)) return false;
12 | return $prop == $data;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/Caster/FloatCaster.php:
--------------------------------------------------------------------------------
1 | __toString());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Router/Exception/MethodNotAllowedException.php:
--------------------------------------------------------------------------------
1 | getProp($origin)) return false;
12 | return $prop > $data;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Annotations/Assign.php:
--------------------------------------------------------------------------------
1 | handle(...$arguments);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/GreaterThanTester.php:
--------------------------------------------------------------------------------
1 | getProp($origin)) return false;
12 | return $prop < $data;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Http/Psr/MessageTest.php:
--------------------------------------------------------------------------------
1 | message = new Message(null, [], "1.0");
14 | }
15 |
16 | public function tearDown()
17 | {
18 | Mockery::close();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Annotations/AssignValue.php:
--------------------------------------------------------------------------------
1 | rule());
9 | }
10 |
11 | abstract public function rule();
12 | }
13 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/LessThanOrEqualTester.php:
--------------------------------------------------------------------------------
1 | getProp($origin)) return false;
12 | return $prop >= $data;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Validator/Sample/SamplePointRule.php:
--------------------------------------------------------------------------------
1 | "string",
12 | "address?" => "string",
13 | "lat?" => "float",
14 | "lng?" => "float",
15 | ];
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/GreaterThanOrEqualTester.php:
--------------------------------------------------------------------------------
1 | getProp($origin)) return false;
12 | return $prop <= $data;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Router/Responsifier/NullResponsifier.php:
--------------------------------------------------------------------------------
1 | $value) {
15 | $this->{$key} = $value;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Caster/Caster/DateCasterTest.php:
--------------------------------------------------------------------------------
1 | cast('2017-03-12')
15 | );
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Monolog/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/service-monolog",
3 | "license": "MIT",
4 | "require": {
5 | "php": ">=7.1",
6 | "monolog/monolog": "^1"
7 | },
8 | "autoload": {
9 | "psr-4": {
10 | "Wandu\\Service\\Monolog\\": ""
11 | }
12 | },
13 | "extra": {
14 | "branch-alias": {
15 | "dev-master": "4.0-dev"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Http/Psr/ResponseTest.php:
--------------------------------------------------------------------------------
1 | response = $this->message = new Response();
14 | }
15 |
16 | public function tearDown()
17 | {
18 | Mockery::close();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Contracts/Validatable.php:
--------------------------------------------------------------------------------
1 | =7.1",
6 | "guzzlehttp/guzzle": "^6"
7 | },
8 | "autoload": {
9 | "psr-4": {
10 | "Wandu\\Service\\GuzzleHttp\\": ""
11 | }
12 | },
13 | "extra": {
14 | "branch-alias": {
15 | "dev-master": "4.0-dev"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Exception/BadRequestException.php:
--------------------------------------------------------------------------------
1 | response = $this->response->withStatus(400);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Exception/ForbiddenException.php:
--------------------------------------------------------------------------------
1 | response = $this->response->withStatus(403);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Exception/NotFoundException.php:
--------------------------------------------------------------------------------
1 | response = $this->response->withStatus(404);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Sanitizer/Http/HttpRule.php:
--------------------------------------------------------------------------------
1 | =7.1",
6 | "neomerx/cors-psr7": "^1.0"
7 | },
8 | "autoload": {
9 | "psr-4": {
10 | "Wandu\\Service\\NeomerxCors\\": ""
11 | }
12 | },
13 | "extra": {
14 | "branch-alias": {
15 | "dev-master": "4.0-dev"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Exception/UnauthorizedException.php:
--------------------------------------------------------------------------------
1 | response = $this->response->withStatus(401);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Collection/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/collection",
3 | "description": "Collection Library Like Java. Provides List, Map, and Set.",
4 | "license": "MIT",
5 | "require": {
6 | "php": ">=7.1"
7 | },
8 | "autoload": {
9 | "psr-4": {
10 | "Wandu\\Collection\\": ""
11 | }
12 | },
13 | "extra": {
14 | "branch-alias": {
15 | "dev-master": "4.0-dev"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Exception/MethodNotAllowedException.php:
--------------------------------------------------------------------------------
1 | response = $this->response->withStatus(405);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Commands/WorkerFlushCommand.php:
--------------------------------------------------------------------------------
1 | worker = $worker;
15 | }
16 |
17 | function execute()
18 | {
19 | $this->worker->flush();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Commands/WorkerListenCommand.php:
--------------------------------------------------------------------------------
1 | worker = $worker;
15 | }
16 |
17 | function execute()
18 | {
19 | $this->worker->listen();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Wandu/Router/Contracts/MiddlewareInterface.php:
--------------------------------------------------------------------------------
1 | =7.1",
7 | "wandu/validator": "^4.0"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Sanitizer\\": ""
12 | }
13 | },
14 | "extra": {
15 | "branch-alias": {
16 | "dev-master": "4.0-dev"
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/Sanitizer/Sample/SamplePoint.php:
--------------------------------------------------------------------------------
1 | attributes = $attributes;
12 | }
13 |
14 | /**
15 | * @return array
16 | */
17 | public function getAttributes(): array
18 | {
19 | return $this->attributes;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/CastManagerInterface.php:
--------------------------------------------------------------------------------
1 | response = $this->response->withStatus(500);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Wandu/Sanitizer/SanitizerNormalizer.php:
--------------------------------------------------------------------------------
1 | rule();
15 | }
16 | return parent::normalize($rule);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Sanitizer/Sample/SampleCharter.php:
--------------------------------------------------------------------------------
1 | attributes = $attributes;
12 | }
13 |
14 | /**
15 | * @return array
16 | */
17 | public function getAttributes(): array
18 | {
19 | return $this->attributes;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Wandu/Foundation/WebApp/Contracts/HttpErrorHandler.php:
--------------------------------------------------------------------------------
1 | auto($response);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/PrintableTester.php:
--------------------------------------------------------------------------------
1 | =7.0"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Restifier\\": ""
12 | }
13 | },
14 | "extra": {
15 | "branch-alias": {
16 | "dev-master": "4.0-dev"
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/Http/Issues/Issue12Test.php:
--------------------------------------------------------------------------------
1 | withAttribute('null', null);
13 |
14 | static::assertNull($request->getAttribute('null'));
15 | static::assertNull($request->getAttribute('null', 20));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/functions.php:
--------------------------------------------------------------------------------
1 | factory($rule);
16 | }
17 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/UnsupportTypeException.php:
--------------------------------------------------------------------------------
1 | type = $type;
15 | $message = "unsupport type \"{$type}\".";
16 | parent::__construct($message, $code, $previous);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Wandu/Event/Commands/Events/NormalPing.php:
--------------------------------------------------------------------------------
1 | message = $message;
15 | }
16 |
17 | /**
18 | * @return mixed
19 | */
20 | public function getMessage()
21 | {
22 | return $this->message;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Serializer/JsonSerializer.php:
--------------------------------------------------------------------------------
1 | =7.1",
6 | "psr/simple-cache": "^1",
7 | "doctrine/annotations": "~1.6",
8 | "wandu/collection": "^4.0"
9 | },
10 | "autoload": {
11 | "psr-4": {
12 | "Wandu\\Annotation\\": ""
13 | }
14 | },
15 | "extra": {
16 | "branch-alias": {
17 | "dev-master": "4.0-dev"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Contracts/DumperInterface.php:
--------------------------------------------------------------------------------
1 | =7.1",
6 | "illuminate/database": "^5.6",
7 | "psr/container": "^1",
8 | "wandu/migrator": "^4.0"
9 | },
10 | "autoload": {
11 | "psr-4": {
12 | "Wandu\\Service\\Eloquent\\": ""
13 | }
14 | },
15 | "extra": {
16 | "branch-alias": {
17 | "dev-master": "4.0-dev"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Wandu/Event/Commands/Listeners/QueuePong.php:
--------------------------------------------------------------------------------
1 | getMessage()}\n";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Contracts/CookieJarInterface.php:
--------------------------------------------------------------------------------
1 | attributeKeys = $attributeKeys;
14 | $keys = implode(', ', $attributeKeys);
15 | $this->message = "cannot get path, at least {$keys} is required.";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Wandu/View/Contracts/RenderInterface.php:
--------------------------------------------------------------------------------
1 | =7.1"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Event\\": ""
12 | }
13 | },
14 | "suggest": {
15 | "wandu/q": "for queue event."
16 | },
17 | "extra": {
18 | "branch-alias": {
19 | "dev-master": "4.0-dev"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Router/Contracts/RouteInformation.php:
--------------------------------------------------------------------------------
1 | "string",
12 | "address?" => "string",
13 | "lat?" => "float",
14 | "lng?" => "float",
15 | ];
16 | }
17 |
18 | public function map(array $attributes = [])
19 | {
20 | return new SamplePoint($attributes);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Config/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/config",
3 | "description": "Simple Config Based On Dot Array.",
4 | "license": "MIT",
5 | "require": {
6 | "php": ">=7.1"
7 | },
8 | "autoload": {
9 | "psr-4": {
10 | "Wandu\\Config\\": ""
11 | }
12 | },
13 | "suggest": {
14 | "m1/env": "for the Env Loader.",
15 | "symfony/yaml": "for the Yaml Loader."
16 | },
17 | "extra": {
18 | "branch-alias": {
19 | "dev-master": "4.0-dev"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Event/Listener/CallableListener.php:
--------------------------------------------------------------------------------
1 | handler = $handler;
14 | }
15 |
16 | /**
17 | * {@inheritdoc}
18 | */
19 | public function call(array $arguments = [])
20 | {
21 | call_user_func_array($this->handler, $arguments);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/Q/Adapter/BeanstalkdAdapterTest.php:
--------------------------------------------------------------------------------
1 | queue = new BeanstalkdAdapter($beans, uniqid('phpunit_'));
14 | } catch (ConnectionException $e) {
15 | static::markTestSkipped("cannot connect to beanstalkd");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Wandu/Console/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/console",
3 | "description": "Symfony Console Wrapper With DI Container.",
4 | "license": "MIT",
5 | "require": {
6 | "php": ">=7.1",
7 | "symfony/console": "~4.0"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Console\\": ""
12 | }
13 | },
14 | "suggest": {
15 | "psy/psysh": "for the Psysh command."
16 | },
17 | "extra": {
18 | "branch-alias": {
19 | "dev-master": "4.0-dev"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/DateTime/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/datetime",
3 | "description": "Date And Time.",
4 | "keywords": ["wandu", "datetime", "date", "time"],
5 | "license": "MIT",
6 | "require": {
7 | "php": ">=7.1"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\DateTime\\": ""
12 | }
13 | },
14 | "suggest": {
15 | "nesbot/carbon": "for Carbon based methods"
16 | },
17 | "extra": {
18 | "branch-alias": {
19 | "dev-master": "4.0-dev"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/AfterTester.php:
--------------------------------------------------------------------------------
1 | criteria = $criteria;
14 | }
15 |
16 | /**
17 | * {@inheritdoc}
18 | */
19 | public function test($data, $origin = null, array $keys = []): bool
20 | {
21 | return strtotime($this->criteria) <= $data;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/BeforeTester.php:
--------------------------------------------------------------------------------
1 | criteria = $criteria;
14 | }
15 |
16 | /**
17 | * {@inheritdoc}
18 | */
19 | public function test($data, $origin = null, array $keys = []): bool
20 | {
21 | return strtotime($this->criteria) >= $data;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Wandu/Foundation/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/foundation",
3 | "description": "Wandu Framework Kernel.",
4 | "license": "MIT",
5 | "require": {
6 | "php": ">=7.1",
7 | "filp/whoops": "~2.1",
8 | "wandu/di": "^4.0"
9 | },
10 | "autoload": {
11 | "psr-4": {
12 | "Wandu\\Foundation\\": ""
13 | },
14 | "files" : [
15 | "functions.php"
16 | ]
17 | },
18 | "extra": {
19 | "branch-alias": {
20 | "dev-master": "4.0-dev"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Exception/TesterNotFoundException.php:
--------------------------------------------------------------------------------
1 | name = $name;
14 | parent::__construct("tester \"{$name}\" not found.");
15 | }
16 |
17 | /**
18 | * @return string
19 | */
20 | public function getName()
21 | {
22 | return $this->name;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/MinTester.php:
--------------------------------------------------------------------------------
1 | min = $min;
17 | }
18 |
19 | /**
20 | * {@inheritdoc}
21 | */
22 | public function test($data, $origin = null, array $keys = []): bool
23 | {
24 | return $data >= $this->min;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/migrator",
3 | "description": "Simple Database Migrator",
4 | "keywords": ["database", "migrator"],
5 | "license": "MIT",
6 | "require": {
7 | "php": ">=7.1"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Migrator\\": ""
12 | }
13 | },
14 | "suggest": {
15 | "wandu/service-eloquent": "for Laravel Eloquent database."
16 | },
17 | "extra": {
18 | "branch-alias": {
19 | "dev-master": "4.0-dev"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Q/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/q",
3 | "description": "Very Simple Queue.",
4 | "keywords": ["wandu", "queue"],
5 | "license": "MIT",
6 | "require": {
7 | "php": ">=7.1"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Q\\": ""
12 | }
13 | },
14 | "suggest": {
15 | "aws/aws-sdk-php": "for SQS queue.",
16 | "pda/pheanstalk": "for Beanstalkd queue."
17 | },
18 | "extra": {
19 | "branch-alias": {
20 | "dev-master": "4.0-dev"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Contracts/Adapter.php:
--------------------------------------------------------------------------------
1 | attributes = $attributes;
16 | }
17 |
18 | /**
19 | * @param string $name
20 | * @return mixed
21 | */
22 | public function __get($name)
23 | {
24 | return $this->attributes[$name];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Console/Commands/PsyshCommand.php:
--------------------------------------------------------------------------------
1 | shell = $shell;
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | */
23 | public function execute()
24 | {
25 | return $this->shell->run();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/validator",
3 | "description": "Perfect Validator Library, Maybe.",
4 | "license": "MIT",
5 | "require": {
6 | "php": ">=7.1"
7 | },
8 | "autoload": {
9 | "psr-4": {
10 | "Wandu\\Validator\\": ""
11 | },
12 | "files" : [
13 | "functions.php"
14 | ]
15 | },
16 | "suggest": {
17 | "egulias/email-validator": "for Email validator."
18 | },
19 | "extra": {
20 | "branch-alias": {
21 | "dev-master": "4.0-dev"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Wandu Framework Contribution Guide
2 | ==================================
3 |
4 | Thank you for considering contributing.
5 |
6 | ## Document
7 |
8 | - do not edit `README.md` directly. edit `README.ok.md`. use
9 | [okreadme](https://github.com/wan2land/okreadme) that is pre-processor of Markdown.
10 |
11 | ## Test
12 |
13 | - [PHPUnit](https://phpunit.de/)
14 |
15 | ## Coding Style
16 |
17 | - [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) : Coding Style Guide
18 | - [PHPDoc](https://www.phpdoc.org/docs/latest/index.html) : PHP Comment Style Guide
19 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/Caster/CarbonCaster.php:
--------------------------------------------------------------------------------
1 | timezone = $timezone;
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | */
23 | public function cast($value)
24 | {
25 | return new Carbon($value, $this->timezone);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Foundation/Contracts/Bootstrap.php:
--------------------------------------------------------------------------------
1 | max = $max;
17 | }
18 |
19 | /**
20 | * {@inheritdoc}
21 | */
22 | public function test($data, $origin = null, array $keys = []): bool
23 | {
24 | if ($data === null) return false;
25 | return $data <= $this->max;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/RegExpTester.php:
--------------------------------------------------------------------------------
1 | pattern = $pattern;
17 | }
18 |
19 | /**
20 | * {@inheritdoc}
21 | */
22 | public function test($data, $origin = null, array $keys = []): bool
23 | {
24 | return @preg_match($this->pattern, $data) > 0;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Exception/InvalidValueException.php:
--------------------------------------------------------------------------------
1 | types = $types;
17 | parent::__construct('invalid value.');
18 | }
19 |
20 | /**
21 | * @return array
22 | */
23 | public function getTypes()
24 | {
25 | return $this->types;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tests/Restifier/Sample/SampleCustomerTransformer.php:
--------------------------------------------------------------------------------
1 | $customer->address,
15 | ];
16 | }
17 |
18 | public function paymentmethods(SampleCustomer $customer)
19 | {
20 | return [
21 | 'paymentmethods' => $customer->paymentmethods,
22 | ];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Adapter/NullAdapter.php:
--------------------------------------------------------------------------------
1 | attributes = $attributes;
16 | }
17 |
18 | /**
19 | * @param string $name
20 | * @return mixed
21 | */
22 | public function __get($name)
23 | {
24 | return $this->attributes[$name];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/README.md:
--------------------------------------------------------------------------------
1 | Wandu Caster
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/caster)
5 | [](https://packagist.org/packages/wandu/caster)
6 | [](https://packagist.org/packages/wandu/caster)
7 | [](https://packagist.org/packages/wandu/caster)
8 |
9 | Perfect Type Casting Library.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/caster
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Config/Exception/CannotLoadException.php:
--------------------------------------------------------------------------------
1 | path = $path;
17 | $message = "cannot load {$path}";
18 | parent::__construct($message);
19 | }
20 |
21 | /**
22 | * @return string
23 | */
24 | public function getPath(): string
25 | {
26 | return $this->path;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Exception/ClassNotFoundException.php:
--------------------------------------------------------------------------------
1 | className = $className;
14 | $this->message = "Class '{$className}' not found in {$this->getFile()} code on line {$this->getLine()}";
15 | }
16 |
17 | /**
18 | * @return string
19 | */
20 | public function getClassName()
21 | {
22 | return $this->className;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Caster
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/caster)
5 | [](https://packagist.org/packages/wandu/caster)
6 | [](https://packagist.org/packages/wandu/caster)
7 | [](https://packagist.org/packages/wandu/caster)
8 |
9 | Perfect Type Casting Library.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/caster
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Annotations/Table.php:
--------------------------------------------------------------------------------
1 | cast('00:00:00')
16 | );
17 |
18 | static::assertEquals(
19 | new Time(80),
20 | $caster->cast(80)
21 | );
22 | static::assertEquals(
23 | new Time(123),
24 | $caster->cast('123')
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/caster",
3 | "description": "Perfect Type Casting Library.",
4 | "keywords": ["wandu", "type cast"],
5 | "license": "MIT",
6 | "require": {
7 | "php": ">=7.1"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Wandu\\Caster\\": ""
12 | }
13 | },
14 | "suggest": {
15 | "nesbot/carbon": "for datetime caster by CarbonCaster.",
16 | "wandu/datetime": "for date caster by DateCaster, for time caster by TimeCaster."
17 | },
18 | "extra": {
19 | "branch-alias": {
20 | "dev-master": "4.0-dev"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Exception/CannotFindParameterException.php:
--------------------------------------------------------------------------------
1 | parameter = $parameter;
17 | $this->message = "cannot find parameter \"{$parameter}\".";
18 | }
19 |
20 | /**
21 | * @return string
22 | */
23 | public function getParameter()
24 | {
25 | return $this->parameter;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/View/README.md:
--------------------------------------------------------------------------------
1 | Wandu View
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/view)
5 | [](https://packagist.org/packages/wandu/view)
6 | [](https://packagist.org/packages/wandu/view)
7 | [](https://packagist.org/packages/wandu/view)
8 |
9 | ## Installation
10 |
11 | ```bash
12 | composer require wandu/view
13 | ```
14 |
15 | ## Websites
16 |
17 | - [wandu.github.io](https://wandu.github.io)
18 |
--------------------------------------------------------------------------------
/src/Wandu/View/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu View
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/view)
5 | [](https://packagist.org/packages/wandu/view)
6 | [](https://packagist.org/packages/wandu/view)
7 | [](https://packagist.org/packages/wandu/view)
8 |
9 | ## Installation
10 |
11 | ```bash
12 | composer require wandu/view
13 | ```
14 |
15 | ## Websites
16 |
17 | - [wandu.github.io](https://wandu.github.io)
18 |
--------------------------------------------------------------------------------
/src/Wandu/Restifier/Contracts/Restifiable.php:
--------------------------------------------------------------------------------
1 | =7.1",
7 | "doctrine/annotations": "~1.6",
8 | "wandu/caster": "^4.0",
9 | "wandu/collection": "^4.0",
10 | "wandu/di": "^4.0"
11 | },
12 | "autoload": {
13 | "psr-4": {
14 | "Wandu\\Database\\": ""
15 | }
16 | },
17 | "suggest": {
18 | "symfony/cache": "for the CachableMetadataRader cache."
19 | },
20 | "extra": {
21 | "branch-alias": {
22 | "dev-master": "4.0-dev"
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Wandu/Service/GuzzleHttp/GuzzleServiceProvider.php:
--------------------------------------------------------------------------------
1 | bind(Client::class, function (Config $config) {
18 | return new Client($config->get('guzzlehttp.guzzle', []));
19 | });
20 | $app->alias(ClientInterface::class, Client::class);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/ValidatorServiceProvider.php:
--------------------------------------------------------------------------------
1 | bind(TesterLoader::class)->assign('testers', ['value' => $this->testers]);
18 | $app->bind(ValidatorFactory::class)->after(function (ValidatorFactory $factory) {
19 | return ValidatorFactory::$instance = $factory;
20 | });
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/Caster/TimeCaster.php:
--------------------------------------------------------------------------------
1 | timezone = $timezone;
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | */
23 | public function cast($value)
24 | {
25 | if (is_numeric($value)) return new Time($value, $this->timezone);
26 | return Time::fromText($value, $this->timezone);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Exception/CannotChangeException.php:
--------------------------------------------------------------------------------
1 | name = $name;
18 | $this->message = "it cannot be changed; \"{$name}\".";
19 | }
20 |
21 | /**
22 | * @return string
23 | */
24 | public function getName()
25 | {
26 | return $this->name;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Attribute/LazyAttribute.php:
--------------------------------------------------------------------------------
1 | handler = $handler;
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | */
23 | public function getAttribute(ServerRequestInterface $request)
24 | {
25 | return call_user_func($this->handler, $request);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tests/Http/Session/Handler/GlobalHandlerTest.php:
--------------------------------------------------------------------------------
1 | adapter = new GlobalHandler();
11 | }
12 |
13 | public function testMultiIdSession()
14 | {
15 | static::addToAssertionCount(1); // do nothing
16 | }
17 |
18 | public function testGarbageCollection()
19 | {
20 | static::addToAssertionCount(1); // do nothing
21 | }
22 |
23 | protected function getCountOfSessionFiles()
24 | {
25 | // do nothing
26 | return 0;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Exception/NullReferenceException.php:
--------------------------------------------------------------------------------
1 | class = $class;
18 | $this->message = "it was not found; \"{$class}\".";
19 | }
20 |
21 | /**
22 | * @return string
23 | */
24 | public function getClass()
25 | {
26 | return $this->class;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Exception/DriverNotFoundException.php:
--------------------------------------------------------------------------------
1 | code = static::CODE_UNSUPPORTED;
18 | $this->message = "\"{$driver}\" is not supported.";
19 | } else {
20 | $this->code = static::CODE_UNDEFINED;
21 | $this->message = "driver is not defined.";
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Wandu/Database/README.md:
--------------------------------------------------------------------------------
1 | Wandu Database
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/database)
5 | [](https://packagist.org/packages/wandu/database)
6 | [](https://packagist.org/packages/wandu/database)
7 | [](https://packagist.org/packages/wandu/database)
8 |
9 | ## Installation
10 |
11 | ```bash
12 | composer require wandu/database
13 | ```
14 |
15 | ## Websites
16 |
17 | - [wandu.github.io](https://wandu.github.io)
18 |
--------------------------------------------------------------------------------
/src/Wandu/Sanitizer/Sanitizer.php:
--------------------------------------------------------------------------------
1 | rule = $rule;
18 | $this->validator = $validator;
19 | }
20 |
21 | public function sanitize($data)
22 | {
23 | $this->validator->assert($data);
24 | return $this->rule->map($data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/LengthMinTester.php:
--------------------------------------------------------------------------------
1 | min = $min;
17 | }
18 |
19 | /**
20 | * {@inheritdoc}
21 | */
22 | public function test($data, $origin = null, array $keys = []): bool
23 | {
24 | if (is_array($data)) {
25 | return count($data) >= $this->min;
26 | }
27 | return mb_strlen($data, 'utf-8') >= $this->min;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Wandu/Database/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Database
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/database)
5 | [](https://packagist.org/packages/wandu/database)
6 | [](https://packagist.org/packages/wandu/database)
7 | [](https://packagist.org/packages/wandu/database)
8 |
9 | ## Installation
10 |
11 | ```bash
12 | composer require wandu/database
13 | ```
14 |
15 | ## Websites
16 |
17 | - [wandu.github.io](https://wandu.github.io)
18 |
--------------------------------------------------------------------------------
/src/Wandu/Event/Contracts/EventEmitter.php:
--------------------------------------------------------------------------------
1 | sql = $sql;
15 | $this->bindings = $bindings;
16 | }
17 |
18 | /**
19 | * @return string
20 | */
21 | public function getSql(): string
22 | {
23 | return $this->sql;
24 | }
25 |
26 | /**
27 | * @return array
28 | */
29 | public function getBindings(): array
30 | {
31 | return $this->bindings;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Wandu/Event/Listener/WorkerListener.php:
--------------------------------------------------------------------------------
1 | worker = $worker;
18 | $this->className = $className;
19 | }
20 |
21 | /**
22 | * {@inheritdoc}
23 | */
24 | public function call(array $arguments = [])
25 | {
26 | $this->worker->work($this->className, 'call', [$arguments]);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Adapter/BeanstalkdJob.php:
--------------------------------------------------------------------------------
1 | job = $job;
15 | }
16 |
17 | /**
18 | * @return \Pheanstalk\Job
19 | */
20 | public function getJob(): PheanstalkJob
21 | {
22 | return $this->job;
23 | }
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function payload(): string
29 | {
30 | return $this->job->getData();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/UnknownMigrationInformation.php:
--------------------------------------------------------------------------------
1 | id = $id;
15 | }
16 |
17 | /**
18 | * {@inheritdoc}
19 | */
20 | public function getName(): string
21 | {
22 | throw new RuntimeException('name is unknown');
23 | }
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function getId(): string
29 | {
30 | return $this->id;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/Caster/ArrayCaster.php:
--------------------------------------------------------------------------------
1 | closure(Client::class, function (Config $config) {
17 | return new Client($config->get('predis.predis'));
18 | });
19 | }
20 |
21 | /**
22 | * {@inheritdoc}
23 | */
24 | public function boot(ContainerInterface $app)
25 | {
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/DateTime/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu DateTime
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/datetime)
5 | [](https://packagist.org/packages/wandu/datetime)
6 | [](https://packagist.org/packages/wandu/datetime)
7 | [](https://packagist.org/packages/wandu/datetime)
8 |
9 | Date And Time.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/datetime
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/tests/Config/test_php.php:
--------------------------------------------------------------------------------
1 | 'foo string',
4 | 'vendor1' => [
5 | 'service1' => [
6 | 'name' => 'vendor1 service1 name..',
7 | 'path' => 'vendor1 service1 path..',
8 | ],
9 | 'service2' => [
10 | 'name' => 'vendor1 service2 name..',
11 | 'path' => 'vendor1 service2 path..',
12 | ],
13 | ],
14 | 'vendor2' => [
15 | 'service1' => [
16 | 'name' => 'vendor2 service1 name..',
17 | 'path' => 'vendor2 service1 path..',
18 | ],
19 | 'service2' => [
20 | 'name' => 'vendor2 service2 name..',
21 | 'path' => 'vendor2 service2 path..',
22 | ],
23 | ],
24 | ];
--------------------------------------------------------------------------------
/src/Wandu/Http/Parameters/ParsedBody.php:
--------------------------------------------------------------------------------
1 | getParsedBody() : [],
18 | $fallback
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Parameters/QueryParams.php:
--------------------------------------------------------------------------------
1 | getQueryParams() : [],
18 | $fallback
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Wandu/Console/README.md:
--------------------------------------------------------------------------------
1 | Wandu Console
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/console)
5 | [](https://packagist.org/packages/wandu/console)
6 | [](https://packagist.org/packages/wandu/console)
7 | [](https://packagist.org/packages/wandu/console)
8 |
9 | Symfony Console Wrapper With DI Container.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/console
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/LengthMaxTester.php:
--------------------------------------------------------------------------------
1 | max = $max;
17 | }
18 |
19 | /**
20 | * {@inheritdoc}
21 | */
22 | public function test($data, $origin = null, array $keys = []): bool
23 | {
24 | if ($data === null) return false;
25 | if (is_array($data)) {
26 | return count($data) <= $this->max;
27 | }
28 | return mb_strlen($data, 'utf-8') <= $this->max;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Wandu/Console/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Console
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/console)
5 | [](https://packagist.org/packages/wandu/console)
6 | [](https://packagist.org/packages/wandu/console)
7 | [](https://packagist.org/packages/wandu/console)
8 |
9 | Symfony Console Wrapper With DI Container.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/console
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/PropertyTesterAbstract.php:
--------------------------------------------------------------------------------
1 | keys = array_map("trim", explode(".", $criteria));
14 | }
15 |
16 | protected function getProp($origin)
17 | {
18 | $keys = $this->keys;
19 | $prop = $origin;
20 | while (count($keys)) {
21 | $key = array_shift($keys);
22 | if (!isset($prop[$key])) return;
23 | $prop = $prop[$key];
24 | }
25 | return $prop;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/DateTime/README.md:
--------------------------------------------------------------------------------
1 | Wandu Foundation
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/foundation)
5 | [](https://packagist.org/packages/wandu/foundation)
6 | [](https://packagist.org/packages/wandu/foundation)
7 | [](https://packagist.org/packages/wandu/foundation)
8 |
9 | Wandu Framework Kernel.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/foundation
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/Foundation/README.md:
--------------------------------------------------------------------------------
1 | Wandu Foundation
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/foundation)
5 | [](https://packagist.org/packages/wandu/foundation)
6 | [](https://packagist.org/packages/wandu/foundation)
7 | [](https://packagist.org/packages/wandu/foundation)
8 |
9 | Wandu Framework Kernel.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/datetime
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/Sanitizer/README.md:
--------------------------------------------------------------------------------
1 | Wandu Sanitizer
2 | ===============
3 |
4 | [](https://packagist.org/packages/wandu/sanitizer)
5 | [](https://packagist.org/packages/wandu/sanitizer)
6 | [](https://packagist.org/packages/wandu/sanitizer)
7 | [](https://packagist.org/packages/wandu/sanitizer)
8 |
9 | Sanitizing Library.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/sanitizer
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Query/Expression/WhereExpression.php:
--------------------------------------------------------------------------------
1 | expressions as $index => $expression) {
16 | if ($index) {
17 | $sql .= ' ' . $this->operators[$index] . ' ';
18 | }
19 | $sql .= $expression->toSql();
20 | }
21 | return $sql ? 'WHERE '. $sql : '';
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Wandu/Foundation/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Foundation
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/foundation)
5 | [](https://packagist.org/packages/wandu/foundation)
6 | [](https://packagist.org/packages/wandu/foundation)
7 | [](https://packagist.org/packages/wandu/foundation)
8 |
9 | Wandu Framework Kernel.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/foundation
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Adapter/ArrayJob.php:
--------------------------------------------------------------------------------
1 | identifier = $identifier;
17 | $this->payload = $payload;
18 | }
19 |
20 | /**
21 | * @return string
22 | */
23 | public function getIdentifier()
24 | {
25 | return $this->identifier;
26 | }
27 |
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function payload(): string
32 | {
33 | return $this->payload;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Wandu/Sanitizer/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Sanitizer
2 | ===============
3 |
4 | [](https://packagist.org/packages/wandu/sanitizer)
5 | [](https://packagist.org/packages/wandu/sanitizer)
6 | [](https://packagist.org/packages/wandu/sanitizer)
7 | [](https://packagist.org/packages/wandu/sanitizer)
8 |
9 | Sanitizing Library.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/sanitizer
15 | ```
16 |
17 | ## Websites
18 |
19 | - [wandu.github.io](https://wandu.github.io)
20 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Providers/Cleentfaar/SlackServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(ApiClient::class, function (Config $config) {
17 | return new ApiClient($config->get('cleentfaar.slack.token'));
18 | });
19 | }
20 |
21 | /**
22 | * {@inheritdoc}
23 | */
24 | public function boot(ContainerInterface $app)
25 | {
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Adapter/SqsJob.php:
--------------------------------------------------------------------------------
1 | receiptHandler = $receiptHandler;
17 | $this->body = $body;
18 | }
19 |
20 | /**
21 | * @return string
22 | */
23 | public function getReceiptHandler()
24 | {
25 | return $this->receiptHandler;
26 | }
27 |
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function payload(): string
32 | {
33 | return $this->body;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/README.md:
--------------------------------------------------------------------------------
1 | Wandu Validator
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/validator)
5 | [](https://packagist.org/packages/wandu/validator)
6 | [](https://packagist.org/packages/wandu/validator)
7 | [](https://packagist.org/packages/wandu/validator)
8 |
9 | Perfect Validator Library, Maybe.
10 |
11 | ## Installation
12 |
13 | `composer require wandu/validator`
14 |
15 | ## Websites
16 |
17 | - [wandu.github.io/docs/validator](https://wandu.github.io/docs/validator)
18 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Validator
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/validator)
5 | [](https://packagist.org/packages/wandu/validator)
6 | [](https://packagist.org/packages/wandu/validator)
7 | [](https://packagist.org/packages/wandu/validator)
8 |
9 | Perfect Validator Library, Maybe.
10 |
11 | ## Installation
12 |
13 | `composer require wandu/validator`
14 |
15 | ## Websites
16 |
17 | - [wandu.github.io/docs/validator](https://wandu.github.io/docs/validator)
18 |
--------------------------------------------------------------------------------
/src/Wandu/Router/Contracts/LoaderInterface.php:
--------------------------------------------------------------------------------
1 | pattern = $pattern;
14 | }
15 |
16 | /**
17 | * {@inheritdoc}
18 | */
19 | public function test(string $path): bool
20 | {
21 | return file_exists($path) && preg_match($this->pattern, pathinfo($path)['basename']);
22 | }
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | public function load(string $path)
28 | {
29 | return json_decode(file_get_contents($path), true);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Monolog/README.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Monolog
2 | ==========================
3 |
4 | [](https://packagist.org/packages/wandu/service-monolog)
5 | [](https://packagist.org/packages/wandu/service-monolog)
6 | [](https://packagist.org/packages/wandu/service-monolog)
7 | [](https://packagist.org/packages/wandu/service-monolog)
8 |
9 | Monolog Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-monolog
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Monolog/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Monolog
2 | ==========================
3 |
4 | [](https://packagist.org/packages/wandu/service-monolog)
5 | [](https://packagist.org/packages/wandu/service-monolog)
6 | [](https://packagist.org/packages/wandu/service-monolog)
7 | [](https://packagist.org/packages/wandu/service-monolog)
8 |
9 | Monolog Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-monolog
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Service/NeomerxCors/README.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Monolog
2 | ==========================
3 |
4 | [](https://packagist.org/packages/wandu/service-monolog)
5 | [](https://packagist.org/packages/wandu/service-monolog)
6 | [](https://packagist.org/packages/wandu/service-monolog)
7 | [](https://packagist.org/packages/wandu/service-monolog)
8 |
9 | Monolog Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-monolog
15 | ```
16 |
--------------------------------------------------------------------------------
/tests/Http/Session/Handler/FileHandlerTest.php:
--------------------------------------------------------------------------------
1 | adapter = new FileHandler(__DIR__ . '/sessions');
14 | }
15 |
16 | public function tearDown()
17 | {
18 | parent::tearDown();
19 | $this->deleteAll(__DIR__ . '/sessions');
20 | }
21 |
22 | /**
23 | * {@inheritdoc}
24 | */
25 | protected function getCountOfSessionFiles()
26 | {
27 | return iterator_count(new \DirectoryIterator(__DIR__ . '/sessions'));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Wandu/Http/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/http",
3 | "description": "Http Psr-7 Implementation with Session and Cookie.",
4 | "keywords": ["wandu", "http", "psr7", "session", "cookie"],
5 | "license": "MIT",
6 | "require": {
7 | "php": ">=7.1",
8 | "psr/http-message": "^1"
9 | },
10 | "autoload": {
11 | "psr-4": {
12 | "Wandu\\Http\\": ""
13 | },
14 | "files" : [
15 | "functions.php"
16 | ]
17 | },
18 | "provide": {
19 | "psr/http-message-implementation": "1.0"
20 | },
21 | "suggest": {
22 | "predis/predis": "for the Redis session."
23 | },
24 | "extra": {
25 | "branch-alias": {
26 | "dev-master": "4.0-dev"
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Eloquent/README.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Eloquent
2 | =======================
3 |
4 | [](https://packagist.org/packages/wandu/service-eloquent)
5 | [](https://packagist.org/packages/wandu/service-eloquent)
6 | [](https://packagist.org/packages/wandu/service-eloquent)
7 | [](https://packagist.org/packages/wandu/service-eloquent)
8 |
9 | Eloquent Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-eloquent
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Eloquent/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Eloquent
2 | =======================
3 |
4 | [](https://packagist.org/packages/wandu/service-eloquent)
5 | [](https://packagist.org/packages/wandu/service-eloquent)
6 | [](https://packagist.org/packages/wandu/service-eloquent)
7 | [](https://packagist.org/packages/wandu/service-eloquent)
8 |
9 | Eloquent Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-eloquent
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/View/PhpViewServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(RenderInterface::class, function (Config $config) {
20 | return new PhpView($config->get('view.path'));
21 | });
22 | }
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | public function boot(ContainerInterface $app)
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Psr/Stream.php:
--------------------------------------------------------------------------------
1 | =7.1",
8 | "psr/container": "^1",
9 | "psr/http-message": "^1",
10 | "http-interop/http-middleware": "^0.4.1",
11 | "nikic/fast-route": "^1.2"
12 | },
13 | "autoload": {
14 | "psr-4": {
15 | "Wandu\\Router\\": ""
16 | }
17 | },
18 | "extra": {
19 | "branch-alias": {
20 | "dev-master": "4.0-dev"
21 | }
22 | },
23 | "suggest": {
24 | "wandu/di": "for the Wandu class loader.",
25 | "wandu/http": "for the Wandu responsifier."
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Config/Contracts/Config.php:
--------------------------------------------------------------------------------
1 | pattern = $pattern;
15 | }
16 |
17 | /**
18 | * {@inheritdoc}
19 | */
20 | public function test(string $path): bool
21 | {
22 | return file_exists($path) && preg_match($this->pattern, pathinfo($path)['basename']);
23 | }
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function load(string $path)
29 | {
30 | return (new Parser(file_get_contents($path)))->getContent();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/Config/Loader/YmlLoader.php:
--------------------------------------------------------------------------------
1 | pattern = $pattern;
15 | }
16 |
17 | /**
18 | * {@inheritdoc}
19 | */
20 | public function test(string $path): bool
21 | {
22 | return file_exists($path) && preg_match($this->pattern, pathinfo($path)['basename']);
23 | }
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function load(string $path)
29 | {
30 | return Yaml::parse(file_get_contents($path));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/Http/README.md:
--------------------------------------------------------------------------------
1 | Wandu Http
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/http)
5 | [](https://packagist.org/packages/wandu/http)
6 | [](https://packagist.org/packages/wandu/http)
7 | [](https://packagist.org/packages/wandu/http)
8 |
9 | Http Psr-7 Implementation with Session and Cookie. More details: [www.php-fig.org/psr/psr-7](http://www.php-fig.org/psr/psr-7/)
10 |
11 | ## Websites
12 |
13 | - [wandu.github.io/docs/http](https://wandu.github.io/docs/http)
14 |
15 | ## Reference
16 |
17 | - [phly/http](https://github.com/phly/http).
18 |
--------------------------------------------------------------------------------
/src/Wandu/Http/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Http
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/http)
5 | [](https://packagist.org/packages/wandu/http)
6 | [](https://packagist.org/packages/wandu/http)
7 | [](https://packagist.org/packages/wandu/http)
8 |
9 | Http Psr-7 Implementation with Session and Cookie. More details: [www.php-fig.org/psr/psr-7](http://www.php-fig.org/psr/psr-7/)
10 |
11 | ## Websites
12 |
13 | - [wandu.github.io/docs/http](https://wandu.github.io/docs/http)
14 |
15 | ## Reference
16 |
17 | - [phly/http](https://github.com/phly/http).
18 |
--------------------------------------------------------------------------------
/src/Wandu/Service/GuzzleHttp/README.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Guzzle HTTP
2 | ==========================
3 |
4 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
5 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
6 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
7 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
8 |
9 | Guzzle HTTP Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-guzzlehttp
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Service/GuzzleHttp/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Guzzle HTTP
2 | ==========================
3 |
4 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
5 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
6 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
7 | [](https://packagist.org/packages/wandu/service-guzzlehttp)
8 |
9 | Guzzle HTTP Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-guzzlehttp
15 | ```
16 |
--------------------------------------------------------------------------------
/tests/Validator/Sample/SampleCharterRule.php:
--------------------------------------------------------------------------------
1 | new SamplePointRule(),
12 | "arrival" => function () {
13 | return [
14 | "name" => "string",
15 | "address?" => "string",
16 | "lat?" => "float",
17 | "lng?" => "float",
18 | ];
19 | },
20 | "waypoints[]" => new SamplePointRule(),
21 | "timeToGo" => "int",
22 | "timeToBack?" => ["int", "greater_than:timeToGo"],
23 | "people" => "int",
24 | ];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/DI/Descriptor/FreezeTest.php:
--------------------------------------------------------------------------------
1 | instance('obj1', new stdClass);
19 | $container->destroy('obj1');
20 |
21 | $exception = static::catchException(function () use ($container) {
22 | $container->instance('obj2', new stdClass)->freeze();
23 | $container->destroy('obj2');
24 | });
25 |
26 | static::assertInstanceOf(CannotChangeException::class, $exception);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/Service/NeomerxCors/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Service, Neomerx Cors
2 | ===========================
3 |
4 | [](https://packagist.org/packages/wandu/service-neomerxcors)
5 | [](https://packagist.org/packages/wandu/service-neomerxcors)
6 | [](https://packagist.org/packages/wandu/service-neomerxcors)
7 | [](https://packagist.org/packages/wandu/service-neomerxcors)
8 |
9 | Neomerx Cors Service Provider for Wandu Framework.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/service-neomerxcors
15 | ```
16 |
--------------------------------------------------------------------------------
/src/Wandu/Config/ConfigServiceProvider.php:
--------------------------------------------------------------------------------
1 | bind(ConfigContract::class, Config::class)->after(function (Config $config) {
15 | $config->pushLoader(new PathLoader([
16 | new YmlLoader(),
17 | ]));
18 | $config->pushLoader(new YmlLoader());
19 | return $config;
20 | });
21 | }
22 |
23 | public function boot(ContainerInterface $app)
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Query/TruncateQuery.php:
--------------------------------------------------------------------------------
1 | table = $table;
22 | }
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | public function toSql()
28 | {
29 | return "TRUNCATE TABLE `{$this->table}`";
30 | }
31 |
32 | /**
33 | * {@inheritdoc}
34 | */
35 | public function getBindings()
36 | {
37 | return [];
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tests/Validator/Sample/SampleCharterValidator.php:
--------------------------------------------------------------------------------
1 | new SamplePointRule(),
12 | "arrival" => function () {
13 | return [
14 | "name" => "string",
15 | "address?" => "string",
16 | "lat?" => "float",
17 | "lng?" => "float",
18 | ];
19 | },
20 | "waypoints[]" => new SamplePointRule(),
21 | "timeToGo" => "int",
22 | "timeToBack?" => ["int", "greater_than:timeToGo"],
23 | "people" => "int",
24 | ];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Query/DeleteQuery.php:
--------------------------------------------------------------------------------
1 | table = $table;
19 | }
20 |
21 | /**
22 | * {@inheritdoc}
23 | */
24 | public function toSql()
25 | {
26 | $parts = ['DELETE FROM ' . Helper::normalizeName($this->table)];
27 | if ($part = parent::toSql()) {
28 | $parts[] = $part;
29 | }
30 | return implode(' ', $parts);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Providers/Doctrine/AnnotationServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(Reader::class, function (Cache $cache, Config $config) {
17 | return new CachedReader(new AnnotationReader(), $cache, $config->get('debug', true));
18 | });
19 | }
20 |
21 | public function boot(ContainerInterface $app)
22 | {
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Query/RawQuery.php:
--------------------------------------------------------------------------------
1 | query = $query;
21 | $this->bindings = $bindings;
22 | }
23 |
24 | /**
25 | * @return string
26 | */
27 | public function toSql()
28 | {
29 | return $this->query;
30 | }
31 |
32 | /**
33 | * @return array
34 | */
35 | public function getBindings()
36 | {
37 | return $this->bindings;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Wandu/Console/ConsoleServiceProvider.php:
--------------------------------------------------------------------------------
1 | bind(Application::class)->assignMany([
20 | 'name', ['value' => $this->name],
21 | 'version', ['value' => $this->version],
22 | ]);
23 | }
24 |
25 | public function boot(ContainerInterface $app)
26 | {
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/Contracts/Adapter.php:
--------------------------------------------------------------------------------
1 | closure(Caster::class, function (ContainerInterface $app, Config $config) {
16 | return new Caster(array_map(function ($caster) use ($app) {
17 | return $app->get($caster);
18 | }, $config->get('caster.casters', [])));
19 | });
20 | $app->alias(CastManagerInterface::class, Caster::class);
21 | }
22 |
23 | /**
24 | * {@inheritdoc}
25 | */
26 | public function boot(ContainerInterface $app)
27 | {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Wandu/DI/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu DI
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/di)
5 | [](https://packagist.org/packages/wandu/di)
6 | [](https://packagist.org/packages/wandu/di)
7 | [](https://packagist.org/packages/wandu/di)
8 |
9 | Dependency Injection Container. Support Auto-Resolve and Auto-Wiring. Also Perfect Fit to PSR-11.
10 |
11 | inspired by [pimple](http://pimple.sensiolabs.org) and [Laravel Container](http://laravel.com/docs/5.1/container)
12 |
13 | ## Installation
14 |
15 | ```bash
16 | composer require wandu/di
17 | ```
18 |
19 | ## Websites
20 |
21 | - [wandu.github.io/docs/di](https://wandu.github.io/docs/di)
22 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Monolog/MonologServiceProvider.php:
--------------------------------------------------------------------------------
1 | bind(LoggerInterface::class, Logger::class)
19 | ->assign('name', ['value' => 'wandu'])
20 | ->after(function (Logger $logger, Config $config) {
21 | if ($path = $config->get('log.path')) {
22 | $logger->pushHandler(new StreamHandler($path));
23 | }
24 | return $logger;
25 | });
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tests/Restifier/Sample/SampleUserTransformer.php:
--------------------------------------------------------------------------------
1 | $user->username,
12 | 'customer' => $restifier->restify($user->customer),
13 | ];
14 | }
15 |
16 | public function customer(SampleUser $user, Restifiable $restifier, array $includes = [])
17 | {
18 | return [
19 | 'customer' => $restifier->restify($user->customer, $includes),
20 | ];
21 | }
22 |
23 | public function profile(SampleUser $user, Restifiable $restifier, array $includes = [])
24 | {
25 | return [
26 | 'profile' => $user->profile,
27 | ];
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Wandu/Sanitizer/SanitizerFactory.php:
--------------------------------------------------------------------------------
1 | factory = new ValidatorFactory(
16 | $loader ?: new TesterLoader(),
17 | $normalizer ?: new SanitizerNormalizer()
18 | );
19 | }
20 |
21 | /**
22 | * @param \Wandu\Sanitizer\Contracts\Rule $rule
23 | * @return \Wandu\Sanitizer\Sanitizer
24 | */
25 | public function factory(Rule $rule)
26 | {
27 | return new Sanitizer($rule, $this->factory->factory($rule->rule()));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Psr/Message.php:
--------------------------------------------------------------------------------
1 | body = $body;
20 | foreach ($headers as $name => $header) {
21 | $lowerName = strtolower($name);
22 | $this->headerNames[$lowerName] = $name;
23 | $this->headers[$name] = $this->filterHeaderValue($header);
24 | }
25 | $this->protocolVersion = $protocolVersion;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Wandu/Foundation/functions.php:
--------------------------------------------------------------------------------
1 | get(EventEmitter::class)->trigger($event);
12 | }
13 | }
14 |
15 | namespace Wandu\Foundation
16 | {
17 | use Wandu\Config\Contracts\Config;
18 | use function Wandu\DI\container;
19 |
20 | /**
21 | * @deprecated use function Wandu\DI\container
22 | * @return \Wandu\DI\ContainerInterface
23 | */
24 | function app()
25 | {
26 | return container();
27 | }
28 |
29 | /**
30 | * @param string $name
31 | * @param mixed $default
32 | * @return mixed
33 | */
34 | function config($name, $default = null)
35 | {
36 | return container()->get(Config::class)->get($name, $default);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/MigratorServiceProvider.php:
--------------------------------------------------------------------------------
1 | bind(Configuration::class, function (Config $config) {
16 | return new Configuration([
17 | 'connection' => $config->get('database.migrator.connection'),
18 | 'table' => $config->get('database.migrator.table'),
19 | 'path' => $config->get('database.migrator.path'),
20 | ]);
21 | });
22 | }
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | public function boot(ContainerInterface $app)
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Annotations/HasMany.php:
--------------------------------------------------------------------------------
1 | repository($this->related)->all(function (SelectQuery $query) use ($columnValue) {
32 | return $query->where($this->key, $columnValue);
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Annotations/HasOne.php:
--------------------------------------------------------------------------------
1 | repository($this->related)->first(function (SelectQuery $query) use ($columnValue) {
32 | return $query->where($this->key, $columnValue);
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/EmailTester.php:
--------------------------------------------------------------------------------
1 | validation = $validation;
20 | }
21 |
22 | /**
23 | * {@inheritdoc}
24 | */
25 | public function test($data, $origin = null, array $keys = []): bool
26 | {
27 | return is_string($data) && $this->validation->isValid($data, new EmailLexer());
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/Http/Psr/RequestTest.php:
--------------------------------------------------------------------------------
1 | request = $this->message = new Request();
15 | }
16 |
17 | public function tearDown()
18 | {
19 | Mockery::close();
20 | }
21 |
22 | public function testConstructor()
23 | {
24 | $request = new Request('GET', new Uri('http://wani.kr'));
25 |
26 | static::assertSame('http://wani.kr', $request->getUri()->__toString());
27 |
28 | $request = new Request('GET', 'http://wani.kr');
29 |
30 | static::assertInstanceOf(UriInterface::class, $request->getUri());
31 | static::assertSame('http://wani.kr', $request->getUri()->__toString());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Annotations/BelongsTo.php:
--------------------------------------------------------------------------------
1 | repository($this->related)->first(function (SelectQuery $query) use ($columnValue) {
32 | return $query->where($this->key, $columnValue);
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Query/Expression/RawExpression.php:
--------------------------------------------------------------------------------
1 | expression = $expression;
21 | $this->bindings = $bindings;
22 | }
23 |
24 | /**
25 | * @return string
26 | */
27 | public function toSql()
28 | {
29 | return $this->expression;
30 | }
31 |
32 | /**
33 | * @return array
34 | */
35 | public function getBindings()
36 | {
37 | return $this->bindings;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/Configuration.php:
--------------------------------------------------------------------------------
1 | config = $config;
15 | }
16 |
17 | /**
18 | * @return string
19 | */
20 | public function getPath()
21 | {
22 | return isset($this->config['path']) ? $this->config['path'] : null;
23 | }
24 |
25 | /**
26 | * @return string
27 | */
28 | public function getTable()
29 | {
30 | return isset($this->config['table']) ? $this->config['table'] : null;
31 | }
32 |
33 | /**
34 | * @return string
35 | */
36 | public function getConnection()
37 | {
38 | return isset($this->config['connection']) ? $this->config['connection'] : null;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/Commands/CreateCommand.php:
--------------------------------------------------------------------------------
1 | 'the name for the migration',
15 | ];
16 |
17 | /** @var \Wandu\Migrator\Migrator */
18 | protected $migrator;
19 |
20 | public function __construct(Migrator $migrator)
21 | {
22 | $this->migrator = $migrator;
23 | }
24 |
25 | public function execute()
26 | {
27 | $name = $this->input->getArgument('name');
28 | $filePath = $this->migrator->createTemplate($name);
29 | $this->output->writeln(
30 | 'create .' . str_replace(getcwd(), '', $filePath)
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/LengthBetweenTester.php:
--------------------------------------------------------------------------------
1 | min = $min;
21 | $this->max = $max;
22 | }
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | public function test($data, $origin = null, array $keys = []): bool
28 | {
29 | if (is_array($data) || $data instanceof \Countable) {
30 | $length = count($data);
31 | } elseif (is_string($data)) {
32 | $length = mb_strlen($data, 'utf-8');
33 | }
34 | return $length >= $this->min && $length <= $this->max;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Psr/Request.php:
--------------------------------------------------------------------------------
1 | method = $this->filterMethod($method);
27 | $this->uri = is_string($uri) ? new Uri($uri) : $uri;
28 | parent::__construct($body, $headers, $protocolVersion);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Wandu/Service/Eloquent/EloquentTemplate.php:
--------------------------------------------------------------------------------
1 | param1 = new ParsedBody($this->createRequest($this->param1Attributes));
12 | $this->param2 = new ParsedBody($this->createRequest($this->param2Attributes));
13 | $this->param3 = new ParsedBody($this->createRequest($this->param3Attributes), new Parameter($this->param3FallbackAttributes));
14 | }
15 |
16 | /**
17 | * @param array $attributes
18 | * @return \Psr\Http\Message\ServerRequestInterface
19 | */
20 | private function createRequest(array $attributes = [])
21 | {
22 | $request = Mockery::mock(ServerRequestInterface::class);
23 | $request->shouldReceive('getParsedBody')->andReturn($attributes);
24 | return $request;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/Http/Parameters/QueryParamsTest.php:
--------------------------------------------------------------------------------
1 | param1 = new QueryParams($this->createRequest($this->param1Attributes));
12 | $this->param2 = new QueryParams($this->createRequest($this->param2Attributes));
13 | $this->param3 = new QueryParams($this->createRequest($this->param3Attributes), new Parameter($this->param3FallbackAttributes));
14 | }
15 |
16 | /**
17 | * @param array $attributes
18 | * @return \Psr\Http\Message\ServerRequestInterface
19 | */
20 | private function createRequest(array $attributes = [])
21 | {
22 | $request = Mockery::mock(ServerRequestInterface::class);
23 | $request->shouldReceive('getQueryParams')->andReturn($attributes);
24 | return $request;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 | ./tests
18 |
19 |
20 |
21 |
22 | ./src/
23 |
24 | ./src/Wandu/Installation/skeleton
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/Wandu/Caster/Caster/BooleanCatser.php:
--------------------------------------------------------------------------------
1 | allowedBooleanString = $allowedBooleanString;
20 | }
21 | }
22 |
23 | /**
24 | * {@inheritdoc}
25 | */
26 | public function cast($value)
27 | {
28 | if ($value === null) {
29 | return false;
30 | }
31 | if (in_array($value, $this->allowedBooleanString)) {
32 | return false;
33 | }
34 | return (bool) $value;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/FileMigrationInformation.php:
--------------------------------------------------------------------------------
1 | fileInfo = $fileInfo;
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | */
23 | public function getName(): string
24 | {
25 | return substr($this->fileInfo->getFilename(), 14, -4);
26 | }
27 |
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function getId(): string
32 | {
33 | return substr($this->fileInfo->getFilename(), 0, 13);
34 | }
35 |
36 | public function loadMigrationFile()
37 | {
38 | require_once $this->fileInfo->__toString();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/Commands/DownCommand.php:
--------------------------------------------------------------------------------
1 | 'the migrate id for the rollback',
17 | ];
18 |
19 | /** @var \Wandu\Migrator\Migrator */
20 | protected $manager;
21 |
22 | /**
23 | * @param \Wandu\Migrator\Migrator $manager
24 | */
25 | public function __construct(Migrator $manager)
26 | {
27 | $this->manager = $manager;
28 | }
29 |
30 | public function execute()
31 | {
32 | $id = $this->input->getArgument('id');
33 | $this->manager->down($id);
34 | $this->output->writeln("down {$id}");
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Wandu/DI/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wandu/di",
3 | "description": "Dependency Injection Container. Support Auto-Resolve and Auto-Wiring. Also Perfect Fit to PSR-11.",
4 | "keywords": ["di", "ioc", "auto resolve", "auto wiring", "dependency injection", "wandu"],
5 | "license": "MIT",
6 | "require": {
7 | "php": ">=7.1",
8 | "psr/container": "^1",
9 | "psr/simple-cache": "^1",
10 | "wandu/config": "^4.0",
11 | "wandu/reflection": "^0.3"
12 | },
13 | "autoload": {
14 | "psr-4": {
15 | "Wandu\\DI\\": ""
16 | },
17 | "files" : [
18 | "functions.php"
19 | ]
20 | },
21 | "provide": {
22 | "container-interop/container-interop-implementation": "^1.1"
23 | },
24 | "suggest": {
25 | "doctrine/annotations": "for the AutoWired annotation."
26 | },
27 | "extra": {
28 | "branch-alias": {
29 | "dev-master": "4.0-dev"
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Job.php:
--------------------------------------------------------------------------------
1 | adapter = $adapter;
22 | $this->serializer = $serializer;
23 | $this->job = $job;
24 | }
25 |
26 | /**
27 | * @return mixed
28 | */
29 | public function read()
30 | {
31 | return $this->serializer->unserialize($this->job->payload());
32 | }
33 |
34 | /**
35 | * @return void
36 | */
37 | public function delete()
38 | {
39 | $this->adapter->remove($this->job);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Providers/SqsServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(SqsClient::class, function (Config $config) {
17 | return new SqsClient([
18 | 'version' => '2012-11-05',
19 | 'credentials' => [
20 | 'key' => $config->get('aws.sqs.key'),
21 | 'secret' => $config->get('aws.sqs.secret'),
22 | ],
23 | 'region' => $config->get('aws.sqs.region'),
24 | ]);
25 | });
26 | }
27 |
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function boot(ContainerInterface $app)
32 | {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tests/View/views/home.php:
--------------------------------------------------------------------------------
1 |
2 | layout('layout.php', ['title' => 'title from home.php']);
5 | ?>
6 |
7 | // this is style 1
8 | push('styles') ?>
9 |
10 | endpush(); ?>
11 |
12 | // this is style 2
13 | push('styles') ?>
14 |
15 | endpush(); ?>
16 |
17 | // this is script 1
18 | push('scripts') ?>
19 |
20 | endpush(); ?>
21 |
22 | // this is script 2
23 | push('scripts') ?>
24 |
25 | endpush(); ?>
26 |
27 | // contents replaced
28 | section('contents') ?>
29 | // never..
30 | endsection(); ?>
31 |
32 | // contents
33 | section('contents') ?>
34 | title = =$title?>, =$this->render('hello-stranger.php', ['who' => 'wandu'])?>
35 | endsection(); ?>
36 |
--------------------------------------------------------------------------------
/src/Wandu/Database/Query/RenameQuery.php:
--------------------------------------------------------------------------------
1 | table = $table;
26 | $this->newTable = $newTable;
27 | }
28 |
29 | /**
30 | * {@inheritdoc}
31 | */
32 | public function toSql()
33 | {
34 | return "RENAME TABLE `{$this->table}` TO `{$this->newTable}`";
35 | }
36 |
37 | /**
38 | * {@inheritdoc}
39 | */
40 | public function getBindings()
41 | {
42 | return [];
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/tests/View/Phiew/FileResolverTest.php:
--------------------------------------------------------------------------------
1 | __DIR__ . '/../views'
13 | ]);
14 | $resolver = new FileResolver($env);
15 |
16 | static::assertInstanceOf(Template::class, $resolver->resolve('home.php'));
17 | }
18 |
19 | public function testResolveFail()
20 | {
21 | $env = new Configuration([
22 | 'path' => __DIR__ . '/../views'
23 | ]);
24 | $resolver = new FileResolver($env);
25 |
26 | try {
27 | $resolver->resolve('unknown.php');
28 | static::fail();
29 | } catch (FileNotFoundException $e) {
30 | static::assertEquals('Cannot find the template file named \'unknown.php\'.', $e->getMessage());
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Wandu/DI/Exception/CannotInjectException.php:
--------------------------------------------------------------------------------
1 | class = $class;
22 | $this->property = $property;
23 | $this->message = "it cannot be injected; {$class}::\${$property}";
24 | }
25 |
26 | /**
27 | * @return string
28 | */
29 | public function getClass(): string
30 | {
31 | return $this->class;
32 | }
33 |
34 | /**
35 | * @return string
36 | */
37 | public function getProperty()
38 | {
39 | return $this->property;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/Q/QueueTest.php:
--------------------------------------------------------------------------------
1 | flush();
14 |
15 | $queue->send("Hello World");
16 | $queue->send(["message" => "Hello World"]);
17 |
18 | static::assertEquals("Hello World", $queue->receive()->read());
19 | static::assertEquals(["message" => "Hello World"], $queue->receive()->read());
20 | }
21 |
22 | public function testQueueWithPhpSerializer()
23 | {
24 | $sendObject = new \stdClass();
25 | $sendObject->message = "stdClass Message";
26 |
27 | $queue = new Queue(new ArrayAdapter(), new PhpSerializer());
28 |
29 | $queue->send($sendObject);
30 |
31 | static::assertEquals($sendObject, $queue->receive()->read());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Wandu/Event/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(EventEmitter::class, function (ContainerInterface $container, Worker $worker) {
21 | $emitter = new EventEmitter($this->listeners);
22 | $emitter->setContainer($container);
23 | $emitter->setWorker($worker);
24 | return $emitter;
25 | });
26 | $app->alias(EventEmitterContract::class, EventEmitter::class);
27 | }
28 |
29 | /**
30 | * {@inheritdoc}
31 | */
32 | public function boot(ContainerInterface $app)
33 | {
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Wandu/Collection/README.ok.md:
--------------------------------------------------------------------------------
1 | Wandu Collection
2 | ===
3 |
4 | [](https://packagist.org/packages/wandu/collection)
5 | [](https://packagist.org/packages/wandu/collection)
6 | [](https://packagist.org/packages/wandu/collection)
7 | [](https://packagist.org/packages/wandu/collection)
8 |
9 | Collection Library Like Java. Provides List, Map, and Set.
10 |
11 | ## Installation
12 |
13 | ```bash
14 | composer require wandu/collection
15 | ```
16 |
17 | ## Usage
18 |
19 | ### List
20 |
21 | there is one list.
22 |
23 | - `Wandu\Collection\ArrayList`
24 |
25 | **Interface**
26 |
27 | @code("Contracts/ListInterface.php")
28 |
29 | ### Map
30 |
31 | there is one map.
32 |
33 | - `Wandu\Collection\ArrayMap`
34 |
35 | **Interface**
36 |
37 | @code("Contracts/MapInterface.php")
38 |
--------------------------------------------------------------------------------
/src/Wandu/Router/RouterServiceProvider.php:
--------------------------------------------------------------------------------
1 | true,
16 | //'method_spoofing_enabled' => false,
17 | //'defined_prefix' => '',
18 | //'defined_middlewares' => [],
19 | //'defined_domains' => [],
20 | ];
21 |
22 | /**
23 | * {@inheritdoc}
24 | */
25 | public function register(ContainerInterface $app)
26 | {
27 | $app->bind(LoaderInterface::class, PsrLoader::class);
28 | $app->bind(ResponsifierInterface::class, PsrResponsifier::class);
29 | $app->bind(Dispatcher::class)->assign('options', ['value' => $this->options]);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/ValidatorFactory.php:
--------------------------------------------------------------------------------
1 | loader = $loader ?: new TesterLoader();
21 | $this->normalizer = $normalizer ?: new ValidatorNormalizer();
22 | }
23 |
24 | /**
25 | * @param string|array|\Wandu\Validator\Contracts\Rule $rule
26 | * @return \Wandu\Validator\Contracts\Validatable
27 | */
28 | public function factory($rule): Validatable
29 | {
30 | return new Validator($this->loader, $this->normalizer, $rule);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Wandu/Q/Providers/BeanstalkServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(PheanstalkInterface::class, function (Config $config) {
18 | return new Pheanstalk(
19 | $config->get('pda.pheanstalk.host', '127.0.0.1'),
20 | $config->get('pda.pheanstalk.port', Pheanstalk::DEFAULT_PORT),
21 | $config->get('pda.pheanstalk.timeout'),
22 | $config->get('pda.pheanstalk.connect_persistent', false)
23 | );
24 | });
25 | }
26 |
27 | /**
28 | * {@inheritdoc}
29 | */
30 | public function boot(ContainerInterface $app)
31 | {
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Wandu/View/Phiew.php:
--------------------------------------------------------------------------------
1 | resolver = $resolver;
18 | }
19 |
20 | /**
21 | * {@inheritdoc}
22 | */
23 | public function with(array $attributes = [])
24 | {
25 | $new = clone $this;
26 | $new->attributes = array_merge($new->attributes, $attributes);
27 | return $new;
28 | }
29 |
30 | /**
31 | * {@inheritdoc}
32 | */
33 | public function render($template, array $attributes = [], $basePath = null)
34 | {
35 | $template = $this->resolver->resolve($template);
36 | return $template->execute($attributes + $this->attributes);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) Changwan Jun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/src/Wandu/Validator/Testers/BetweenTester.php:
--------------------------------------------------------------------------------
1 | min = $min;
21 | $this->max = $max;
22 | }
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | public function test($data, $origin = null, array $keys = []): bool
28 | {
29 | if ($data === null) return false;
30 | if (is_int($data) || is_float($data)) {
31 | return $data <= (int) $this->max && $data >= (int) $this->min;
32 | }
33 | if (is_string($data)) {
34 | return strcmp($data, $this->min) >= 0 && strcmp($data, $this->max) <= 0;
35 | }
36 | return $data <= $this->max && $data >= $this->min;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Wandu/View/PhiewServiceProvider.php:
--------------------------------------------------------------------------------
1 | closure(Configuration::class, function (Config $config) {
20 | $conf = new Configuration();
21 | $conf->path = (array) $config->get('view.path', 'views');
22 | return $conf;
23 | });
24 | $app->bind(ResolverInterface::class, FileResolver::class);
25 | $app->bind(RenderInterface::class, Phiew::class);
26 | }
27 |
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function boot(ContainerInterface $app)
32 | {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: "php"
2 |
3 | addons:
4 | mariadb: '10.0'
5 |
6 | matrix:
7 | fast_finish: true
8 | allow_failures:
9 | - php: nightly
10 | - php: hhvm
11 | include:
12 | - php: 7.1
13 | env:
14 | - EXECUTE_COVERAGE=true
15 | - php: nightly
16 | - php: hhvm
17 |
18 | before_script:
19 | - wget http://downloads.mysql.com/docs/sakila-db.tar.gz
20 | - tar xvf sakila-db.tar.gz
21 | - mysql < sakila-db/sakila-schema.sql -uroot
22 | - mysql < sakila-db/sakila-data.sql -uroot
23 | - if [[ $EXECUTE_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
24 | - composer install
25 |
26 | script:
27 | - if [[ $EXECUTE_COVERAGE == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover=coverage.clover ; fi
28 | - if [[ $EXECUTE_COVERAGE != 'true' ]]; then ./vendor/bin/phpunit ; fi
29 |
30 | after_script:
31 | - if [[ $EXECUTE_COVERAGE == 'true' ]]; then wget https://scrutinizer-ci.com/ocular.phar ; fi
32 | - if [[ $EXECUTE_COVERAGE == 'true' ]]; then php ocular.phar code-coverage:upload --format=php-clover ./coverage.clover ; fi
33 |
--------------------------------------------------------------------------------
/src/Wandu/Config/Exception/NotAllowedMethodException.php:
--------------------------------------------------------------------------------
1 | methodName = $methodName;
21 | $this->className = $className;
22 | $message = "cannot call {$methodName}";
23 | if ($className) {
24 | $message .= " in {$className}";
25 | }
26 | parent::__construct($message);
27 | }
28 |
29 | /**
30 | * @return string
31 | */
32 | public function getMethodName()
33 | {
34 | return $this->methodName;
35 | }
36 |
37 | /**
38 | * @return string
39 | */
40 | public function getClassName()
41 | {
42 | return $this->className;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Exception/CannotCallMethodException.php:
--------------------------------------------------------------------------------
1 | methodName = $methodName;
21 | $this->className = $className;
22 | $message = "cannot call {$methodName}";
23 | if ($className) {
24 | $message .= " in {$className}";
25 | }
26 | parent::__construct($message);
27 | }
28 |
29 | /**
30 | * @return string
31 | */
32 | public function getMethodName()
33 | {
34 | return $this->methodName;
35 | }
36 |
37 | /**
38 | * @return string
39 | */
40 | public function getClassName()
41 | {
42 | return $this->className;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/tests/Database/Entity/MetadataTest.php:
--------------------------------------------------------------------------------
1 | reader = new MetadataReader(new AnnotationReader());
16 | }
17 |
18 | public function testGetClass()
19 | {
20 | $metadata = $this->reader->getMetadata(SakilaFilm::class);
21 |
22 | static::assertSame(SakilaFilm::class, $metadata->getClass());
23 | }
24 |
25 | public function testIsIncrements()
26 | {
27 | $metadata = $this->reader->getMetadata(SakilaFilm::class);
28 |
29 | static::assertTrue($metadata->isIncrements());
30 | }
31 |
32 | public function testHasOne()
33 | {
34 | $metadata = $this->reader->getMetadata(SakilaFilm::class);
35 |
36 | static::assertTrue($metadata->isIncrements());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Wandu/Router/Loader/SimpleLoader.php:
--------------------------------------------------------------------------------
1 | pattern = $pattern;
15 | }
16 |
17 | /**
18 | * {@inheritdoc}
19 | */
20 | public function test(string $path): bool
21 | {
22 | return file_exists($path) && preg_match($this->pattern, pathinfo($path)['basename']);
23 | }
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function load(string $path)
29 | {
30 | $level = ob_get_level();
31 | ob_start();
32 | try {
33 | $config = require $path;
34 | ob_end_flush();
35 | if (is_array($config)) {
36 | return $config;
37 | }
38 | } catch (Throwable $e) {
39 | while (ob_get_level() - $level > 0) ob_end_flush();
40 | }
41 | return [];
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Wandu/Http/Contracts/ParameterInterface.php:
--------------------------------------------------------------------------------
1 | bootstrapper = $bootstrapper;
19 | }
20 |
21 | /**
22 | * {@inheritdoc}
23 | */
24 | public function boot()
25 | {
26 | if (!$this->isBooted) {
27 | foreach ($this->bootstrapper->providers() as $provider) {
28 | $this->register($provider);
29 | }
30 | $this->bootstrapper->boot($this);
31 | parent::boot();
32 | }
33 | return $this;
34 | }
35 |
36 | /**
37 | * @return mixed
38 | */
39 | public function execute()
40 | {
41 | $this->boot();
42 | return $this->bootstrapper->execute($this);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Wandu/Migrator/Commands/MigrateCommand.php:
--------------------------------------------------------------------------------
1 | manager = $manager;
18 | }
19 |
20 | public function execute()
21 | {
22 | $migrations = $this->manager->getMigrationInformations();
23 | $isNoMigration = true;
24 | foreach ($migrations as $migration) {
25 | if (!$this->manager->isApplied($migration)) {
26 | $isNoMigration = false;
27 | $this->manager->up($migration->getId());
28 | $this->output->writeln(sprintf("up %s", $migration->getId()));
29 | }
30 | }
31 | if ($isNoMigration) {
32 | $this->output->writeln("there is no migration to migrate.");
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------