install phpmd:
composer require phpmd/phpmd
run phpmd:
phpmd <<filename.php>> <<format>> cleancode,codesize,controversial,design,naming,unusedcode
for format you can use: xml, txt ot hmtl
you can evaluate the code online with: http://www.icosaedro.it/phplint/phplint-on-line.html