PHP Classes
elePHPant
Icontem

File: sampleclass.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rodolfo Pereira Romano  >  PHP API Server Builder  >  sampleclass.php  >  Download  
File: sampleclass.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP API Server Builder
Build a REST server API from custom classes
Author: By
Last change:
Date: 8 months ago
Size: 901 bytes
 

Contents

Class file image Download
<?php
   
class SampleKeyValidator extends ApiKeyValidatorBase {
        function
isValid($key) {
            return (
$key == "75f42660c4109c3dc81101d3a45fa174");
        }
    }

   
registerClass("Test_v1", "1");
    class
Test_v1 extends ApiCommandBase {
        function
_getURIName() {
            return
"random";
        }

        function
getNumber() {
            return
rand(0,100);
        }
    }

   
registerClass("Test_v2", "2");
   
/**
     * TESTE This is a doc_comment.
     */
   
class Test_v2 extends Test_v1 {
        function
getNumber() {
            return
rand(101,1000);
        }

       
/**
         * Retorna um número entre <i>min</i> e <i>max</i>
         */
       
function getNumberRange($min = 0, $max = 100) {
            return
rand($min,$max);
        }
    }

   
registerClass("Test_v3", "2");
    class
Test_v3 extends ApiComamndKeyed {
        function
getSecureString() {
            return
"string protected by Key";
        }

        function
_getURIName() {
            return
"text";
        }
    }
?>