summaryrefslogtreecommitdiff
path: root/zend/functor.cpp
blob: 866fcea08c928e03bbae6b15d2eb2ec529dca032 (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
/**
 *  Functor.cpp
 *
 *  Implementation file for the functor class
 *
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2015 Copernica BV
 */

/**
 *  Dependencies
 */
#include "includes.h"

/**
 *  Set up namespace
 */
namespace Php {

/**
 *  The classentry
 *  @var zend_class_entry
 */
zend_class_entry *Functor::_entry = nullptr;

/**
 *  Initialize the class
 *  @param  tsrmls
 */
void Functor::initialize(TSRMLS_D)
{
    // leap out if the class entry is already set
    if (_entry) return;

    // construct functor object
    static std::unique_ptr<ClassBase> functor(new Class<Functor>("PhpCpp::Functor"));

    // initialize the functor class
    _entry = functor->implementation()->initialize(functor.get(), "" TSRMLS_CC);
}

/**
 *  Shutdown the class
 *  @param  tsrmls
 */
void Functor::shutdown(TSRMLS_D)
{
    // we forget the entry
    _entry = nullptr;
}

/**
 *  End of namespace
 */
}