<?php

namespace KupShop\OrderingBundle\Util\Address;

class AddressFormatter
{
    /**
     * Return street with separated street name and cp number.
     *
     * @return array [street, cp]
     */
    public static function splitStreet($street)
    {
        if (preg_match('/(.*)\s(\d+)$/', $street, $matches)) {
            return [$matches[1], $matches[2]];
        }

        return [$street, ''];
    }
}
