PHP Classes

File: src/Plugin/Request.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon   src/Plugin/Request.php   Download  
File: src/Plugin/Request.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change: Refactored the code generation feature.
Fixed issues in classes documentation.
Added a Target class to represent the called function or class.
The target method or function is passed to callbacks.
Changed the signature of the register() method.
Date: 5 years ago
Size: 2,814 bytes
 

Contents

Class file image Download
<?php

/**
 * Request.php - Jaxon Request interface
 *
 * Interface for Jaxon Request plugins.
 *
 * Request plugins handle the registration, client script generation and processing of jaxon enabled requests.
 * Each plugin should have a unique signature for both the registration and processing of requests.
 * During registration, the user will specify a type which will allow the plugin to detect and handle it.
 * During client script generation, the plugin will generate a <jaxon.request> stub with the prescribed call options and request signature.
 * During request processing, the plugin will detect the signature generated previously and process the request accordingly.
 *
 * @package jaxon-core
 * @author Jared White
 * @author J. Max Wilson
 * @author Joseph Woolley
 * @author Steffen Konerow
 * @author Thierry Feuzeu <thierry.feuzeu@gmail.com>
 * @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
 * @copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
 * @copyright 2016 Thierry Feuzeu <thierry.feuzeu@gmail.com>
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
 * @link https://github.com/jaxon-php/jaxon-core
 */

namespace Jaxon\Plugin;

use
Jaxon\Request\Target;

abstract class
Request extends Plugin
{
   
/**
     * Register a function, an event or an object.
     *
     * Called by the <Jaxon\Plugin\Manager> when a user script
     * when a function or callable object is to be registered.
     * Additional plugins may support other registration types.
     *
     * @param string $sType The type of request handler being registered
     * @param string $sCallable The callable entity being registered
     * @param array|string $aOptions The associated options
     *
     * @return boolean
     */
   
public function register($sType, $sCallable, $aOptions)
    {
        return
false;
    }

   
/**
     * Get the target function or class and method
     *
     * @return Target|null
     */
   
public function getTarget()
    {
        return
null;
    }

   
/**
     * Check if this plugin can process the current request
     *
     * Called by the <Jaxon\Plugin\Manager> when a request has been received to determine
     * if the request is destinated to this request plugin.
     *
     * @return boolean
     */
   
abstract public function canProcessRequest();

   
/**
     * Process the current request
     *
     * Called by the <Jaxon\Plugin\Manager> when a request is being processed.
     * This will only occur when <Jaxon> has determined that the current request
     * is a valid (registered) jaxon enabled function via <jaxon->canProcessRequest>.
     *
     * @return boolean
     */
   
abstract public function processRequest();
}