@inheritdoc

@since 1.0.0
@api
501822
public function getHtml(): string
  {
    $html = $this->prefix;
    $html .= Html::generateTag('span', $this->attributes);

    if (is_array($this->options))
    {
      // Normalize current value as a string.
      $valueAsString = Cast::toManString($this->value, '');

      foreach ($this->options as $option)
      {
        $inputAttributes = $this->inputAttributes($option);
        $labelAttributes = $this->labelAttributes($option);

        $labelAttributes['for'] = $inputAttributes['id'];

        $key         = $option[$this->keyKey];
        $keyAsString = Cast::toManString($key, '');
        $value       = ($this->optionsObfuscator) ? $this->optionsObfuscator->encode(Cast::toOptInt($key)) : $key;

        $inputAttributes['value']   = $value;
        $inputAttributes['checked'] = ($valueAsString===$keyAsString);

        $html .= Html::generateVoidElement('input', $inputAttributes);

        $html .= $this->labelPrefix;
        $html .= Html::generateElement('label',
                                       $labelAttributes,
                                       Cast::toOptString($option[$this->labelKey]),
                                       $this->labelIsHtml);
        $html .= $this->labelPostfix;
      }
    }

    $html .= '</span>';
    $html .= $this->postfix;

    return $html;
  }
64151
function _doCapt($oID, $amt = 0, $currency = 'USD') {
    global $db, $messageStack;
    $_POST['captamt'] = preg_replace('/[^0-9.%]/', '', $_POST['captamt']);

    //@TODO: Read current order status and determine best status to set this to
    $new_order_status = (int)MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID;
    if ($new_order_status == 0) $new_order_status = 1;

    $proceedToCapture = true;
    $captureNote = strip_tags(zen_db_input($_POST['captnote']));
    if (isset($_POST['captconfirm']) && $_POST['captconfirm'] == 'on') {
    } else {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_CAPTURE_CONFIRM_ERROR, 'error');
      $proceedToCapture = false;
    }

    $lp_trans_num = (isset($_POST['captauthid']) && $_POST['captauthid'] != '') ? strip_tags(zen_db_input($_POST['captauthid'])) : '';
    $sql = "select lp_trans_num, chargetotal from " . TABLE_LINKPOINT_API . " where order_id = " . (int)$oID . " and transaction_result = 'APPROVED' order by date_added";
    if ($lp_trans_num != '') $sql = "select lp_trans_num, chargetotal from " . TABLE_LINKPOINT_API . " where lp_trans_num = :trans_num: and transaction_result = 'APPROVED' order by date_added";
    $sql = $db->bindVars($sql, ':trans_num:', $lp_trans_num, 'string');
    $query = $db->Execute($sql);
    if ($query->RecordCount() < 1) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_NO_MATCHING_ORDER_FOUND, 'error');
      $proceedToCapture = false;
    }
    $captureAmt = (isset($_POST['captamt']) && $_POST['captamt'] != '') ? (float)strip_tags(zen_db_input($_POST['captamt'])) : $query->fields['chargetotal'];
    if (isset($_POST['btndocapture']) && $_POST['btndocapture'] == MODULE_PAYMENT_LINKPOINT_API_ENTRY_CAPTURE_BUTTON_TEXT) {
      if ($captureAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_INVALID_CAPTURE_AMOUNT, 'error');
        $proceedToCapture = false;
      }
    }
    /**
     * Submit capture request to Gateway
     */
    if ($proceedToCapture) {
      unset($myorder);
      $myorder["ordertype"] = 'POSTAUTH';
      $myorder["oid"] = $query->fields['lp_trans_num'];
      $myorder["chargetotal"] = number_format($captureAmt, 2, '.', '');
      $myorder["comments"]  = htmlentities($captureNote, ENT_QUOTES, 'UTF-8');

      $result = $this->_sendRequest($myorder);
      $response_alert = $result['r_approved'] . ' ' . $result['r_error'] . ($this->commError == '' ? '' : ' Communications Error - Please notify webmaster.');
      $failure = ($result["r_approved"] != "APPROVED");
      if ($failure) {
        $messageStack->add_session($response_alert, 'error');
      } else {
        // Success, so save the results
        $this->_updateOrderStatus($oID, $new_order_status, 'FUNDS COLLECTED. Auth Code: ' . substr($result['r_code'], 0, 6) . ' - ' . 'Trans ID: ' . $result['r_tdate'] . "\n" . ' Amount: ' . number_format($captureAmt, 2) . "\n" . $captureNote);
        $messageStack->add_session(sprintf(MODULE_PAYMENT_LINKPOINT_API_TEXT_CAPT_INITIATED, $captureAmt, $result['r_tdate'], substr($result['r_code'], 0, 6)), 'success');
        return true;
      }
    }
    return false;
  }
539688
public function allDocs($limit = null, $startKey = null, $endKey = null, $skip = null, $descending = false)
    {
        $allDocsPath = '/'.$this->databaseName.'/_all_docs?include_docs=true';
        if ($limit) {
            $allDocsPath .= '&limit='.(int) $limit;
        }
        if ($startKey) {
            $allDocsPath .= '&startkey="'.(string) $startKey.'"';
        }
        if (!is_null($endKey)) {
            $allDocsPath .= '&endkey="'.(string) $endKey.'"';
        }
        if (!is_null($skip) && (int) $skip > 0) {
            $allDocsPath .= '&skip='.(int) $skip;
        }
        if (!is_null($descending) && (bool) $descending === true) {
            $allDocsPath .= '&descending=true';
        }

        return $this->httpClient->request('GET', $allDocsPath);
    }
1289652
static function PDO(\PDO $pdo):self{
    return new class($host, $port) implements \ArrayAccess{

      function __construct(string $host, int $port){

      }

      function offsetExists($uri){

      }

      function offsetGet($uri):\ArrayAccess{
        return new class($uri) extends \Exception implements \ArrayAccess{#{{{

        };#}}}
      }

      function offsetSet($uri, $value){

      }

      function offsetUnset($uri){

      }

    };
  }
193547
function inspect($source) {
		$fw=Base::instance();
		$web=Web::instance();
		$parts=parse_url($source);
		if (empty($parts['scheme']) || empty($parts['host']) ||
			$parts['host']==$fw->get('HOST')) {
			$req=$web->request($source);
			$doc=new DOMDocument('1.0',$fw->get('ENCODING'));
			$doc->stricterrorchecking=FALSE;
			$doc->recover=TRUE;
			if ($req && @$doc->loadhtml($req['body'])) {
				// Parse anchor tags
				$links=$doc->getelementsbytagname('a');
				foreach ($links as $link) {
					$permalink=$link->getattribute('href');
					// Find pingback-enabled resources
					if ($permalink && $found=$this->enabled($permalink)) {
						$req=$web->request($found,
							array(
								'method'=>'POST',
								'header'=>'Content-Type: application/xml',
								'content'=>xmlrpc_encode_request(
									'pingback.ping',
									array($source,$permalink),
									array('encoding'=>$fw->get('ENCODING'))
								)
							)
						);
						if ($req && $req['body'])
							$this->log.=date('r').' '.
								$permalink.' [permalink:'.$found.']'.PHP_EOL.
								$req['body'].PHP_EOL;
					}
				}
			}
			unset($doc);
		}
	}
743660
public function get($table, $where = array(), $offset = null, $count = null, $time = null, $order = array(), $od = "ValidFrom", $do = "ValidUntil", $id2 = "ID", $cols = array(), $groupby = array(), $having = array(), $distinct = false, $fast = false) {
        $data = array("QueryBuilder" => array("Where" => $where, "Offset" => $offset, "Limit" => $count, "Time" => $time, "Sort" => $order, "Cols" => $cols, "GroupBy" => $groupby, "Having" => $having, "Distinct" => $distinct));
        $data["ApiKeySession"] = $this->Session;
        $data["CRC"] = Client::MakeCRC($data, $this->ApiPass);
        try {
            $results = Client::Call($this->Server . "/" . $table . "/Request", $data);
            return new APIResult($results);
        }
        catch(\Exception $exc) {
            $this->lastError = $exc->getMessage();
            if (self::$DEBUG_CRC) {
                if (strpos($this->lastError, "CRC does not match")) {
                    $add = "Request failed! Client data: ";
                    $add.= \AsyncWeb\Api\REST\Client::MakeHashString($data);
                    $add.= " CRC: " . Client::MakeCRC($data, $this->ApiPass);
                    $this->lastError.= "<br>\n" . $add;
                }
            }
            return false;
        }
    }
1131869
private function processDocument(
        $className,
        array $doctrineMapping,
        \DOMElement $serializerMapping = null,
        array $schemaMapping = null
    ) {
        if ($serializerMapping === null) {
            $serializerFields = [];
        } else {
            $serializerFields = array_reduce(
                $this->getSerializerFields($serializerMapping),
                function (array $fields, array $field) {
                    $fields[$field['fieldName']] = $field;
                    return $fields;
                },
                []
            );
        }

        if ($schemaMapping === null) {
            $schemaFields = [];
        } else {
            $schemaFields = $schemaMapping;
        }

        $fields = [];
        foreach ($this->getDoctrineFields($doctrineMapping) as $doctrineField) {
            $serializerField = isset($serializerFields[$doctrineField['name']]) ?
                $serializerFields[$doctrineField['name']] :
                null;
            $schemaField = isset($schemaFields[$doctrineField['name']]) ?
                $schemaFields[$doctrineField['name']] :
                null;

            if ($doctrineField['type'] === 'collection') {
                $fields[] = new ArrayField(
                    $serializerField === null ? 'array<string>' : $serializerField['fieldType'],
                    $doctrineField['name'],
                    $serializerField === null ? $doctrineField['name'] : $serializerField['exposedName'],
                    !isset($schemaField['readOnly']) ? false : $schemaField['readOnly'],
                    ($schemaField === null || !isset($schemaField['required'])) ? false : $schemaField['required'],
                    !isset($schemaField['recordOriginException']) ? false : $schemaField['recordOriginException'],
                    !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
                );
            } else {
                $fields[] = new Field(
                    $doctrineField['type'],
                    $doctrineField['name'],
                    $serializerField === null ? $doctrineField['name'] : $serializerField['exposedName'],
                    !isset($schemaField['readOnly']) ? false : $schemaField['readOnly'],
                    ($schemaField === null || !isset($schemaField['required'])) ? false : $schemaField['required'],
                    $serializerField === null ? false : $serializerField['searchable'],
                    !isset($schemaField['recordOriginException']) ? false : $schemaField['recordOriginException'],
                    !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
                );
            }
        }
        foreach ($this->getDoctrineEmbedOneFields($doctrineMapping) as $doctrineField) {
            $serializerField = isset($serializerFields[$doctrineField['name']]) ?
                $serializerFields[$doctrineField['name']] :
                null;
            $schemaField = isset($schemaFields[$doctrineField['name']]) ?
                $schemaFields[$doctrineField['name']] :
                null;

            $fields[] = new EmbedOne(
                $this->getDocument($doctrineField['type']),
                $doctrineField['name'],
                $serializerField === null ? $doctrineField['name'] : $serializerField['exposedName'],
                !isset($schemaField['readOnly']) ? false : $schemaField['readOnly'],
                ($schemaField === null || !isset($schemaField['required'])) ? false : $schemaField['required'],
                !isset($schemaField['recordOriginException']) ? false : $schemaField['recordOriginException'],
                !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
            );
        }
        foreach ($this->getDoctrineEmbedManyFields($doctrineMapping) as $doctrineField) {
            $serializerField = isset($serializerFields[$doctrineField['name']]) ?
                $serializerFields[$doctrineField['name']] :
                null;
            $schemaField = isset($schemaFields[$doctrineField['name']]) ?
                $schemaFields[$doctrineField['name']] :
                null;

            $fields[] = new EmbedMany(
                $this->getDocument($doctrineField['type']),
                $doctrineField['name'],
                $serializerField === null ? $doctrineField['name'] : $serializerField['exposedName'],
                !isset($schemaField['readOnly']) ? false : $schemaField['readOnly'],
                ($schemaField === null || !isset($schemaField['required'])) ? false : $schemaField['required'],
                !isset($schemaField['recordOriginException']) ? false : $schemaField['recordOriginException'],
                !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
            );
        }

        $doc = new Document($className, $fields);

        // stuff that belongs to the whole document
        if (isset($schemaMapping['_base']['solr']['fields'])) {
            $doc->setSolrFields($schemaMapping['_base']['solr']['fields']);
        }
        if (isset($schemaMapping['_base']['solr']['aggregate'])) {
            $doc->setSolrAggregate($schemaMapping['_base']['solr']['aggregate']);
        }

        return $doc;
    }
76510
public static function method(
    $name,
    $params = [],
    $visibility = 'public',
    $body = '//todo',
    $docblock = ''
  )
  {
    if (empty($docblock))
    {
      if (!empty($params))
      {
        $docblock = new DocBlockGenerator();
        foreach ($params as $param)
        {
          $tag = new Tag('param', $param->getType() . ' $' . $param->getName());
          $docblock->setTag($tag);
        }
      }
    }

    return (new MethodGenerator($name, $params))
    ->setBody($body)
    ->setVisibility($visibility)
    ->setDocBlock($docblock)
    ->setIndentation(Generator::$indentation);
  }
1320156
public function find( $table, $fields = null, $where = null, $order = null, $limit = null, $offset = null, $array = array (), $fetchMode = \PDO::FETCH_ASSOC )
     {
         // TODO: Implement find() method.
     }
412116
protected function normalizeParams(DocBlock $phpdoc)
    {
        //Get the return type and adjust them for beter autocomplete
        $paramTags = $phpdoc->getTagsByName('param');
        if ($paramTags) {
            /** @var ParamTag $tag */
            foreach ($paramTags as $tag) {
                // Convert the keywords
                $content = $this->convertKeywords($tag->getContent());
                $tag->setContent($content);

                // Get the expanded type and re-set the content
                $content = $tag->getType() . ' ' . $tag->getVariableName() . ' ' . $tag->getDescription();
                $tag->setContent(trim($content));
            }
        }
    }
295586
static function subscribed($to)
    {
        $xml = self::maker($to, false, false, false, 'subscribed');
        \Moxl\API::request($xml);
    }
1238367
private function getMixinsFromPhpDocs(string $phpdocs, string $pattern): array
    {
        preg_match_all($pattern, $phpdocs, $mixins);

        return array_map(function ($mixin) {
            return preg_replace('#^\\\\#', '', $mixin);
        }, $mixins[1]);
    }
18621
protected function getData() {

        $sql = ['SELECT document FROM '.$this->collection->name];

        if ($this->criteria) {

            $sql[] = 'WHERE document_criteria("'.$this->criteria.'", document)';
        }

        if ($this->sort) {

            $orders = [];

            foreach ($this->sort as $field => $direction) {
                $orders[] = 'document_key("'.$field.'", document) '.($direction==-1 ? 'DESC':'ASC');
            }

            $sql[] = 'ORDER BY '.\implode(',', $orders);
        }

        if ($this->limit) {
            $sql[] = 'LIMIT '.$this->limit;

            if ($this->skip) { $sql[] = 'OFFSET '.$this->skip; }
        }

        $sql = implode(' ', $sql);

        $stmt      = $this->collection->database->connection->query($sql);
        $result    = $stmt->fetchAll( \PDO::FETCH_ASSOC);
        $documents = [];

        if (!$this->projection) {

            foreach ($result as &$doc) {
                $documents[] = \json_decode($doc['document'], true);
            }

        } else {

            $exclude = [];
            $include = [];

            foreach ($this->projection as $key => $value) {

                if ($value) {
                    $include[$key] = 1;
                } else {
                    $exclude[$key] = 1;
                }
            }

            foreach ($result as &$doc) {

                $item = \json_decode($doc['document'], true);
                $id   = $item['_id'];

                if ($exclude) {
                    $item = \array_diff_key($item, $exclude);
                }

                if ($include) {
                    $item = array_key_intersect($item, $include);
                }

                if (!isset($exclude['_id'])) {
                    $item['_id'] = $id;
                }

                $documents[] = $item;
            }
        }

        return $documents;
    }
145193
public function execute($object)
    {
        $callable = array($object, $this->methodName);

        if (!is_callable($callable)) {
            $className = get_class($object);

            throw new RuntimeException("Method '$this->methodName' does not exist in object of class '$className'");
        }

        return call_user_func_array($callable, $this->params);
    }
349966
function _doc_builder(doc) {
				if(is.object(doc)) {
					ARRAY(methods).forEach(function(method) {
						doc[method.$name] = FUNCTION.parse(method.$body).bind(doc);
					});
				}
				return doc;
			}
902717
static function getDocumentMap($document){
        // TODO: hadi 1396-07: It is better to move this function to Collection_Document class
        $attr = new Collection_Attribute();
        $map = $attr->getList(
            array(
                'filter' => 'document=' . $document->id
            ));
        $result = array();
        $iterator = $map->getIterator();
        while ($iterator->valid()) {
            $attr = $iterator->current();
            $result[$attr->key] = $attr->value;
            $iterator->next();
        }
        
        $result['id'] = $document->id;
        $result['collection'] = $document->collection;
        return $result;
    }
813010
function &get($key) {
		if ($key=='_id')
			return $this->_id;
		elseif (array_key_exists($key,$this->fields))
			return $this->fields[$key]['value'];
		elseif (array_key_exists($key,$this->adhoc))
			return $this->adhoc[$key]['value'];
		elseif (array_key_exists($key,$this->props))
			return $this->props[$key];
		user_error(sprintf(self::E_Field,$key),E_USER_ERROR);
	}