#!/usr/bin/env bash

DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
source "$DIR/../vendor/bin/echolorized"

colored_output "$GREEN" "\n[EXECUTING PRE COMMIT HOOK]"

DIRECTORIES="src"

e_info "Removing VarDump uses"
# shellcheck disable=SC2086
find $DIRECTORIES -type f -name '*.php' -exec sed -i '/VarDumper/d' {} \;

e_info "Fixing PHP Code Style"
# shellcheck disable=SC2086
vendor/bin/php-cs-fixer --quiet fix $DIRECTORIES --config=.php_cs

e_success "All good, staging additional changes.\n"
git update-index --again
