blob: b923bd57ea428ca1b5aeaa97cd79f21ba1dbec92 (
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
|
/**
* Parameters.cpp
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013 Copernica BV
*/
#include "includes.h"
/**
* Set up namespace
*/
namespace Php {
/**
* Parameters
* @param this_ptr Pointer to the object
* @param argc Number of arguments
* @param tsrm_ls
*/
Parameters::Parameters(zval *this_ptr, int argc TSRMLS_DC) : _this(this_ptr)
{
// reserve plenty of space
reserve(argc);
// loop through the arguments
for (int i=0; i<argc; i++)
{
// get the argument
zval **arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (argc-i));
// append value
push_back(Value(*arg));
}
}
/**
* The the object that is called
* @return Base
*/
Base *Parameters::object()
{
// do we have a this pointer in the first place? The member is not set
// when static methods are being called, or when a regular function is
// called in a static context
if (!_this) return nullptr;
// get the mixed object
MixedObject *obj = (MixedObject *)zend_object_store_get_object(_this TSRMLS_CC);
// return the CPP object
return obj->cpp;
}
/**
* End of namespace
*/
}
|