This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
// https://www.npmjs.com/package/php-parser | |
var parser = require('php-parser'); | |
// https://www.npmjs.com/package/glob | |
var glob = require('glob'); | |
glob("**/*.php", options, function (er, files) { | |
for(var i = 0; i < files.length; i++) { | |
var file = files[i]; | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initialize the php parser factory class | |
var engine = require('php-parser'); | |
var transpiler = require('php-transpiler'); | |
var jsCode = transpiler.generate( | |
engine.parseCode('<?php echo "Hello World";') | |
); | |
console.log(jsCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install php-transpiler --save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Some namespace & file description | |
*/ | |
namespace foo { | |
function bar($a, $b) { | |
return $a + $b; | |
} | |
// will print : 5 | |
echo bar(2, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = require('php-parser'); | |
// initialize a new parser instance | |
var instance = new parser({ | |
parser: { | |
extractDoc: true, | |
suppressErrors: true | |
}, | |
ast: { | |
withPositions: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install php-parser --save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Decorable { | |
public function doSomething(); | |
} | |
interface Decorator extends Decorable { | |
public function __construct(Decorable $target); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lex = require('./lexer'); | |
var tokens = require('./tokens'); | |
var names = require('./grammar/tokens'); | |
function isNumber(n) { | |
return n != '.' && n != ',' && !isNaN(parseFloat(n)) && isFinite(n); | |
} | |
function getTokenName(token) { | |
if (!isNumber(token)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="../core-menu/core-submenu.html" rel="import"> | |
<link href="../core-item/core-item.html" rel="import"> | |
<link href="../core-pages/core-pages.html" rel="import"> | |
<link href="../paper-checkbox/paper-checkbox.html" rel="import"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
#design_host { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('CRLF', "\r\n"); | |
class HaveToWork extends Thread { | |
protected $wait; | |
public $socket = null; | |
public function __construct() { | |
$this->wait = true; | |
$this->start(); | |
} | |
public function run() { |
NewerOlder