To get your PR more easily accepted and merged, use PSR-2 coding standards (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md): `if (!empty($dir))`.
Concerning concatenation operator (\.\), there is no PSR coding standard as far as I know, but it would be better to remove surrounding spaces as the rest of the class don't have them.