public static function Create(
      Locale $fallbackLocale, bool $useUrlPath = true, array $acceptedRequestParams = [ 'locale', 'language', 'lang' ] )
      : Locale
   {

      if ( $useUrlPath && static::TryParseUrlPath( $refLocale ) )
      {
         return $refLocale;
      }

      if ( Locale::TryParseBrowserInfo( $refLocale ) )
      {
         return $refLocale;
      }

      if ( Locale::TryParseSystem( $refLocale ) )
      {
         return $refLocale;
      }

      if ( \count( $acceptedRequestParams ) > 0 )
      {

         if ( Locale::TryParseArray( $refLocale, $_POST, $acceptedRequestParams ) )
         {
            return $refLocale;
         }

         if ( Locale::TryParseArray( $refLocale, $_GET, $acceptedRequestParams ) )
         {
            return $refLocale;
         }

         /** @noinspection UnSafeIsSetOverArrayInspection */
         if ( isset( $_SESSION ) && Locale::TryParseArray( $refLocale, $_SESSION, $acceptedRequestParams ) )
         {
            return $refLocale;
         }

      }

      return $fallbackLocale;

   }
public static function Create(
      Locale $fallbackLocale, bool $useUrlPath = true, array $acceptedRequestParams = [ 'locale', 'language', 'lang' ] )
      : Locale
   {

      if ( $useUrlPath && static::TryParseUrlPath( $refLocale ) )
      {
         return $refLocale;
      }

      if ( Locale::TryParseBrowserInfo( $refLocale ) )
      {
         return $refLocale;
      }

      if ( Locale::TryParseSystem( $refLocale ) )
      {
         return $refLocale;
      }

      if ( \count( $acceptedRequestParams ) > 0 )
      {

         if ( Locale::TryParseArray( $refLocale, $_POST, $acceptedRequestParams ) )
         {
            return $refLocale;
         }

         if ( Locale::TryParseArray( $refLocale, $_GET, $acceptedRequestParams ) )
         {
            return $refLocale;
         }

         /** @noinspection UnSafeIsSetOverArrayInspection */
         if ( isset( $_SESSION ) && Locale::TryParseArray( $refLocale, $_SESSION, $acceptedRequestParams ) )
         {
            return $refLocale;
         }

      }

      return $fallbackLocale;

   }
public static function Create ( Locale $ fallbackLocale , bool $ useUrlPath = true , array $ acceptedRequestParams = [ 'locale' , 'language' , 'lang' ] ) : Locale { if ( $ useUrlPath && static :: TryParseUrlPath ( $ refLocale ) ) { return $ refLocale ; } if ( Locale :: TryParseBrowserInfo ( $ refLocale ) ) { return $ refLocale ; } if ( Locale :: TryParseSystem ( $ refLocale ) ) { return $ refLocale ; } if ( \ count ( $ acceptedRequestParams ) > 0 ) { if ( Locale :: TryParseArray ( $ refLocale , $ _POST , $ acceptedRequestParams ) ) { return $ refLocale ; } if ( Locale :: TryParseArray ( $ refLocale , $ _GET , $ acceptedRequestParams ) ) { return $ refLocale ; } /** @noinspection UnSafeIsSetOverArrayInspection */ if ( isset ( $ _SESSION ) && Locale :: TryParseArray ( $ refLocale , $ _SESSION , $ acceptedRequestParams ) ) { return $ refLocale ; } } return $ fallbackLocale ; }
Creates a locale with all available methods. If no method can create a Locale the defined fallback locale is used.

First a locale

@param  \Niirrty\Locale\Locale $fallbackLocale
@param  bool                   $useUrlPath
@param  array                  $acceptedRequestParams
@return \Niirrty\Locale\Locale
Creates a locale with all available methods . If no method can create a Locale the defined fallback locale is used .