Close #21 + PhpDoc

L98-L119 by @marhei (license unknown)