From 737c15f18e628c816fe12a6e9588dab306cddf9f Mon Sep 17 00:00:00 2001 From: Jacek Kobus Date: Tue, 8 Oct 2013 22:27:05 +0200 Subject: [PATCH 1/5] added link to symfony coding standards --- _posts/02-01-01-Code-Style-Guide.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index e9d4657..f7a6d0c 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -19,6 +19,7 @@ and applications that implement the components can have consistency even when wo * [Read about PSR-2][psr2] * [Read about PEAR Coding Standards][pear-cs] * [Read about Zend Coding Standards][zend-cs] +* [Read about Symfony Coding Standards][symfony-cs] You can use [PHP_CodeSniffer][phpcs] to check code against any one of these recommendations, and plugins for text editors like [Sublime Text 2][st-cs] to be given real time feedback. @@ -35,6 +36,7 @@ by all current and future parties who may be working on the codebase. [psr2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [pear-cs]: http://pear.php.net/manual/en/standards.php [zend-cs]: http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards +[symfony-cs]: http://symfony.com/doc/current/contributing/code/standards.html [phpcs]: http://pear.php.net/package/PHP_CodeSniffer/ [st-cs]: https://github.com/benmatselby/sublime-phpcs [phpcsfixer]: http://cs.sensiolabs.org/ From 3bd78009eb2b1e16f64cf00f3158f789d9c5f1fc Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Mon, 2 Dec 2013 10:23:11 -0500 Subject: [PATCH 2/5] Fixed link for Enhance PHP Thanks to @w00 for pointing this one out in #332. --- _posts/10-02-01-Test-Driven-Development.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_posts/10-02-01-Test-Driven-Development.md b/_posts/10-02-01-Test-Driven-Development.md index f6571d4..71528d6 100644 --- a/_posts/10-02-01-Test-Driven-Development.md +++ b/_posts/10-02-01-Test-Driven-Development.md @@ -30,10 +30,11 @@ you run a project which accepts pull requests then you should suggest this as a [PHPUnit](http://phpunit.de) is the de-facto testing framework for writing unit tests for PHP applications, but there are several alternatives -* [SimpleTest](http://simpletest.org) -* [Enhance PHP](http://www.enhance-php.com/) -* [PUnit](http://punit.smf.me.uk/) * [atoum](https://github.com/atoum/atoum) +* [Enhance PHP](https://github.com/Enhance-PHP/Enhance-PHP) +* [PUnit](http://punit.smf.me.uk/) +* [SimpleTest](http://simpletest.org) + ### Integration Testing From 67df3eb54e7e20e9310ca05657f12f8e2bff4d47 Mon Sep 17 00:00:00 2001 From: Ryan Koven Date: Tue, 3 Dec 2013 13:45:16 -0800 Subject: [PATCH 3/5] Remove an extraneous 'to'; rectify an instance of an incorrect verb tense; small adjust to punctuation. Original text noted that it's "usually a good idea to follow to common patterns". Removed extra 'to'. In MVC section the sentence "The model-view-controller (MVC) pattern... let..." should be changed to "The model-view-controller (MVC) pattern...lets..." Also added a semicolon to a sentence in the Factory section that Strunk and White would agree enhances the clarity of the sentence. --- pages/Design-Patterns.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pages/Design-Patterns.md b/pages/Design-Patterns.md index 4a3fe45..64618c2 100644 --- a/pages/Design-Patterns.md +++ b/pages/Design-Patterns.md @@ -6,7 +6,7 @@ title: Design Patterns # Design Patterns There are numerous ways to structure the code and project for you web application, and you can put as much or as little -thought as you like into architecting. But it is usually a good idea to follow to common patterns because it will make +thought as you like into architecting. But it is usually a good idea to follow common patterns because it will make your code easier to manage and easier for others to understand. * [Architectural pattern on Wikipedia](https://en.wikipedia.org/wiki/Architectural_pattern) @@ -51,7 +51,7 @@ print_r($veyron->get_make_and_model()); // outputs "Bugatti Veyron" {% endhighlight %} This code uses a factory to create the Automobile object. There are two possible benefits to building your code this -way, the first is that if you need to change, rename, or replace the Automobile class later on you can do so and you +way; the first is that if you need to change, rename, or replace the Automobile class later on you can do so and you will only have to modify the code in the factory, instead of every place in your project that uses the Automobile class. The second possible benefit is that if creating the object is a complicated job you can do all of the work in the factory, instead of repeating it every time you want to create a new instance. @@ -250,11 +250,7 @@ and gives you a central place to hook in code that should be run for every reque ## Model-View-Controller -The model-view-controller (MVC) pattern and its relatives HMVC and MVVM let you break up code into logical objects that -serve very specific purposes. Models serve as a data access layer where data is fetched and returned in formats usable -throughout your application. Controllers handle the request, process the data returned from models and load views to -send in the response. And views are display templates (markup, xml, etc) that are sent in the response to the web -browser. +The model-view-controller (MVC) pattern and its relatives HMVC and MVVM lets you break up code into logical objects that serve very specific purposes. Models serve as a data access layer where data is fetched and returned in formats usable throughout your application. Controllers handle the request, process the data returned from models and load views to send in the response. And views are display templates (markup, xml, etc) that are sent in the response to the web browser. MVC is the most common architectural pattern used in the popular [PHP frameworks](https://github.com/codeguy/php-the-right-way/wiki/Frameworks). From c406b927230a61d6daeff384fc771500224f7228 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 7 Dec 2013 09:26:04 -0500 Subject: [PATCH 4/5] Updated mwop's Twitter account --- _posts/13-01-01-Resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/13-01-01-Resources.md b/_posts/13-01-01-Resources.md index 3837fbc..9466aa5 100644 --- a/_posts/13-01-01-Resources.md +++ b/_posts/13-01-01-Resources.md @@ -12,7 +12,7 @@ * [Derick Rethans](http://twitter.com/derickr) * [Chris Shiflett](http://twitter.com/shiflett) * [Sebastian Bergmann](http://twitter.com/s_bergmann) -* [Matthew Weier O'Phinney](http://twitter.com/weierophinney) +* [Matthew Weier O'Phinney](http://twitter.com/mwop) * [Pádraic Brady](http://twitter.com/padraicb) * [Anthony Ferrara](http://twitter.com/ircmaxell) * [Nikita Popov](http://twitter.com/nikita_ppv) From 710cba2569c15d94127438a21a05ea7e2bceaf83 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 8 Dec 2013 16:02:22 +0100 Subject: [PATCH 5/5] coding style fix --- _posts/07-01-01-Databases.md | 2 +- _posts/09-03-01-Password-Hashing.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/07-01-01-Databases.md b/_posts/07-01-01-Databases.md index 5f024fa..7f37417 100644 --- a/_posts/07-01-01-Databases.md +++ b/_posts/07-01-01-Databases.md @@ -45,7 +45,7 @@ which will delete all of your users! Instead, you should sanitize the ID input u prepare('SELECT name FROM users WHERE id = :id'); -$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); //<-- Automatically sanitized by PDO +$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); // <-- Automatically sanitized by PDO $stmt->execute(); {% endhighlight %} diff --git a/_posts/09-03-01-Password-Hashing.md b/_posts/09-03-01-Password-Hashing.md index cf9f544..ad82acd 100644 --- a/_posts/09-03-01-Password-Hashing.md +++ b/_posts/09-03-01-Password-Hashing.md @@ -22,9 +22,9 @@ require 'password.php'; $passwordHash = password_hash('secret-password', PASSWORD_DEFAULT); if (password_verify('bad-password', $passwordHash)) { - //Correct Password + // Correct Password } else { - //Wrong password + // Wrong password } {% endhighlight %}