diff --git a/src/languages/PHP.js b/src/languages/PHP.js index 4d47a12..73bde2c 100644 --- a/src/languages/PHP.js +++ b/src/languages/PHP.js @@ -6,7 +6,7 @@ define(function (require, exports, module) { var defaultVisibilty = "public"; var unnamedPlaceholder = "function"; - function createListEntry(name, args, vis, line, ch) { + function createListEntry(name, args, vis, isStatic, line, ch) { var $elements = []; var $name = $(document.createElement("span")); $name.addClass("outline-entry-name"); @@ -16,11 +16,15 @@ define(function (require, exports, module) { $arguments.addClass("outline-entry-arg"); $arguments.text(args); $elements.push($arguments); + var classes = "outline-entry-php outline-entry-icon outline-entry-" + vis; + if (isStatic) { + classes += " outline-entry-static"; + } return { name: name, line: line, ch: ch, - classes: "outline-entry-php outline-entry-icon outline-entry-" + vis, + classes: classes, $html: $elements }; } @@ -33,14 +37,15 @@ define(function (require, exports, module) { * @returns {Array} List of outline entries. */ function getOutlineList(lines, showArguments, showUnnamed) { - var regex = /(?:([\w$]+)\s*[=:]\s*)?(public|protected|private)?\s*function(?:\s+(?:&\s*)?([\w]+))?\s*(\([\w,\s&$='"\\()]*\))/g; + var regex = /(?:([\w$]+)\s*[=:]\s*)?(public|protected|private)?\s*(static)?\s*function(?:\s+(?:&\s*)?([\w]+))?\s*(\(.*\))/g; var result = []; lines.forEach(function (line, index) { var match = regex.exec(line); while (match !== null) { - var name = (match[1] || match[3] || "").trim(); + var name = (match[1] || match[4] || "").trim(); var vis = match[2] || defaultVisibilty; - var args = showArguments ? match[4] : ""; + var isStatic = match[3] === "static"; + var args = showArguments ? match[5] : ""; match = regex.exec(line); if (name.length === 0) { if (showUnnamed) { @@ -50,7 +55,7 @@ define(function (require, exports, module) { continue; } } - result.push(createListEntry(name, args, vis, index, line.length)); + result.push(createListEntry(name, args, vis, isStatic, index, line.length)); } }); return result; diff --git a/styles/styles.css b/styles/styles.css index 668bb5d..569afe4 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -105,6 +105,7 @@ .outline-entry-icon:before { display: inline-block; font-family: Ionicons; + font-style: normal; margin-right: 3px; text-align: center; width: 12px; @@ -222,6 +223,10 @@ font-family: sans-serif; } +.outline-entry-php.outline-entry-static { + font-style: italic; +} + /* Markdown */ .outline-entry-md {