Sets the icon for the attribute.

@param string $icon
@param string|null $icon2
@return $this
178665
public function icon($icon, $icon2 = null)
    {
        $this->icon = trim($icon);

        if (! str_empty($icon2)) {
            $this->icon2 = trim($icon2);
        }

        return $this;
    }
321041
public function setSize(string $size): Icon
    {
        // sizes which are allowed
        $sizes = [
            'lg',
            '2x',
            '3x',
            '4x'
        ];

        if (!in_array($size, $sizes)) {
            Throw new IconException('Wrong size set.');
        }

        $this->size = $size;

        return $this;
    }
901072
public function setIcon(string $iconPath)
    {
        return $this->setParameter('chrome_web_icon', $iconPath)
            ->setParameter('chrome_icon', $iconPath)
            ->setParameter('adm_small_icon', $iconPath)
            ->setParameter('small_icon', $iconPath);
    }
282731
public function icon($icon = null)
    {
        if ($icon === null) {
            return $this->_icon;
        }
        $this->_icon = $icon;

        return $this;
    }
921374
public static boolean setDockIcon(final Image icon) {
        try {
            final Class<?> clazz = Class.forName("com.apple.eawt.Application");
            final Method am = clazz.getMethod("getApplication");
            final Object app = am.invoke(null, new Object[0]);
            final Method si = clazz.getMethod("setDockIconImage", 
                                              new Class[] { Image.class });
            
            si.invoke(app, new Object[] { icon });

            return true;
        } catch (Exception e) {
            e.printStackTrace();
        } // end of catch

        return false;
    }
333453
public static function icon($identifier, $icon) {
		$result=new HtmlButton($identifier);
		$result->asIcon($icon);
		return $result;
	}
692812
def set_icon(self, bmp):
        """"""

        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(bmp)
        self.SetIcon(_icon)
922224
protected function addIcon($item, $icon)
    {
        $icon = array_merge(['tag' => (isset($icon['glyphicon'])) ? 'span' : 'i'], $icon);
        $addclass = '';
        if (isset($icon['inverted']) && $icon['inverted'] === true) {
            $addclass = ' icon-white';
        }
        $classicon = (isset($icon['glyphicon'])) ? ' class="'.$icon['glyphicon'] : ' class="far fa-'.$icon['icon'];
        $myicon = ' <'.$icon['tag'].$classicon.$addclass.'"></'.$icon['tag'].'>';
        if (!isset($icon['append']) || $icon['append'] === true) {
            $label = $item->getLabel().' '.$myicon;
        } else {
            $label = $myicon.' '.$item->getLabel();
        }
        $item->setLabel($label)
            ->setExtra('safe_label', true);

        return $item;
    }
684022
public function setIcon(string $icon = null): ButtonInterface
    {
        if ($this->isVisibility()) {
            $this->icon = $icon;
        }

        return $this;
    }
1042315
public function setLabel($label)
    {
        if (is_array($label) && $label['icon']) {
            $this->setIcon($label['icon']);
        } elseif (is_string($label)) {
            return $this->setText($label);
        }

        return $this;
    }
240265
public function setIconPosition($iconPosition)
    {
        switch ($iconPosition) {
            case self::ICON_PREPEND:
            case self::ICON_APPEND:
                $this->iconPosition = $iconPosition;
                break;
            default:
                throw new Exception\InvalidArgumentException('Invalid icon position given');
        }
        return $this;
    }
399642
public function addIconMetric(string $name, $icon){
        if(!array_key_exists($icon, self::ICON_NAMES)){
            throw new \InvalidArgumentException();
        }

        $this->addMetric(
            trim($name),
            self::TYPE_ICON,
            [
                "icon"  => $icon,
            ]
        );
    }
252991
private function setIcon()
    {
        if (!$this->slackConfig->getCustomUser()->hasIcon()) {
            return;
        }

        $iconType = 'icon_' . $this->slackConfig->getCustomUser()->getIcon()->getType();
        $this->payload[$iconType] = $this->slackConfig->getCustomUser()->getIcon();
    }
111000
public synchronized void setIcon(Object icon, int iIconType)
    {
        if (m_rgIcons == null)
            m_rgIcons = new ImageIcon[CalendarConstants.END_ICON - CalendarConstants.START_ICON + 1];
        m_rgIcons[iIconType - CalendarConstants.START_ICON] = icon;   // Always at location 0
    }
875525
public function on($icon, array $classes = array(), $style='fas')
    {
        if (is_string($icon) === false) {
            throw new \InvalidArgumentException(
                'Icon label must be a string.'
            );
        }
        if (is_string($style) === false) {
            throw new \InvalidArgumentException(
                'The style label must be a string.'
            );
        }
        if (!in_array($style, $this->STYLES)) {
            throw new \InvalidArgumentException(
                'Invalid style.'
            );
        }

        $iconClasses = $icon . ' fa-stack-1x';

        if (count($classes) > 0) {
            foreach ($classes as $class) {
                $iconClasses .= ' ' . $this->classMapper($class);
            }
        }

        $this->bottomIcon = sprintf(self::ICON_HTML, $style, $iconClasses);

        return $this;
    }
208947
public function setIcon($source, $type = self::ICON_ASSET) {
		$this->iconType   = (string) $type;
		$this->iconSource = (string) $source;
		
		return $this;
	}
890055
public function addToIcon($icon) {
		$this->addToProperty("class", $icon);
		return $this->addToMember($this->_icon, $icon);
	}