PHP 8.2.30
Preview: GlobalFunctionFile.php Size: 930 B
/home/byroehnu/easetack.com/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php

<?php

/*
 Copyright (c) 2009 hamcrest.org
 */

class GlobalFunctionFile extends FactoryFile
{
    /**
     * @var string containing function definitions
     */
    private $functions;

    public function __construct($file)
    {
        parent::__construct($file, '    ');
        $this->functions = '';
    }

    public function addCall(FactoryCall $call)
    {
        $this->functions .= "\n" . $this->generateFactoryCall($call);
    }

    public function build()
    {
        $this->addFileHeader();
        $this->addPart('functions_imports');
        $this->addPart('functions_header');
        $this->addCode($this->functions);
        $this->addPart('functions_footer');
    }

    public function generateFactoryCall(FactoryCall $call)
    {
        $code = "if (!function_exists('{$call->getName()}')) {\n";
        $code.= parent::generateFactoryCall($call);
        $code.= "}\n";

        return $code;
    }
}

Directory Contents

Dirs: 1 × Files: 9

Name Size Perms Modified Actions
parts DIR
- drwxrwxrwx 2025-05-16 16:14:40
Edit Download
611 B lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
1.35 KB lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
2.95 KB lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
2.93 KB lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
5.51 KB lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
3.46 KB lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
930 B lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
1.06 KB lrw-rw-rw- 2020-07-09 08:09:16
Edit Download
773 B lrw-rw-rw- 2020-07-09 08:09:16
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).