<?php

/*
 * This file is part of the FOSJsRoutingBundle package.
 *
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FOS\JsRoutingBundle\Serializer\Normalizer;

use FOS\JsRoutingBundle\Response\RoutesResponse;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

/**
 * Class RoutesResponseNormalizer
 */
class RoutesResponseNormalizer implements NormalizerInterface
{
    /**
     * {@inheritdoc}
     */
    public function normalize($data, $format = null, array $context = array())
    {
        return array(
            'base_url' => $data->getBaseUrl(),
            'routes'   => $data->getRoutes(),
            'prefix'   => $data->getPrefix(),
            'host'     => $data->getHost(),
            'scheme'   => $data->getScheme(),
        );
    }

    /**
     * {@inheritDoc}
     */
    public function supportsNormalization($data, $format = null)
    {
        return $data instanceof RoutesResponse;
    }
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                        {
    "name": "friendsofsymfony/jsrouting-bundle",
    "type": "symfony-bundle",
    "description": "A pretty nice way to expose your Symfony2 routing to client applications.",
    "keywords": [ "js routing", "routing", "javascript" ],
    "homepage": "http://friendsofsymfony.github.com",
    "license": "MIT",
    "authors": [
        {
            "name": "William Durand",
            "email": "william.durand1@gmail.com"
        },
        {
            "name": "FriendsOfSymfony Community",
            "homepage": "https://github.com/friendsofsymfony/FOSJsRoutingBundle/contributors"
        }
    ],
    "require": {
        "php": ">=5.3.2",
        "symfony/framework-bundle": "~2.3",
        "symfony/serializer": "~2.0",
        "symfony/console": "~2.3",
        "willdurand/jsonp-callback-validator": "~1.0"
    },
    "autoload": {
        "psr-0": { "FOS\\JsRoutingBundle": "" }
    },
    "target-dir": "FOS/JsRoutingBundle",
    "extra": {
        "branch-alias": {
            "dev-master": "2.0-dev"
        }
    }
}
