Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bring Parable to 1.0.0 #27

Merged
merged 86 commits into from
Feb 4, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a4d59d2
CHANGELOG will come later. Complete all doc blocks with explanations,…
devvoh Nov 22, 2017
86158dd
Add a space, or StyleCI will freak out.
devvoh Nov 22, 2017
048d00f
Add some spaces so the constants in App look nice.
devvoh Nov 22, 2017
a2d6e3a
Add more config values for Framework Mailer. Now has parable.mail.[se…
devvoh Nov 22, 2017
00e2ba8
Replace all 'Get x' doc comments with 'Return x' for consistency.
devvoh Nov 22, 2017
0bbc00e
Remove docs from .gitignore
devvoh Nov 22, 2017
5c9d4aa
Fix no routes found app test so that when it fails, it's not just 'di…
devvoh Nov 22, 2017
320b738
I almost don't want to mention it, but up the v to 1 and update the C…
devvoh Nov 23, 2017
f94f78d
Added some missing methods and fixed comments. See CHANGELOG.md
devvoh Nov 26, 2017
a48c702
Rework clearLine logic to use actual terminal width rather than buggy…
devvoh Nov 27, 2017
19966f4
Fix comments on Console Output methods that disable/enable line clear…
devvoh Nov 27, 2017
ef62e6e
Fix float detection in Route
devvoh Nov 27, 2017
cea9cb5
Add trick to float detection since is_float doesn't like strings
devvoh Nov 27, 2017
401ec69
Remove typed params from Route and guessing the value type from Model
devvoh Nov 27, 2017
b421904
Merge branch 'master' into develop
devvoh Nov 27, 2017
9b39b1f
Make Route object more robust, add some important tests, remove @var …
devvoh Nov 28, 2017
156e63e
StyleCI fix
devvoh Nov 28, 2017
6977aa4
Starting to regret this whole StyleCI thing.
devvoh Nov 28, 2017
f1c375f
Remove obsolete comment from CHANGELOG.md
devvoh Nov 28, 2017
d591bea
Add/rework some methods on Router
devvoh Nov 28, 2017
d16c614
Revert overwrite of dynamicReturnTypeMeta.json and fix the weird happ…
devvoh Nov 28, 2017
2749ab3
Fix obscure Path::getDir() bug, no longer need jury-rig in init-struc…
devvoh Nov 28, 2017
8cee277
Add Response::clearContent()
devvoh Nov 28, 2017
ad0c76f
Upgrade \Console\Input significantly with single key presses. Far too…
devvoh Nov 28, 2017
fc4cb70
Suck on a stick, StyleCI.
devvoh Nov 28, 2017
9ebbb7a
Add `$default` parameter to `\Parable\GetSet\Base::get()`
dmvdbrugge Nov 28, 2017
b634ec1
Merge pull request #30 from dmvdbrugge/default-for-getset-base-get
devvoh Nov 28, 2017
3a79130
Fix parameter parsing bug
dmvdbrugge Nov 29, 2017
bb2235a
Merge pull request #31 from dmvdbrugge/fix-argument-after-option
devvoh Nov 29, 2017
8eb5f5b
Rename some config values, add possibility to register classes with t…
devvoh Nov 29, 2017
ef4c6b0
Remove left-behind var_dump debug code
devvoh Nov 29, 2017
f28d547
Add getDispatchedRoute() to Dispatcher.
devvoh Nov 29, 2017
d127e6d
Add two dispatch events to hook into between controller/callable and …
devvoh Nov 29, 2017
054b310
Add setValue() on Route
devvoh Nov 29, 2017
44890bb
Remove ###VENDOR_PATH### rewriting in public/index.php and make it dy…
devvoh Nov 30, 2017
16d62d3
Add constants to Parameter to replace required/valueRequired booleans…
devvoh Nov 30, 2017
5c5af94
Rewrite parameters to use classes rather than arrays. Also rewrite pa…
devvoh Nov 30, 2017
9acfdcf
StyleCI again.
devvoh Nov 30, 2017
d84611d
Merge pull request #32 from devvoh/develop-parameter-rewrite
devvoh Nov 30, 2017
34b8982
Update CHANGELOG.md with the Parameter rewrite notables.
devvoh Nov 30, 2017
c01a65c
Options were set to be REQUIRED by default and should be OPTIONAL
devvoh Nov 30, 2017
a68d16d
Remove obsolete index setting from parseParameters()
devvoh Nov 30, 2017
c3026d2
Make the parable command executable by default
dmvdbrugge Nov 30, 2017
6554f0e
Merge pull request #33 from dmvdbrugge/plus-x-for-parable-executable
devvoh Nov 30, 2017
b86df14
Fix arguments
dmvdbrugge Nov 30, 2017
e9f8cfc
Merge pull request #34 from dmvdbrugge/fix-argument-indexing
devvoh Nov 30, 2017
2a807ff
Parameter::getArguments() no longer calls getArgument() since it does…
devvoh Dec 1, 2017
991ad9b
Many changes - WILL BREAK EVERY IMPLEMENTATION SO FAR. Check CHANGELOG.
devvoh Dec 6, 2017
a4e588f
There isn't a commit where StyleCI doesn't whine.
devvoh Dec 6, 2017
e644b84
Told ya.
devvoh Dec 6, 2017
0c62409
Add defines.php so DS and BASEDIR are back but without odd bootstrapp…
devvoh Dec 7, 2017
29f63b0
Now that BASEDIR is always defined, tests needed some attention.
devvoh Dec 7, 2017
91a3b92
Rename any() to multiple(), which accepts an array of methods, and ma…
devvoh Dec 7, 2017
6000a67
Okay StyleCI, I'll give you that one...
devvoh Dec 7, 2017
8b8d395
Some small fixes based on feedback from @dmvdbrugge
devvoh Dec 8, 2017
2246d4c
Update README.md summat.
devvoh Dec 8, 2017
5ebeba5
Make preformatted text prettier.
devvoh Dec 8, 2017
e9edfa9
Update README some mo and add CONTRIBUTING.md
devvoh Dec 8, 2017
e11664f
Update CONTRIBUTING.md with design goals.
devvoh Dec 10, 2017
155a32b
Console fixes for Windows
dmvdbrugge Dec 10, 2017
d676dcc
Ditch Windows `mode`, keep tput if shell.
dmvdbrugge Dec 11, 2017
d4731b8
Merge pull request #36 from dmvdbrugge/console-fixes-for-windows
devvoh Dec 11, 2017
8a1f296
Make @dmvdbrugge's fix for Console\Output more compact.
devvoh Dec 11, 2017
026d376
Prevent XSS through urls passed to the Router.
devvoh Dec 13, 2017
1667e78
Fix getOption() and getProvidedValue() for they break on falsy values.
dmvdbrugge Dec 16, 2017
b206198
Merge pull request #37 from dmvdbrugge/fix-option-value-zero
devvoh Dec 17, 2017
f72f37e
Add usage to Help, remove PARAMETER_x from Options, test fixes and im…
devvoh Dec 17, 2017
6b50d32
Small fixes.
devvoh Dec 17, 2017
a0c72f9
Small code & typo fixes
devvoh Dec 29, 2017
624a85c
Add tests for array-style controller+action callbacks and add a fix f…
devvoh Dec 29, 2017
67b5d34
Kill all the legacy! Routes now added using the method functions on A…
devvoh Dec 31, 2017
9440085
Add trailing newline
devvoh Dec 31, 2017
f9e38de
Re-introduce named routes, because that regression was unintended.
devvoh Jan 2, 2018
f06e4c9
PR fixes suggested by @dmvdbrugge
devvoh Jan 2, 2018
f41c589
More PR fixes
devvoh Jan 2, 2018
5372a5b
Merge pull request #38 from devvoh/break-the-routes
devvoh Jan 2, 2018
d873dd4
Move SessionMessage to Framework, clean up index.php/parable
devvoh Jan 7, 2018
d71d391
Remove test debug code
devvoh Jan 7, 2018
4991816
And some more. Great day.
devvoh Jan 7, 2018
ac8bb27
Refresh the default welcome page.
devvoh Jan 25, 2018
eadb701
Add parable.debug and parable.timezone to default Config\App file
devvoh Feb 1, 2018
cd4de1f
Add ::create() to Models for easy instantiating.
devvoh Feb 3, 2018
e1c1ca3
Fix style
devvoh Feb 3, 2018
d774fdc
Always uppercase the comparator & add like to ridiculous query test
devvoh Feb 3, 2018
942a2c2
Improvements to ORM and the default structure's config.
devvoh Feb 4, 2018
cbe53da
Update CHANGELOG and CHANGELOG-HISTORY.md
devvoh Feb 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions CHANGELOG-HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,56 @@

This file contains the changelog history for Parable. Changelogs pertaining to versions two major versions before the current active version are moved here.

### 0.11.5

__Changes__
- Rename all the files in `structure` to have a `_struct` suffix, so that IDEs don't pick up on then anymore.

### 0.11.4

__Bugfixes__
- `\Parable\DI\Container` had a bug where in some odd instances, while deciding the dependencies to DI for a class, the parameter's class would be `null` and attempting to get the `name` property from `null`, of course, failed.

### 0.11.3

__Changes__
- `\Parable\Http\Response` now only tries to prepend the output buffer if there's data in the buffer and `Response::$content` is already a string.
- `\Parable\GetSet` now has a new type of resource - those that require their data be parsed from `php://input`.
- Three `GetSet` types added due to the above: `\GetSet\Delete`, `\GetSet\Patch` and `\GetSet\Put`. This should make API builders really happy ;)
- `\Parable\ORM\Model` now returns only boolean values on success or fail, instead of a false on fail and a `PDOStatement` on success.
- Changed the command for `\Command\HelloWorld` to `hello-world` because _somebody_ cares too much about that stuff.

### 0.11.2

__Changes__
- Fixed up the README.md file, since it was a bit outdated. Also changed the 'feel' of the text to represent the maturing state of Parable.
- Renamed `init` command to `init-parable`, then immediately renamed it `init-structure` and added a check whether a structure was already initialized, adding a warning if it was.

### 0.11.1

Well, that was fast!

__Bugfixes__
- Fixed a bug in `\Parable\Http\Url`, where it was directly looking at `$_SERVER['REQUEST_SCHEME']`, which isn't always available. Added `\Parable\Http\Request::getScheme` to try out multiple options to figure it out instead.

### 0.11.0

Hey, look! Tests! With 100% code coverage, too! Run `make tests` to run them (which will attempt to `composer install` for needed libraries and then run the tests). Run `make coverage` to run the tests AND generate the HTML coverage report in `./coverage`.

With tests, every nook and cranny of the code was looked at, evaluated and where needed, checked, fixed, removed or added to.

This release also pulls out all interdependencies except for `Framework` still depending on other Components.

There's so many changes that it'll take a fly's lifetime to jot them all down, and it's just not worth it.

If you're upgrading from 0.10, I wish you all the luck, though in most cases the errors will show you the way.

__Changes__
- Many things.

__Bugfixes__
- Much more.

### 0.10.3

__Bugfixes__
Expand Down
77 changes: 27 additions & 50 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Parable PHP Framework Changelog

### 1.0.0

Considering the 0.11.x branch as Release Candidate 1 and the 0.12.x branch as RC2, it's time to ship final Parable. This release brings a major clean-up, documentation, and some useful additions.

__Changes__
- All method doc blocks now have explanatory text, even if it's superfluous, for documentation purposes.
- `\Parable\Console\App` now supports adding multiple commands in one go, using `addCommands([...])`.
- `\Parable\Framework\App` now has a `HOOK_LOAD_ROUTES_NO_ROUTES_FOUND` constant and triggers it when, you guessed it, no routes are found.
- `\Parable\Framework\Mailer` now supports setting a different mail sender. Default is, as it was, php's own `mail()`.
- `\Parable\Framework\Mailer` now can act on three config values:
- `parable.mail.sender`, which should be the class name of the `SenderInterface` implementation you want to use.
- `parable.mail.from.email`, the email for the for address.
- `parable.mail.from.name`, the name for the for address.
- `\Parable\GetSet\Base` now also has `setResource`, for when you want to switch, or set it using a method rather than overwriting a property.
- `\Parable\Http\Request` now has `isOptions()` to check for OPTIONS method requests.
- `\Parable\Http\Response` now has `setHeaders()` so you can add a bunch of headers in one call, `removeHeader($key)` so you can remove a header, and `clearHeaders()` to, y'know, actually, I think you got this.
- `\Parable\Log\Writer\NullLogger` was added, for when you want to log nowhere at all.
- `\Parable\Mail\Mailer` now obviously also supports setting a Mail Sender. Default is, well, none. That's all up to you to configure. (Hey, psst, `Framework\Mailer` already tries to do that for you!)

__Backwards-incompatible Changes__
- `\Parable\Console\App::setDefaultCommand()` now takes a command instance rather than the name, as the name would suggest. To set the default command by name, use `setDefaultCommandByName()` instead.
- `\Parable\Console\Parameter::setOptions()` was renamed to `setCommandOptions()`, because the distinction is important.
- `\Parable\DI\Container::cleanName()` has been made protected. This shouldn't impact you, as you shouldn't've been using it in the first place.
- `\Parable\GetSet\InputStream::extractAndSetData()` has been made protected. See above for why you should totally be fine.
- The interface `\Parable\Log\Writer` has been renamed and moved to `\Parable\Log\Writer\WriterInterface` for clarity and consistency.
- `\Parable\Log\Writer\Terminal` has been renamed to `\Parable\Log\Writer\Console`, because I don't know what was wrong with me when I chose 'terminal'.

### 0.12.14

__Changes__
Expand Down Expand Up @@ -125,54 +152,4 @@ __Changes__
- No longer add structure folder to the autoload path in `tests/bootstrap.php`, since we no longer use the `_struct` files in testing.
- `\Parable\Framework\App\loadInits()` has been moved up in the run procedure, allowing more triggers: `parable_load_inits_after`, `parable_load_routes_before/after`, `parable_init_database_before/after`, `parable_dispatch_before/after`

### 0.11.5

__Changes__
- Rename all the files in `structure` to have a `_struct` suffix, so that IDEs don't pick up on then anymore.

### 0.11.4

__Bugfixes__
- `\Parable\DI\Container` had a bug where in some odd instances, while deciding the dependencies to DI for a class, the parameter's class would be `null` and attempting to get the `name` property from `null`, of course, failed.

### 0.11.3

__Changes__
- `\Parable\Http\Response` now only tries to prepend the output buffer if there's data in the buffer and `Response::$content` is already a string.
- `\Parable\GetSet` now has a new type of resource - those that require their data be parsed from `php://input`.
- Three `GetSet` types added due to the above: `\GetSet\Delete`, `\GetSet\Patch` and `\GetSet\Put`. This should make API builders really happy ;)
- `\Parable\ORM\Model` now returns only boolean values on success or fail, instead of a false on fail and a `PDOStatement` on success.
- Changed the command for `\Command\HelloWorld` to `hello-world` because _somebody_ cares too much about that stuff.

### 0.11.2

__Changes__
- Fixed up the README.md file, since it was a bit outdated. Also changed the 'feel' of the text to represent the maturing state of Parable.
- Renamed `init` command to `init-parable`, then immediately renamed it `init-structure` and added a check whether a structure was already initialized, adding a warning if it was.

### 0.11.1

Well, that was fast!

__Bugfixes__
- Fixed a bug in `\Parable\Http\Url`, where it was directly looking at `$_SERVER['REQUEST_SCHEME']`, which isn't always available. Added `\Parable\Http\Request::getScheme` to try out multiple options to figure it out instead.

### 0.11.0

Hey, look! Tests! With 100% code coverage, too! Run `make tests` to run them (which will attempt to `composer install` for needed libraries and then run the tests). Run `make coverage` to run the tests AND generate the HTML coverage report in `./coverage`.

With tests, every nook and cranny of the code was looked at, evaluated and where needed, checked, fixed, removed or added to.

This release also pulls out all interdependencies except for `Framework` still depending on other Components.

There's so many changes that it'll take a fly's lifetime to jot them all down, and it's just not worth it.

If you're upgrading from 0.10, I wish you all the luck, though in most cases the errors will show you the way.

__Changes__
- Many things.

__Bugfixes__
- Much more.

[Check CHANGELOG-HISTORY.md](CHANGELOG-HISTORY.md) for older Changelogs.
11 changes: 8 additions & 3 deletions parable
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ $app = require_once(__DIR__ . '/src/Framework/Bootstrap.php');

$app->setName("Parable " . \Parable\Framework\App::PARABLE_VERSION);

$helpCommand = \Parable\DI\Container::get(\Parable\Console\Command\Help::class);
$initStructureCommand = \Parable\DI\Container::get(\Parable\Framework\Command\InitStructure::class);

// Always add Help & Init
$app->addCommand(\Parable\DI\Container::get(\Parable\Console\Command\Help::class));
$app->addCommand(\Parable\DI\Container::get(\Parable\Framework\Command\InitStructure::class));
$app->addCommands([
$helpCommand,
$initStructureCommand,
]);

// Attempt to load commands set by the user
if (file_exists($path->getDir('app'))) {
Expand All @@ -25,5 +30,5 @@ if (file_exists($path->getDir('app'))) {
}
}

$app->setDefaultCommand('help');
$app->setDefaultCommand($helpCommand);
$app->run();
2 changes: 2 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<exclude>
<file>./src/Framework/Bootstrap.php</file>
<file>./src/Console/Input.php</file>
<file>./src/GetSet/Session.php</file>
<file>./src/Framework/Command/InitStructure.php</file>
<directory suffix=".php">./structure/</directory>
<directory suffix=".php">./vendor/</directory>
</exclude>
Expand Down
53 changes: 49 additions & 4 deletions src/Console/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ public function __construct(
$this->input = $input;
$this->parameter = $parameter;

set_exception_handler(function (\Exception $e) {
set_exception_handler(function ($e) {
// @codeCoverageIgnoreStart
$this->output->writeError($e->getMessage());
// @codeCoverageIgnoreEnd
});
}

/**
* Set the application name..
*
* @param string $name
*
* @return $this
Expand All @@ -51,6 +55,8 @@ public function setName($name)
}

/**
* Return the application name.
*
* @return string
*/
public function getName()
Expand All @@ -59,6 +65,8 @@ public function getName()
}

/**
* Add a command to the application.
*
* @param \Parable\Console\Command $command
*
* @return $this
Expand All @@ -71,19 +79,52 @@ public function addCommand(\Parable\Console\Command $command)
}

/**
* Add an array of commands to the application.
*
* @param \Parable\Console\Command[] $commands
*
* @return $this
*/
public function addCommands(array $commands)
{
foreach ($commands as $command) {
$this->addCommand($command);
}
return $this;
}

/**
* Set the default command to use if no command is given (by name).
*
* @param string $commandName
* @param bool $defaultCommandOnly
*
* @return $this
*/
public function setDefaultCommand($commandName, $defaultCommandOnly = false)
public function setDefaultCommandByName($commandName, $defaultCommandOnly = false)
{
$this->defaultCommand = $commandName;
$this->defaultCommandOnly = $defaultCommandOnly;
return $this;
}

/**
* Set the default command to use if no command is given.
*
* @param string $commandName
* @param bool $defaultCommandOnly
*
* @return $this
*/
public function setDefaultCommand(\Parable\Console\Command $command, $defaultCommandOnly = false)
{
$this->setDefaultCommandByName($command->getName(), $defaultCommandOnly);
return $this;
}

/**
* Return the command by name if it's set on the application.
*
* @param string $commandName
*
* @return null|\Parable\Console\Command
Expand All @@ -97,6 +138,8 @@ public function getCommand($commandName)
}

/**
* Return all commands set on the application.
*
* @return \Parable\Console\Command[]
*/
public function getCommands()
Expand All @@ -105,6 +148,8 @@ public function getCommands()
}

/**
* Run the application.
*
* @return mixed
* @throws \Parable\Console\Exception
*/
Expand All @@ -129,10 +174,10 @@ public function run()
throw new \Parable\Console\Exception('No valid commands found.');
}

$this->parameter->setArguments($command->getArguments());
$this->parameter->setCommandArguments($command->getArguments());
$this->parameter->checkArguments();

$this->parameter->setOptions($command->getOptions());
$this->parameter->setCommandOptions($command->getOptions());
$this->parameter->checkOptions();

return $command->run();
Expand Down
Loading