@@ -37,7 +37,7 @@ function osi_get_cache_key( $unique = '' ) {
3737function osi_get_cached_posts ( $ args ) {
3838
3939 if ( empty ( $ args ) || ! is_array ( $ args ) ) {
40- return array () ;
40+ return [] ;
4141 }
4242
4343 $ args ['suppress_filters ' ] = false ;
@@ -47,9 +47,9 @@ function osi_get_cached_posts( $args ) {
4747 $ cache_key = osi_get_cache_key ( $ args );
4848
4949 $ cache = new \Osi \Features \Inc \Cache ( $ cache_key );
50- $ result = $ cache ->expires_in ( $ expires_in )->updates_with ( 'get_posts ' , array ( $ args ) )->get ();
50+ $ result = $ cache ->expires_in ( $ expires_in )->updates_with ( 'get_posts ' , [ $ args ] )->get ();
5151
52- return ( ! empty ( $ result ) && is_array ( $ result ) ) ? $ result : array () ;
52+ return ( ! empty ( $ result ) && is_array ( $ result ) ) ? $ result : [] ;
5353}
5454
5555/**
@@ -60,7 +60,7 @@ function osi_get_cached_posts( $args ) {
6060 *
6161 * @return string Template markup.
6262 */
63- function osi_get_template_content ( $ slug , $ vars = array () ) {
63+ function osi_get_template_content ( $ slug , $ vars = [] ) {
6464
6565 ob_start ();
6666
@@ -69,18 +69,19 @@ function osi_get_template_content( $slug, $vars = array() ) {
6969 $ markup = ob_get_clean ();
7070
7171 return $ markup ;
72+
7273}
7374
7475/**
7576 * Get plugin template.
7677 *
77- * @param string $template Name or path of the template within /templates folder without php extension.
78- * @param array $variables pass an array of variables you want to use in template.
79- * @param boolean $echo Whether to echo out the template content or not.
78+ * @param string $template Name or path of the template within /templates folder without php extension.
79+ * @param array $variables pass an array of variables you want to use in template.
80+ * @param bool $echo Whether to echo out the template content or not.
8081 *
8182 * @return string|void Template markup.
8283 */
83- function osi_template ( $ template , $ variables = array () , $ echo = false ) {
84+ function osi_template ( $ template , $ variables = [] , $ echo = false ) {
8485
8586 $ template_file = sprintf ( '%1$s/templates/%2$s.php ' , OSI_PATH , $ template );
8687
@@ -103,27 +104,31 @@ function osi_template( $template, $variables = array(), $echo = false ) {
103104 }
104105
105106 echo $ markup ; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped already in template.
107+
106108}
107109
108110/**
109111 * Get data file content from '/data' directory.
110112 *
111- * @param string $slug file Data file name without '.php' extention.
112- * @param array $default Default value to return if file not found.
113+ * @param string $slug file Data file name without '.php' extention.
114+ * @param array $default Default value to return if file not found.
113115 *
114116 * @return mixed Data file content.
115117 */
116- function osi_get_data ( $ slug , $ default = array () ) {
118+ function osi_get_data ( $ slug , $ default = [] ) {
117119
118120 $ data_file = sprintf ( OSI_PATH . '/inc/data/%s.php ' , $ slug );
119121
120122 if ( file_exists ( $ data_file ) ) {
123+
121124 $ file_content = require $ data_file ; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
122125
123126 return $ file_content ;
127+
124128 }
125129
126130 return $ default ;
131+
127132}
128133
129134/**
@@ -134,7 +139,7 @@ function osi_get_data( $slug, $default = array() ) {
134139 * @see https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-function-in-wordpress-5-5/
135140 * @see https://lobby.vip.wordpress.com/2020/08/20/environment-type-support/
136141 *
137- * @return boolean Return true if it's production else return false.
142+ * @return bool Return true if it's production else return false.
138143 */
139144function osi_is_production () {
140145
@@ -143,16 +148,17 @@ function osi_is_production() {
143148 }
144149
145150 return false ;
151+
146152}
147153
148154/**
149155 * Determine if the current User Agent matches the passed $kind
150156 *
151- * @param string $kind Category of mobile device to check for.
152- * Either: any, dumb, smart.
153- * @param boolean $return_matched_agent Boolean indicating if the UA should be returned.
157+ * @param string $kind Category of mobile device to check for.
158+ * Either: any, dumb, smart.
159+ * @param bool $return_matched_agent Boolean indicating if the UA should be returned.
154160 *
155- * @return boolean |string Boolean indicating if current UA matches $kind. If
161+ * @return bool |string Boolean indicating if current UA matches $kind. If
156162 * $return_matched_agent is true, returns the UA string
157163 */
158164function osi_is_mobile ( $ kind = 'any ' , $ return_matched_agent = false ) {
0 commit comments