PHP Classes

File: src/apiassembler

Recommend this page to a friend!
  Packages of Jorge Castro   PHP API Assembler   src/apiassembler   Download  
File: src/apiassembler
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP API Assembler
Application to generate files to implement an API
Author: By
Last change:
Date: 3 years ago
Size: 1,023 bytes
 

Contents

Class file image Download
<?php

namespace eftec;
use eftec\apiassembler\ApiAssembler;


// this code only runs on CLI but only if pdoonecli.php is called directly and via command line.
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !defined('__PHPUNIT_PHAR__')
    && isset($_SERVER['PHP_SELF']) &&
    ( basename($_SERVER['PHP_SELF']) === 'apiassembler' || basename($_SERVER['PHP_SELF']) === 'apiassembler2')
) {
    // we also excluded it if it is called by phpunit.
    $initPath = getcwd() ?: __DIR__;
    $prefix = '';
    $defaultvendor = $initPath;
    // finding vendor
    for ($i = 0; $i < 8; $i++) {
        if (@file_exists("$initPath/{$prefix}vendor/autoload.php")) {
            $path = "$initPath/{$prefix}vendor/autoload.php";
            break;
        }
        $prefix .= '../';
    }
    if(!isset($path)) {
        echo "autoload.php not found";
        die(1);
    }
    include_once $path ;
    $a=new PdoOneCli();
    $cli = new ApiAssembler();
    /** @noinspection PhpUnhandledExceptionInspection */
    $cli->cliEngine();
}