From ff1500369c84a30dbbb6d695441fc4b8df53e935 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Fri, 23 Jun 2017 18:35:58 +0100 Subject: [PATCH] Add doc to parseAttribute --- src/ArrayHelper.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ArrayHelper.php b/src/ArrayHelper.php index b8dbaee..9c39bf0 100644 --- a/src/ArrayHelper.php +++ b/src/ArrayHelper.php @@ -43,6 +43,21 @@ class ArrayHelper extends \yii\helpers\ArrayHelper return $array; } + /** + * Gets the value form the model and returns a config of the arrtibute + * + * The function will return an ArrayObject with four attributes + * - format The format of the attribute. + * - value The formatted value of the attribute. + * - lable The lable of the attribute form the model + * - raw The value of the attribute with no formatting + * + * @param mixed $model The model of the attribute to parse + * @param string $attribute The you want to parse + * @param array $defalts Array of defalt values + * + * @return ArrayObject The parsed config + */ public static function parseAttribute( $model, $attribute, $defalts = [ 'format' => "text", 'value' => '( NOT SET )' ] ) { if ( !preg_match( '/^([^:]+)(:(\w*))?(:(.*))?$/', $attribute, $matches ) ) {