Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
- Adding initial version of the Job library

Signed-off-by: RJ Garcia <rj@bighead.net>
  • Loading branch information
ragboyjr committed Dec 2, 2016
0 parents commit f600e3b
Show file tree
Hide file tree
Showing 23 changed files with 933 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2016 Bighead Technology

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Jobs

Simple yet powerful implementation of Queued Jobs built on the krak/mw library.
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "krak/job",
"description": "Simple and Powerful Queued Jobs",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "RJ Garcia",
"email": "rj@bighead.net"
}
],
"autoload": {
"psr-4": {
"Krak\\Job\\": "src"
},
"files": ["src/inc.php"]
},
"require": {
"krak/mw": "^0.1.0",
"nikic/iter": "^1.4",
"psr/log": "^1.0",
"symfony/process": "^2.8"
}
}
272 changes: 272 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions src/AbstractPipeline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Krak\Job;

use function Krak\Mw\composeMwSet;

/** manages a stack of consumers to form a pipeline. Consumers at the end will be executed first */
abstract class AbstractPipeline
{
private $middleware;

public function __construct(array $middleware = []) {
$this->middleware = $middleware;
}
public function push(callable $mw) {
array_push($this->middleware, $mw);
return $this;
}
public function unshift(callable $mw) {
array_unshift($this->middleware, $mw);
return $this;
}
public function pop() {
return array_pop($this->middleware);
}
public function shift() {
return array_shift($this->middleware);
}
public function compose() {
return composeMwSet($this->middleware);
}
}
Loading

0 comments on commit f600e3b

Please sign in to comment.