-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathContentstack.php
More file actions
executable file
·75 lines (67 loc) · 2.48 KB
/
Contentstack.php
File metadata and controls
executable file
·75 lines (67 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Contentstack abstract class to provide access to Stack Object
*
* PHP version 5
*
* @category PHP
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
*/
namespace Contentstack;
use Contentstack\Stack\Stack;
use Contentstack\Utils\Utils;
use Contentstack\Utils\Model\Option;
/**
* Contentstack abstract class to provide access to Stack Object
*
* @category PHP
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
*/
#[\AllowDynamicProperties]
abstract class Contentstack
{
/**
* Static method for the Stack constructor
*
* @param string $api_key : Contentstack Stack API KEY.
* @param string $access_token : Contentstack Stack ACCESS TOKEN.
* @param string $environment : Environment Name.
* @param array $config : Stack Configuration to provide region.
* @param ContentstackRegion $region : Region name of Contentstack. (default region 'us')
*
* @return Stack
* */
public static function Stack($api_key = '',
$access_token = '',
$environment = '',
$config = array('region'=> 'us', 'branch'=> '', 'live_preview' => array('enable' => false, 'host' => 'api.contentstack.io'))
) {
return new Stack($api_key, $access_token, $environment, $config);
}
public static function renderContent(string $content, Option $option): string
{
return Utils::renderContent($content, $option);
}
public static function renderContents(array $contents, Option $option): array
{
return Utils::renderContents($contents, $option);
}
public static function jsonToHtml(object $content, Option $option): string
{
return Utils::jsonToHtml($content, $option);
}
public static function jsonArrayToHtml(array $contents, Option $option): array
{
return Utils::jsonArrayToHtml($contents, $option);
}
}