mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-06 14:06:34 +02:00
grammar fixes
This commit is contained in:
@@ -16,7 +16,7 @@ There are multiple ways to install PHP on OS X.
|
|||||||
[Homebrew PHP] is a repository that contains PHP-related "formulae" for Homebrew, and will let you install PHP.
|
[Homebrew PHP] is a repository that contains PHP-related "formulae" for Homebrew, and will let you install PHP.
|
||||||
|
|
||||||
At this point, you can install `php53`, `php54`, `php55`, `php56`, `php70` or `php71` using the `brew install` command, and switch
|
At this point, you can install `php53`, `php54`, `php55`, `php56`, `php70` or `php71` using the `brew install` command, and switch
|
||||||
between them by modifying your `PATH` variable. Alternatively you can use [brew-php-switcher][brew-php-switcher] which will switch automatically for you.
|
between them by modifying your `PATH` variable. Alternatively, you can use [brew-php-switcher][brew-php-switcher] which will switch automatically for you.
|
||||||
|
|
||||||
### Install PHP via Macports
|
### Install PHP via Macports
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ recommendations are merely a set of rules that many projects like Drupal, Zend,
|
|||||||
FuelPHP, Lithium, etc are adopting. You can use them for your own projects, or continue to use your own
|
FuelPHP, Lithium, etc are adopting. You can use them for your own projects, or continue to use your own
|
||||||
personal style.
|
personal style.
|
||||||
|
|
||||||
Ideally you should write PHP code that adheres to a known standard. This could be any combination of PSRs, or one
|
Ideally, you should write PHP code that adheres to a known standard. This could be any combination of PSRs, or one
|
||||||
of the coding standards made by PEAR or Zend. This means other developers can easily read and work with your code, and
|
of the coding standards made by PEAR or Zend. This means other developers can easily read and work with your code, and
|
||||||
applications that implement the components can have consistency even when working with lots of third-party code.
|
applications that implement the components can have consistency even when working with lots of third-party code.
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ On DateTime objects you can use standard comparison:
|
|||||||
{% highlight php %}
|
{% highlight php %}
|
||||||
<?php
|
<?php
|
||||||
if ($start < $end) {
|
if ($start < $end) {
|
||||||
echo "Start is before end!\n";
|
echo "Start is before the end!\n";
|
||||||
}
|
}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
@@ -47,6 +47,6 @@ class Database
|
|||||||
class MysqlAdapter {}
|
class MysqlAdapter {}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
Now we are giving the `Database` class its dependency rather than it creating it itself. We could even create a method
|
Now we are giving the `Database` class its dependency rather than creating it itself. We could even create a method
|
||||||
that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we
|
that would accept an argument of the dependency and set it that way, or if the `$adapter` property was `public` we
|
||||||
could set it directly.
|
could set it directly.
|
||||||
|
@@ -57,5 +57,5 @@ the adapter based on that contract.
|
|||||||
|
|
||||||
An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide
|
An even bigger benefit to this method is that our code is now much more scalable. If a year down the line we decide
|
||||||
that we want to migrate to a different type of database, we can write an adapter that implements the original interface
|
that we want to migrate to a different type of database, we can write an adapter that implements the original interface
|
||||||
and inject that instead, no more refactoring would be required as we can ensure that the adapter follows the contract
|
and injects that instead, no more refactoring would be required as we can ensure that the adapter follows the contract
|
||||||
set by the interface.
|
set by the interface.
|
||||||
|
Reference in New Issue
Block a user