#!/bin/bash
hasInvalidPhpSyntax() {
# php lint
$(php -l "$1" > /dev/null)
if [[ $? != 0 ]]; then
echo 1
return 1
fi
# phpcs
$(php -d memory_limit=4G ${rootpath}/vendor/bin/phpcs --standard="${rootpath}/Build/Config/phpcs.xml" --encoding=utf-8 -n -p "$1" > /dev/null)
if [[ $? != 0 ]]; then
echo 2
return 2
fi
# phpmd
$(php -d memory_limit=4G ${rootpath}/vendor/bin/phpmd "$1" text ${rootpath}/Build/Config/phpmd.xml --exclude *tests* --minimumpriority 1 > /dev/null)
if [[ $? != 0 ]]; then
echo 3
return 3
fi
echo 0
return 0
}
hasInvalidHtmlTemplateContent() {
# Images must have a alt= attribute *error*
if [[ -n $(grep -P '(\)' "$1") ]]; then
echo 1
return 1
fi
# Input elements must have a type= attribute *error*
if [[ -n $(grep -P '()' "$1") ]]; then
echo 2
return 2
fi
# Form fields must have a name *error*
if [[ -n $(grep -P '()' "$1") ]]; then
echo 3
return 3
fi
# Form must have a id, action and method *error*
if [[ -n $(grep -P '(\