phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
traits.php
Go to the documentation of this file.
1<?php
9// Get the input
10$source = file_get_contents($argv[1]);
11
12// make traits to classes
13$regexp = '#trait([\s]+[\S]+[\s]*){#';
14$replace = 'class$1{';
15$source = preg_replace($regexp, $replace, $source);
16
17// use traits by extending them (classes that not extending a class)
18$regexp = '#class([\s]+[\S]+[\s]*)(implements[\s]+[\S]+[\s]*)?{[\s]+use([^;]+);#';
19$replace = 'class$1 extends $3 $2 {';
20$source = preg_replace($regexp, $replace, $source);
21
22// use traits by extending them (classes that already extending a class)
23$regexp = '#class([\s]+[\S]+[\s]+extends[\s]+[\S]+[\s]*)(implements[\s]+[\S]+[\s]*)?{[\s]+use([^;]+);#';
24$replace = 'class$1, $3 $2{';
25$source = preg_replace($regexp, $replace, $source);
26
27// Output
28echo $source;
$regexp
Definition traits.php:13
$source
Project: doxygen-php-filters Author: Alex Schickedanz (AbcAeffchen) Date: 05.03.2015 License: GPL v2....
Definition traits.php:10
$replace
Definition traits.php:14