isEmpty() 공개 정적인 메소드

Example: ~~~ if (Enum::isEmpty([]) { echo 'Not empty'; } ~~~
public static isEmpty ( mixed $var ) : boolean
$var mixed variable to perform the check
리턴 boolean
예제 #1
0
 /**
  * Generates panel title for heading and footer.
  *
  * @param array $content the panel content settings.
  * @param string $type whether `heading` or `footer`
  *
  * @return string
  */
 protected static function getPanelTitle($content, $type)
 {
     $title = ArrayHelper::getValue($content, $type, '');
     if (!Enum::isEmpty($title)) {
         if (ArrayHelper::getValue($content, "{$type}Title", true) === true) {
             $title = static::tag("h3", $title, ["class" => "panel-title"]);
         }
         return static::tag("div", $title, ["class" => "panel-{$type}"]) . "\n";
     } else {
         return '';
     }
 }
예제 #2
0
파일: Html.php 프로젝트: gpis88ce/Gpis88ce
 /**
  * Generates a blockquote.
  *
  * @param string $content the blockquote content
  * @param string $citeContent the content of the citation (optional) - this should typically
  * include the wildtag '{source}' to embed the cite source
  * @param string $citeTitle the cite source title (optional)
  * @param string $citeSource the cite source (optional)
  * @param array $options html options for the blockquote
  *
  * Example(s):
  * ~~~
  * echo Html::blockquote(
  *      'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.',
  *      'Someone famous in {source}',
  *      'International Premier League',
  *      'IPL'
  * );
  * ~~~
  *
  * @param array $options html options for the blockquote
  * @see http://getbootstrap.com/css/#type-blockquotes
  */
 public static function blockquote($content, $citeContent = '', $citeTitle = '', $citeSource = '', $options = [])
 {
     $content = static::tag('p', $content);
     if (!Enum::isEmpty($citeContent)) {
         $source = static::tag('cite', $citeSource, ['title' => $citeTitle]);
         $content .= "\n<small>" . str_replace('{source}', $source, $citeContent) . "</small>";
     }
     return static::tag('blockquote', $content, $options);
 }
예제 #3
0
 /**
  * Generates a bootstrap address block.
  *
  * @see http://getbootstrap.com/css/#type-addresses
  *
  * @param string $name the addressee name
  * @param array  $lines the lines of address information
  * @param array  $phone the list of phone numbers - passed as $key => $value, where:
  *    - `$key`: string, is the phone type could be 'Res', 'Off', 'Cell', 'Fax'
  *    - `$value`: string, is the phone number
  * @param array  $email the list of email addresses - passed as $key => $value, where:
  *    - `$key`: string, is the email type could be 'Res', 'Off'
  *    - `$value`: string, is the email address
  * @param array  $options html options for the address
  * @param string $phoneLabel the prefix label for each phone - defaults to '(P)'
  * @param string $emailLabel the prefix label for each email - defaults to '(E)'
  *
  * Example(s):
  * ~~~
  * echo Html::address(
  *      'Twitter, Inc.',
  *      ['795 Folsom Ave, Suite 600', 'San Francisco, CA 94107'],
  *      ['Res' => '(123) 456-7890', 'Off'=> '(456) 789-0123'],
  *      ['Res' => '*****@*****.**', 'Off' => '*****@*****.**']
  * );
  * $address = Html::address(
  *      'Twitter, Inc.',
  *      ['795 Folsom Ave, Suite 600', 'San Francisco, CA 94107'],
  *      ['Res' => '(123) 456-7890', 'Off'=> '(456) 789-0123'],
  *      ['Res' => '*****@*****.**', 'Off' => '*****@*****.**'],
  *      Html::icon('phone'),
  *      Html::icon('envelope')
  * );
  * echo Html::well($address, Html::SIZE_TINY);
  * ~~~
  *
  * @return string
  */
 public static function address($name, $lines = [], $phone = [], $email = [], $options = [], $phoneLabel = '(P)', $emailLabel = '(E)')
 {
     Enum::initI18N();
     $addresses = '';
     if (!Enum::isEmpty($lines)) {
         $addresses = implode('<br>', $lines) . "<br>\n";
     }
     $phones = '';
     foreach ($phone as $type => $number) {
         if (is_numeric($type)) {
             // no keys were passed to the phone array
             $type = static::tag('abbr', $phoneLabel, ['title' => Yii::t('kvenum', 'Phone')]) . ': ';
         } else {
             $type = static::tag('abbr', $phoneLabel . ' ' . $type, ['title' => Yii::t('kvenum', 'Phone')]) . ': ';
         }
         $phones .= "{$type}{$number}<br>\n";
     }
     $emails = '';
     foreach ($email as $type => $addr) {
         if (is_numeric($type)) {
             // no keys were passed to the email array
             $type = Html::tag('abbr', $emailLabel, ['title' => Yii::t('kvenum', 'Email')]) . ': ';
         } else {
             $type = Html::tag('abbr', $emailLabel . ' ' . $type, ['title' => Yii::t('kvenum', 'Email')]) . ': ';
         }
         $emails .= $type . static::mailto($addr, $addr) . "<br>\n";
     }
     return static::tag('address', "<strong>{$name}</strong><br>\n" . $addresses . $phones . $emails, $options);
 }