PHP Classes

File: tests/gen/_generate.php

Recommend this page to a friend!
  Packages of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/gen/_generate.php   Download  
File: tests/gen/_generate.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 10 years ago
Size: 1,076 bytes
 

Contents

Class file image Download
<?php
$targetdir = ''; //dirname(__FILE__) . '/'; 
$sourcedir = '../../A/';
$template = file_get_contents('../test_template.php');
$dirs = array(
    '.',
    'Cart',
    'Cart/Creditcard',
    'Cart/Payment',
    'Cart/Shipping',
    'Config',
    'Controller',
    'Controller/Action',
    'Controller/Form',
    'Controller/Front',
    'Db',
    'Db/Datamapper',
    'Email',
    'Filter',
    'Html',
    'Html/Form',
    'Http',
    'Logger',
    'Pager',
    'Rule',
    'Sql',
    'Template',
    'User',
    'User/Rule',
);
foreach($dirs as $dir) {
    $classbase = $dir != '.' ? str_replace('/', '_', $dir) . '_' : '';
    foreach(glob($sourcedir . $dir . '/*.php') as $classfile) {
        $class = $classbase . str_replace('.php', '', basename($classfile));
        $filename = $targetdir . $class . '_test.php';
        if (file_exists($filename)) {
            unlink($filename);
        }
        echo "Reading <strong>$classfile</strong> class <strong>A_$class</strong> writing <strong>$filename</strong><br/>\n";
        file_put_contents($filename, str_replace(array('xxx','yyy'), array($class,str_replace('_','/',$class)), $template));
    }
}