Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
Shell scripts
* Readme
dict
edit_json (php)
encrypt/decrypt
pdoc
pftp - ftp a file to some place
php fork & IPC
php input cli
phplint
~/bin/inc/lib.php
10
found
auth
Name:
Category: Shell scripts
Body:
phplint () { if [[ $1 = '-?' ]]; then echo " phplint runs php's linter (php -l <file>) on php files in the current and child directories."; echo " The vendor/ directory is skipped."; echo " If you need an older version of php:"; echo -e " for file in \$(find . -name '*php' -not -path './vendor/*'); do \e[35;1myourphp\e[0m -l \"\$file\" > /dev/null; done"; echo " That runs the thing for all the php files and discards non-error output."; return; fi; local errors=0; for file in $(find . -name '*php' -not -path './vendor/*'); do errMsg=$(php -l "$file" 2>&1); x=$?; if [[ "$x" != '0' ]]; then ((errors++)); errMsg=$(echo "$errMsg" | head -n1); case $errMsg in *"Parse error"*) echo -e " \e[31;1m${errMsg}\e[0m" ;; *"Deprecated"*) echo -e " \e[38;5;208m${errMsg}\e[0m" ;; # add more??? esac; fi; done; if [[ $errors > 0 ]]; then echo ' '$(php -v | head -n1); echo " Found $errors error(s)."; return 1; else echo ' Looks good to me!'; fi }
Footer