Select Git revision
projectlist.class.php
sws.class.php 42.16 KiB
<?php
/*
* SIMPLE WEBSERVICE
* <br>
* THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE <br>
* LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR <br>
* OTHER PARTIES PROVIDE THE PROGRAM ?AS IS? WITHOUT WARRANTY OF ANY KIND, <br>
* EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED <br>
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE <br>
* ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. <br>
* SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY <br>
* SERVICING, REPAIR OR CORRECTION.<br>
* <br>
*
* --- HISTORY:<br>
* 2014-04-30 0.5 gui enhancements: input field for each param of all methods
* 2014-04-29 0.4 abstract all data before displaying them
* 2014-04-06 0.3 enable/ disable gui; detect class parameters
* 2014-04-05 0.2
* 2014-04-05 0.1 first public beta
*
* url params
* - class - classname
* - action - method to call [classname] -> [method]
* - args - arguments (as json)
* - type - outputtype (default: json)
*
* TODOs:
* - add param for arguments to initialize the class (detect params of __construct())
* - show an error: detect if a configured method is not public
* - parse parameters from phpdoc - detect required and optional params
* - parse parameters from phpdoc - show input fields for each parameters
* - configuration: option area
* - configuration: examples of a class + of actions
*
* @version 0.06
* @author Axel Hahn
* @link http://www.axel-hahn.de/php_sws
* @license GPL
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL 3.0
* @package Axels simple web service
*/
class sws {
/**
* config array with known classnames and its supported methods
* @var string
*/
private $_aKnownClasses = array();
/**
* array of incoming parameters (GET, POST)
* @var array
*/
private $_aParams = array();
/**
* name of the detected classname in the http request
* @var string
*/
private $_sClass = false;
/**
* name of the detected init arguments for the class in the http request
* @var string
*/
private $_aInit = array();