1 | <?php namespace EventEspresso\core\libraries\rest_api\changes; |
||
34 | abstract class ChangesInBase |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * The version that these changes happened |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $version = null; |
||
43 | |||
44 | |||
45 | |||
46 | /** |
||
47 | * Called when an EE4 REST API request is made to an earlier version than |
||
48 | * what is indicated in this class' name. |
||
49 | * Uses WordPress' add_filter and add_action to modify the EE4 REST API's response |
||
50 | * so that regardless of what version of EE4 core is running, API clients |
||
51 | * will have a consistent response |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | abstract public function setHooks(); |
||
56 | |||
57 | |||
58 | |||
59 | /** |
||
60 | * Returns whether or not this class' name indicates its hooks should |
||
61 | * apply when a request comes in for $requested_version. A class can use |
||
62 | * other conditions when determining whether to perform their callbacks or not, |
||
63 | * but this will typically be enough |
||
64 | * |
||
65 | * @param string $requested_version eg "4.8.33" |
||
66 | * @return boolean true: this class' name indicates its filters and actions |
||
67 | * should take effect. False: this class' name indicates it shouldn't do anything |
||
68 | */ |
||
69 | public function appliesToVersion($requested_version) |
||
76 | |||
77 | |||
78 | |||
79 | /** |
||
80 | * Gets the EE core version when this changes were made to the rest api. |
||
81 | * Any requests to earlier versions should have modifications made to them |
||
82 | * by the callbacks of this class. |
||
83 | * |
||
84 | * @return string eg "4.8.33" |
||
85 | * @throws EE_Error |
||
86 | */ |
||
87 | public function version() |
||
110 | } |
||
111 |