Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActiveRecord
  • Cache
  • Configs
  • Core
  • DateTime
  • Debug
  • DeleteOperation
  • Errors
  • Event
  • EventHook
  • Events
  • FileCache
  • FormattedString
  • Helpers
  • I18n
  • Image
  • Inflections
  • Inflector
  • Models
  • Module
  • Modules
  • Object
  • Operation
  • PingOperation
  • Prototype
  • Route
  • Routes
  • SaveOperation
  • Session
  • TimeZone
  • TimeZoneLocation
  • Uploaded
  • Vars
  • VarsIterator

Interfaces

  • StorageInterface
  • ToArray
  • ToArrayRecursive

Traits

  • PrototypeTrait
  • ToArrayRecursiveTrait

Exceptions

  • AlreadyAuthenticated
  • AuthenticationRequired
  • Exception
  • ModuleConstructorMissing
  • ModuleIsDisabled
  • ModuleNotDefined
  • OffsetError
  • OffsetNotDefined
  • OffsetNotReadable
  • OffsetNotWritable
  • PermissionRequired
  • PropertyError
  • PropertyIsReserved
  • PropertyNotDefined
  • PropertyNotReadable
  • PropertyNotWritable
  • RouteNotDefined
  • SecurityException

Constants

  • TOKEN_ALPHA
  • TOKEN_ALPHA_UPCASE
  • TOKEN_NUMERIC
  • TOKEN_SYMBOL
  • TOKEN_SYMBOL_WIDE

Functions

  • array_flatten
  • array_insert
  • array_merge_recursive
  • camelize
  • capitalize
  • downcase
  • dump
  • escape
  • escape_all
  • exact_array_merge_recursive
  • excerpt
  • format
  • generate_token
  • generate_token_wide
  • generate_v4_uuid
  • get_autoconfig
  • humanize
  • hyphenate
  • log
  • log_error
  • log_info
  • log_success
  • log_time
  • normalize
  • normalize_namespace_part
  • normalize_url_path
  • pbkdf2
  • pluralize
  • remove_accents
  • shorten
  • singularize
  • sort_by_weight
  • stable_sort
  • strip_root
  • titleize
  • unaccent_compare
  • unaccent_compare_ci
  • underscore
  • upcase
  1 <?php
  2 
  3 /*
  4  * This file is part of the ICanBoogie package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace ICanBoogie;
 13 
 14 /**
 15  * Representation of a time zone location.
 16  *
 17  * <pre>
 18  * <?php
 19  *
 20  * use ICanBoogie\TimeZoneLocation;
 21  *
 22  * $zone = new \DateTimeZone('Europe/Paris');
 23  * $location = new TimeZoneLocation($zone->getLocation());
 24  *
 25  * echo $location;               // FR,48.86667,2.33333
 26  * echo $location->country_code; // FR
 27  * echo $location->latitude;     // 48.86667
 28  * echo $location->longitude;    // 2.33333
 29  *
 30  * $location->latitude = true;   // throws ICanBoogie\PropertyNotWritable
 31  * </pre>
 32  *
 33  * @property-read string $country_code The country code of the location.
 34  * @property-read float $latitude The latitude of the location.
 35  * @property-read float $longitude The longitude of the location.
 36  * @property-read string $comments Comments on the location.
 37  */
 38 class TimeZoneLocation
 39 {
 40     static private $cache;
 41 
 42     /**
 43      * Creates an instance from a {@link \DateTimeZone} instance.
 44      *
 45      * @param \DateTimeZone $zone
 46      *
 47      * @return \ICanBoogie\TimeZoneLocation
 48      */
 49     static public function from(\DateTimeZone $zone)
 50     {
 51         $hash = spl_object_hash($zone);
 52 
 53         if (empty(self::$cache[$hash]))
 54         {
 55             self::$cache[$hash] = new static($zone->getLocation());
 56         }
 57 
 58         return self::$cache[$hash];
 59     }
 60 
 61     private $location;
 62 
 63     /**
 64      * Initializes the {@link $location} property.
 65      *
 66      * @param array $location Location information provided by {@link \DateTimeZone::getLocation()}.
 67      */
 68     public function __construct(array $location)
 69     {
 70         $this->location = $location;
 71     }
 72 
 73     /**
 74      * Returns the {@link $country_code}, {@link $latitude}, {@link $longitude} and
 75      * {@link $comments} properties.
 76      *
 77      * @param string $property
 78      *
 79      * @throws PropertyNotDefined in attempt to get an unsupported property.
 80      */
 81     public function __get($property)
 82     {
 83         if (isset($this->location[$property]))
 84         {
 85             return $this->location[$property];
 86         }
 87 
 88         if (class_exists('ICanBoogie\PropertyNotDefined'))
 89         {
 90             throw new PropertyNotDefined(array($property, $this));
 91         }
 92         else
 93         {
 94             throw new \RuntimeException("Property is not defined: $property.");
 95         }
 96     }
 97 
 98     /**
 99      * @throws PropertyNotWritable in attempt to set an unsupported property.
100      */
101     public function __set($property, $value)
102     {
103         if (class_exists('ICanBoogie\PropertyNotWritable'))
104         {
105             throw new PropertyNotWritable(array($property, $this));
106         }
107         else
108         {
109             throw new \RuntimeException("Property is not writable: $property.");
110         }
111     }
112 
113     /**
114      * Returns the instance formatted as "{$country_code},{$latitude},{$longitude}".
115      *
116      * @return string
117      */
118     public function __toString()
119     {
120         return "{$this->country_code},{$this->latitude},{$this->longitude}";
121     }
122 }
Autodoc API documentation generated by ApiGen 2.8.0