Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
501953f2
Commit
501953f2
authored
Aug 30, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring for dependency injection.
parent
607281f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
56 deletions
+16
-56
str.php
laravel/str.php
+15
-5
url.php
laravel/url.php
+1
-51
No files found.
laravel/str.php
View file @
501953f2
...
@@ -10,7 +10,7 @@ class Str {
...
@@ -10,7 +10,7 @@ class Str {
*/
*/
public
static
function
lower
(
$value
)
public
static
function
lower
(
$value
)
{
{
return
function_exists
(
'mb_strtolower'
)
?
mb_strtolower
(
$value
,
Config
::
get
(
'application.encoding'
))
:
strtolower
(
$value
);
return
function_exists
(
'mb_strtolower'
)
?
mb_strtolower
(
$value
,
static
::
encoding
(
))
:
strtolower
(
$value
);
}
}
/**
/**
...
@@ -21,7 +21,7 @@ class Str {
...
@@ -21,7 +21,7 @@ class Str {
*/
*/
public
static
function
upper
(
$value
)
public
static
function
upper
(
$value
)
{
{
return
function_exists
(
'mb_strtoupper'
)
?
mb_strtoupper
(
$value
,
Config
::
get
(
'application.encoding'
))
:
strtoupper
(
$value
);
return
function_exists
(
'mb_strtoupper'
)
?
mb_strtoupper
(
$value
,
static
::
encoding
(
))
:
strtoupper
(
$value
);
}
}
/**
/**
...
@@ -32,7 +32,7 @@ class Str {
...
@@ -32,7 +32,7 @@ class Str {
*/
*/
public
static
function
title
(
$value
)
public
static
function
title
(
$value
)
{
{
return
(
function_exists
(
'mb_convert_case'
))
?
mb_convert_case
(
$value
,
MB_CASE_TITLE
,
Config
::
get
(
'application.encoding'
))
:
ucwords
(
strtolower
(
$value
));
return
(
function_exists
(
'mb_convert_case'
))
?
mb_convert_case
(
$value
,
MB_CASE_TITLE
,
static
::
encoding
(
))
:
ucwords
(
strtolower
(
$value
));
}
}
/**
/**
...
@@ -43,7 +43,7 @@ class Str {
...
@@ -43,7 +43,7 @@ class Str {
*/
*/
public
static
function
length
(
$value
)
public
static
function
length
(
$value
)
{
{
return
function_exists
(
'mb_strlen'
)
?
mb_strlen
(
$value
,
Config
::
get
(
'application.encoding'
))
:
strlen
(
$value
);
return
function_exists
(
'mb_strlen'
)
?
mb_strlen
(
$value
,
static
::
encoding
(
))
:
strlen
(
$value
);
}
}
/**
/**
...
@@ -54,7 +54,7 @@ class Str {
...
@@ -54,7 +54,7 @@ class Str {
*/
*/
public
static
function
ascii
(
$value
)
public
static
function
ascii
(
$value
)
{
{
$foreign
=
Config
::
get
(
'ascii'
);
$foreign
=
IoC
::
container
()
->
resolve
(
'laravel.config'
)
->
get
(
'ascii'
);
$value
=
preg_replace
(
array_keys
(
$foreign
),
array_values
(
$foreign
),
$value
);
$value
=
preg_replace
(
array_keys
(
$foreign
),
array_values
(
$foreign
),
$value
);
...
@@ -102,4 +102,14 @@ class Str {
...
@@ -102,4 +102,14 @@ class Str {
}
}
}
}
/**
* Get the application encoding from the configuration class.
*
* @return string
*/
private
static
function
encoding
()
{
return
IoC
::
container
()
->
resolve
(
'laravel.config'
)
->
get
(
'application.encoding'
);
}
}
}
\ No newline at end of file
laravel/url.php
View file @
501953f2
...
@@ -24,11 +24,6 @@ class URL {
...
@@ -24,11 +24,6 @@ class URL {
*
*
* If the given URL is already well-formed, it will be returned unchanged.
* If the given URL is already well-formed, it will be returned unchanged.
*
*
* <code>
* // Generate the URL: http://example.com/index.php/user/profile
* $url = URL::to('user/profile');
* </code>
*
* @param string $url
* @param string $url
* @param bool $https
* @param bool $https
* @return string
* @return string
...
@@ -47,11 +42,6 @@ class URL {
...
@@ -47,11 +42,6 @@ class URL {
/**
/**
* Generate an application URL with HTTPS.
* Generate an application URL with HTTPS.
*
*
* <code>
* // Generate the URL: https://example.com/index.php/user/profile
* $url = URL::to_secure('user/profile');
* </code>
*
* @param string $url
* @param string $url
* @return string
* @return string
*/
*/
...
@@ -66,14 +56,6 @@ class URL {
...
@@ -66,14 +56,6 @@ class URL {
* The index file will not be added to asset URLs. If the HTTPS option is not
* The index file will not be added to asset URLs. If the HTTPS option is not
* specified, HTTPS will be used when the active request is also using HTTPS.
* specified, HTTPS will be used when the active request is also using HTTPS.
*
*
* <code>
* // Generate the URL: http://example.com/img/picture.jpg
* $url = URL::to_asset('img/picture.jpg');
*
* // Generate the URL: https://example.com/img/picture.jpg
* $url = URL::to_asset('img/picture.jpg', true);
* </code>
*
* @param string $url
* @param string $url
* @param bool $https
* @param bool $https
* @return string
* @return string
...
@@ -93,14 +75,6 @@ class URL {
...
@@ -93,14 +75,6 @@ class URL {
*
*
* Optional parameters will be convereted to spaces if no parameter values are specified.
* Optional parameters will be convereted to spaces if no parameter values are specified.
*
*
* <code>
* // Generate a URL for the "profile" named route
* $url = URL::to_route('profile');
*
* // Generate a URL for the "profile" named route with parameters.
* $url = URL::to_route('profile', array('fred'));
* </code>
*
* @param string $name
* @param string $name
* @param array $parameters
* @param array $parameters
* @param bool $https
* @param bool $https
...
@@ -128,11 +102,6 @@ class URL {
...
@@ -128,11 +102,6 @@ class URL {
/**
/**
* Generate a HTTPS URL from a route name.
* Generate a HTTPS URL from a route name.
*
*
* <code>
* // Generate a HTTPS URL for the "profile" named route
* $url = URL::to_secure_route('profile');
* </code>
*
* @param string $name
* @param string $name
* @param array $parameters
* @param array $parameters
* @return string
* @return string
...
@@ -145,19 +114,11 @@ class URL {
...
@@ -145,19 +114,11 @@ class URL {
/**
/**
* Generate a URL friendly "slug".
* Generate a URL friendly "slug".
*
*
* <code>
* // Returns "my-first-post"
* $slug = URL::slug('My First Post!!');
*
* // Returns "my_first_post"
* $slug = URL::slug('My First Post!!', '_');
* </code>
*
* @param string $title
* @param string $title
* @param string $separator
* @param string $separator
* @return string
* @return string
*/
*/
public
static
function
slug
(
$title
,
$separator
=
'-'
)
public
function
slug
(
$title
,
$separator
=
'-'
)
{
{
$title
=
Str
::
ascii
(
$title
);
$title
=
Str
::
ascii
(
$title
);
...
@@ -172,17 +133,6 @@ class URL {
...
@@ -172,17 +133,6 @@ class URL {
/**
/**
* Magic Method for dynamically creating URLs to named routes.
* Magic Method for dynamically creating URLs to named routes.
*
* <code>
* // Generate a URL for the "profile" named route
* $url = URL::to_profile();
*
* // Generate a URL for the "profile" named route using HTTPS
* $url = URL::to_secure_profile();
*
* // Generate a URL for the "profile" named route with parameters.
* $url = URL::to_profile(array('fred'));
* </code>
*/
*/
public
function
__call
(
$method
,
$parameters
)
public
function
__call
(
$method
,
$parameters
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment