Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,23 @@
"license": "EUPL-1.2",
"type": "library",
"require": {
"ext-ctype": "*",
"ext-json": "*",
"mustache/mustache": "^2.13",
"tedivm/jshrink": "~1.0"
},
"require-dev": {
"kint-php/kint": "^3.3",
"phpunit/phpunit": "*"
},
"autoload": {
"classmap": [
"ElementData.php",
"AspectPropertyValue.php",
"ElementDataDictionary.php",
"Evidence.php",
"EvidenceKeyFilter.php",
"BasicListEvidenceKeyFilter.php",
"FlowData.php",
"FlowElement.php",
"Logger.php",
"Messages.php",
"Pipeline.php",
"PipelineBuilder.php",
"JavascriptBuilder.php",
"JsonBundler.php",
"SequenceElement.php",
"SetHeaderElement.php",
"Constants.php",
"Utils.php"
]
"psr-4": {
"fiftyone\\pipeline\\core\\": "src/"
}
},
"require-dev": {
"kint-php/kint": "^3.3"
"autoload-dev": {
"psr-4": {
"fiftyone\\pipeline\\core\\tests\\": "tests/"
}
}
}
67 changes: 33 additions & 34 deletions examples/CustomFlowElement.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
* ********************************************************************* */

/**
* @example CustomFlowElement.php
*
* This example demonstrates the creation of a custom flow element. In this case
* the FlowElement takes the results of a client side form collecting
* date of birth, setting this as evidence on a FlowData object to calculate
* a person's starsign. The FlowElement also serves additional JavaScript
* which gets a user's geolocation and saves the latitude as a cookie.
* This latitude is also then passed in to the FlowData to calculate if
* a person is in the northern or southern hemispheres.
* @example CustomFlowElement.php
*
* This example demonstrates the creation of a custom flow element. In this case
* the FlowElement takes the results of a client side form collecting
* date of birth, setting this as evidence on a FlowData object to calculate
* a person's starsign. The FlowElement also serves additional JavaScript
* which gets a user's geolocation and saves the latitude as a cookie.
* This latitude is also then passed in to the FlowData to calculate if
* a person is in the northern or southern hemispheres.

*/
*/

include(__DIR__ . "/../vendor/autoload.php");

use fiftyone\pipeline\core\PipelineBuilder;
use fiftyone\pipeline\core\BasicListEvidenceKeyFilter;
Expand Down Expand Up @@ -87,11 +86,11 @@ public function processInternal($FlowData)
{
$result = [];


// Get the date of birth from the query string (submitted through
// a form on the client side)
$dateOfBirth = $FlowData->evidence->get("query.dateOfBirth");

if ($dateOfBirth) {
$dateOfBirth = explode("-", $dateOfBirth);

Expand Down
46 changes: 23 additions & 23 deletions examples/FlowElementsForExamples.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
* ********************************************************************* */

use fiftyone\pipeline\core\FlowElement;
Expand Down Expand Up @@ -73,7 +73,7 @@ public function getEvidenceKeyFilter()
}


if (!class_exists("errorFlowElement")) {
if (!class_exists("ErrorFlowElement")) {
// A FlowElement that triggers an error

class ErrorFlowElement extends FlowElement
Expand All @@ -93,7 +93,7 @@ public function getEvidenceKeyFilter()
}


if (!class_exists("stopFlowElement")) {
if (!class_exists("StopFlowElement")) {
// A FlowElement that stops processing

class StopFlowElement extends FlowElement
Expand Down
70 changes: 34 additions & 36 deletions examples/Pipeline.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
* ********************************************************************* */

/**
* @example Pipeline.php
*
* This example demonstrates how various FlowElements can be combined in a Pipeline and processed
*
*/

require(__DIR__ . "/../vendor/autoload.php");
* @example Pipeline.php
*
* This example demonstrates how various FlowElements can be combined in a Pipeline and processed
*
*/

use fiftyone\pipeline\core\PipelineBuilder;
use fiftyone\pipeline\core\Logger;
Expand All @@ -38,12 +36,12 @@

// Two simple example FlowElements

$fe1 = new exampleFlowElementA();
$fe2 = new exampleFlowElementB();
$fe1 = new ExampleFlowElementA();
$fe2 = new ExampleFlowElementB();

// A FlowElement that stops processing (and prevents and subsequent elements in the Pipeline from processing)

$feStop = new stopFlowElement();
$feStop = new StopFlowElement();

// Pipelines can log info, errors and other messages if you supply a logger to them, here is a basic logger example that stores the logs in an array

Expand All @@ -62,11 +60,11 @@ public function logInternal($log)
// We make a Pipeline with our elements

$Pipeline = (new PipelineBuilder())
->add($fe1)
->add($feStop)
->add($fe2)
->addLogger(new ArrayLogger("info"))
->build();
->add($fe1)
->add($feStop)
->add($fe2)
->addLogger(new ArrayLogger("info"))
->build();

// We create FlowData which we will add evidence to

Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit>
<phpunit bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="Unit">
<file>tests/CoreTests.php</file>
Expand Down
42 changes: 21 additions & 21 deletions AspectPropertyValue.php → src/AspectPropertyValue.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
* ********************************************************************* */


Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
<?php
/* *********************************************************************
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
*
* This Original Work is licensed under the European Union Public Licence
* (EUPL) v.1.2 and is subject to its terms as set out below.
*
* If a copy of the EUPL was not distributed with this file, You can obtain
* one at https://opensource.org/licenses/EUPL-1.2.
*
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
* amended by the European Commission) shall be deemed incompatible for
* the purposes of the Work and the provisions of the compatibility
* clause in Article 5 of the EUPL shall not apply.
*
* If using the Work as, or as part of, a network application, by
* including the attribution notice(s) required under Article 5 of the EUPL
* in the end user terms of the application under an appropriate heading,
* such notice(s) shall fulfill the requirements of that article.
* ********************************************************************* */



namespace fiftyone\pipeline\core;

use fiftyone\pipeline\core\EvidenceKeyFilter;

/**
* An instance of EvidenceKeyFilter that uses a simple array of keys
* Evidence not using these keys is filtered out
Expand Down
Loading