~ubuntu-branches/ubuntu/utopic/kdevelop-php/utopic

« back to all changes in this revision

Viewing changes to create_functions.php

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2010-03-14 10:19:34 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100314101934-d24i8t1niai087ul
Tags: 1.0.0~beta4-1
New upstream release. (Closes: #573811)

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
uksort($classes, 'strnatcasecmp');
198
198
uksort($constants, 'strnatcasecmp');
199
199
 
 
200
// put exception up front
 
201
$exception = $classes['exception'];
 
202
unset($classes['exception']);
 
203
$classes = array_merge(array('exception' => $exception), $classes);
 
204
reset($classes);
 
205
 
200
206
foreach ($variables as $name=>$var) {
201
207
    $declarationCount++;
202
208
    $moreDesc = array();
216
222
}
217
223
 
218
224
foreach ($classes as $class => $i) {
 
225
    ///TODO: find proper fix for that
 
226
    $i['isInterface'] = $i['isInterface'] && empty($i['implements']);
219
227
    if (in_array($class, $skipClasses)) continue; //skip those as they are documented in spl.php
220
228
    if ($class != 'global') {
221
229
        if (isset($i['desc'])) {
293
301
            if ($param['isRef']) $out .= "&";
294
302
            $out .= '$'.$param['name'];
295
303
        }
296
 
        $out .= ") {}\n\n";
 
304
        $out .= ")";
 
305
        if ( !$i['isInterface'] ) {
 
306
            $out .= "{}";
 
307
        } else {
 
308
            $out .= ";";
 
309
        }
 
310
        $out .= "\n\n";
297
311
        $declarationCount++;
298
312
    }
299
313
 
321
335
        echo "saving phpfunctions.php file\n";
322
336
        file_put_contents("phpfunctions.php", $out);
323
337
    }
324
 
    echo "removing phpfunctions.php.zip...\n";
325
 
    unlink('phpfunctions.php.zip');
326
 
    echo "calling zip phpfunctions.php.zip phpfunctions.php...\n";
327
 
    shell_exec("zip phpfunctions.php.zip phpfunctions.php");
 
338
 
 
339
    if ( shell_exec("which php-parser") ) {
 
340
        echo "making sure phpfunctions file is valid...\n";
 
341
        system("php-parser phpfunctions.php", $ret);
 
342
        if ( $ret != 0 ) {
 
343
            die("could not parse file, aborting\n");
 
344
        }
 
345
    } else {
 
346
        echo "note: put php-parser in your path and I can check the generated file directly...\n";
 
347
    }
 
348
 
 
349
    echo "removing phpfunctions.php.gz...\n";
 
350
    unlink('phpfunctions.php.gz');
 
351
    echo "calling gzip phpfunctions.php...\n";
 
352
    shell_exec("gzip phpfunctions.php");
328
353
    echo "done\n";
329
354
} else {
330
355
    echo "phpfunctions.php\n~~~~\n$out\n~~~~\n";
354
379
    foreach ($removeSections as $i) {
355
380
        $string = preg_replace('#'.preg_quote('<section xml:id="'.$i.'">').'.*?</section>#s', '', $string);
356
381
    }
 
382
    echo "reading documentation from {$file->getPathname()}\n";
357
383
    $xml = new SimpleXMLElement($string);
358
384
 
359
385
    if ( $file->getFilename() == 'versions.xml' ) {