baseUrl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/**
4
 * A simple function which
5
 * demonstrated working of
6
 * helpers which returns
7
 * simple string blade
8
 * file name
9
 * @return String  Name of the Blade File
10
 */
11
function sayHello()
12
{
13
	return "index";
14
}
15
16
/**
17
 * This function returns the Application URL
18
 * for the given folder location
19
 * @param  String $location Folder Location
20
 * @return String           Folder URL
21
 */
22
function baseUrl($location)
23
{
24
	$url = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
25
	$url .= $_SERVER['HTTP_HOST'];
26
	return $url.$location;
27
}
28
29
/**
30
 * This function is simply like an alias
31
 * to getenv function 
32
 * https://github.com/vlucas/phpdotenv
33
 * 
34
 * @param  String $veriable_name ENV Variable you want to select
35
 * @param  String $default_value Default value if the veriable not found
36
 * @return String 				 Value of variable from .env file
37
 */
38
function env($variable_name, $default_value)
39
{
40
	$return_value = getenv($variable_name);
41
	if ($return_value) {
42
		return $return_value;
43
	}
44
	return $default_value;
45
}