public static function convert(array $array)
    {
        if (function_exists('yaml_emit')) {
            $yaml = yaml_emit($array);

            // PHP-Yaml adds strange separators to the outputted YAML, we do
            // some manipulation of the outputted string to remove these.
            $yaml = explode("\n", $yaml);
            array_shift($yaml);
            array_pop($yaml);
            array_pop($yaml);

            return implode("\n", $yaml);
        }

        return spyc_dump($array);
    }