Skip to content

Commit

Permalink
Added Job usage Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
amercier committed Aug 9, 2013
1 parent b61dd5c commit 8a69be4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/api-job.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
\Cli\Helpers\Job
================

Usage
-----

On successful jobs:
```php
\Cli\Helpers\Job::run('Doing awesome stuff', function() {
... // awesome stuff
});
```
```
Doing awesome stuff... OK
```

On unsuccessful jobs:
```php
\Cli\Helpers\Job::run('Fighting Chuck Norris', function() {
... // throws a RoundHouseKickException('You've received a round-house kick', 'face')
});
```
```
Fighting Chuck Norris... NOK - You've received a round-house kick in the face
```
26 changes: 26 additions & 0 deletions src/Cli/Helpers/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

namespace Cli\Helpers;

/**
* Utility class to run a job and catch exceptions.
*
* Usage
* -----
*
* On successful jobs:
* ```php
* \Cli\Helpers\Job::run('Doing awesome stuff', function() {
* ... // awesome stuff
* });
* ```
* ```
* Doing awesome stuff... OK
* ```
*
* On unsuccessful jobs:
* ```php
* \Cli\Helpers\Job::run('Fighting Chuck Norris', function() {
* ... // throws a RoundHouseKickException('You've received a round-house kick', 'face')
* });
* ```
* ```
* Fighting Chuck Norris... NOK - You've received a round-house kick in the face
* ```
*/
class Job
{
protected $message;
Expand Down

0 comments on commit 8a69be4

Please sign in to comment.