From b6e190d39b0339800c41e36aca6825790630913a Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Sat, 15 Sep 2018 20:50:00 +0200 Subject: [PATCH] Created Read queriedContext (markdown) --- Read-queriedContext.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Read-queriedContext.md diff --git a/Read-queriedContext.md b/Read-queriedContext.md new file mode 100644 index 0000000..f9503b1 --- /dev/null +++ b/Read-queriedContext.md @@ -0,0 +1,30 @@ +The queried context is defined via `PARAMETERS` and can be accessed via `$this->queriedContext`. +It provides a way to identify which context the bridge is called with. + +Example: + +```PHP +... + const PARAMETERS = array( + 'By user name' => array( + 'u' => array('name' => 'Username') + ), + 'By user ID' => array( + 'id' => array('name' => 'User ID') + ) + ); + +... +``` + +In this example `$this->queriedContext` will either return **By user name** or **By user ID**. The queried context might return no value, so the best way to handle it is by using a case-structure: + +```PHP +switch($this->queriedContext){ + case 'By user name': + break; + case 'By user ID': + break; + default: // Return default value +} +```