Refactoring Utils

This removes duplication regarding the `calculateIndent` function, adds missing docblocks, and adds tests for the `calculateIndent` function too.
Agree with accepting token and throw exception. Mentioned it earlier for
countlines as well.
Op 19 dec. 2014 09:27 schreef "Dariusz Rumiński" <notifications@github.com>:

> In Symfony/CS/Utils.php
> <https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/904#discussion-diff-22094182>
> :
>
> >      public static function splitLines($content)
> >      {
> >          preg_match_all("/[^\n\r]+[\r\n]*/", $content, $matches);
> >
> >          return $matches[0];
> >      }
> > +
> > +    /**
> > +     * Calculate used indentation in whitespace.
> > +     *
> > +     * What we're doing here is grabbing everything after the final newline.
> > +     *
> > +     * @param string $content
> > +     *
> > +     * @return string
> > +     */
> > +    public static function calculateIndent($content)
>
> Yeah, my code wasn't token but string - perfectly valid for current
> interface.
> I am totally for changing interface to Token.
> I, personally, do sth like
>
> public static function TokensAnalyzer::calculateWhitespaceTrailingIndent(Token $token){    if (!$token->isComment()) {        throw ...    }    return ....}
>
> but it is just a first thought, need rethink
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/904/files#r22094182>.
>