-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from pact-foundation/psr-2
Follow PSR-2 codingsstandards #12
- Loading branch information
Showing
105 changed files
with
376 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
<?php | ||
/* | ||
Mock Provider as an example | ||
Mock Provider as an example | ||
*/ | ||
|
||
if (isset($_GET["amount"])) { | ||
$objects = generate(intval($_GET["amount"])); | ||
} else if (isset($_GET["file"])) { | ||
$fileName = filter_var($_GET["file"], FILTER_SANITIZE_STRING); | ||
$objects = generate(intval($_GET["amount"])); | ||
} elseif (isset($_GET["file"])) { | ||
$fileName = filter_var($_GET["file"], FILTER_SANITIZE_STRING); | ||
$currentDir = dirname(__FILE__); | ||
$relativeDir = $currentDir . DIRECTORY_SEPARATOR . $fileName; | ||
error_log("File get: " . $relativeDir); | ||
|
||
$objects = \json_decode(file_get_contents($relativeDir)); | ||
} else if (!empty($_POST)) { | ||
} elseif (!empty($_POST)) { | ||
error_log('received post'); | ||
|
||
$body = '{ "type": "some new type" }'; | ||
$body = \json_encode(\json_decode($body)); | ||
$objects = \json_decode($body); | ||
} | ||
else { | ||
$objects = generate(); | ||
} else { | ||
$objects = generate(); | ||
} | ||
|
||
header('Content-Type: application/json'); | ||
echo json_encode($objects); | ||
|
||
function generate($objCount = 3) { | ||
$objects = array(); | ||
|
||
for($i=0;$i<$objCount;$i++) { | ||
$obj = new \stdClass(); | ||
$obj->id = 100 + $i; | ||
$obj->name = sprintf("Type %d", $obj->id); | ||
|
||
$objects[] = $obj; | ||
} | ||
|
||
$ret = new \stdClass(); | ||
$ret->types = $objects; | ||
return $ret; | ||
} | ||
function generate($objCount = 3) | ||
{ | ||
$objects = array(); | ||
|
||
for ($i=0;$i<$objCount;$i++) { | ||
$obj = new \stdClass(); | ||
$obj->id = 100 + $i; | ||
$obj->name = sprintf("Type %d", $obj->id); | ||
|
||
$objects[] = $obj; | ||
} | ||
|
||
$ret = new \stdClass(); | ||
$ret->types = $objects; | ||
return $ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ public function getResult() | |
{ | ||
return $this->_result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,5 +65,4 @@ public function AddChildResult(&$comparisonResult) | |
|
||
$this->_childResults[] = $comparisonResult; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ public function __construct($errorMessage) | |
{ | ||
$this->_result = $errorMessage; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
interface IComparer | ||
{ | ||
public function Compare($expected, $actual); | ||
} | ||
} |
Oops, something went wrong.