summaryrefslogtreecommitdiff
path: root/lib/codebird-php/test/codebirdt.php
blob: dd54dfc4a7d69eb00e714af766f16ce3d4438499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php

namespace Codebird;
require_once ('src/codebird.php');

/**
 * A Twitter library in PHP.
 *
 * @package   codebird-test
 * @author    Jublo Solutions <support@jublo.net>
 * @copyright 2010-2016 Jublo Solutions <support@jublo.net>
 * @license   https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
 * @link      https://github.com/jublonet/codebird-php
 */

/**
 * Codebird testing class
 *
 * @package codebird-test
 */
class CodebirdT extends Codebird
{
  /**
   * Returns properties
   *
   * @param string $property The property to get
   *
   * @return mixed Property
   */
  public function get($property)
  {
    if (property_exists($this, $property)) {
      return $this->$property;
    }
    throw new \Exception('Property ' . $property . ' is not defined.');
  }

  /**
   * Returns static properties
   *
   * @param string $property The property to get
   *
   * @return mixed Property
   */
  public function getStatic($property)
  {
    if (property_exists($this, $property)) {
      return static::$$property;
    }
    throw new \Exception('Static property ' . $property . ' is not defined.');
  }

  /**
   * Calls methods
   *
   * @param string $property The property to get
   *
   * @return mixed Property
   */
  public function call($method, $params = [], &$params2 = null)
  {
    $methods_byref = [
      '_mapFnToApiMethod',
      '_mapFnInlineParams',
      '_detectMethod'
    ];
    if (in_array($method, $methods_byref)) {
      return $this->$method($params, $params2);
    }
    if (method_exists($this, $method)) {
      return call_user_func_array([$this, $method], $params);
    }
    throw new \Exception('Method ' . $method . ' is not defined.');
  }

  /**
   * Calls methods
   *
   * @param string $property The property to get
   *
   * @return mixed Property
   */
  public function callStatic($method, $params = [])
  {
    if (function_exists([self, $method])) {
      return call_user_func_array([self, $method], $params);
    }
    throw new \Exception('Static method ' . $method . ' is not defined.');
  }

  /**
   * Streaming callback test
   */
  public static function streamingCallbackTest()
  {
  }
}