@author Vova Feldman (@svovaf)
@since  1.0.5

@param bool $background
486389
protected function _activate_license( $background = false ) {
            $this->_logger->entrance();

            $license_id = fs_request_get( 'license_id' );

            if ( is_object( $this->_site ) &&
                 FS_Plugin_License::is_valid_id( $license_id ) &&
                 $license_id == $this->_site->license_id
            ) {
                // License is already activated.
                return;
            }

            $premium_license = FS_Plugin_License::is_valid_id( $license_id ) ?
                $this->_get_license_by_id( $license_id ) :
                $this->_get_available_premium_license();

            if ( ! is_object( $premium_license ) ) {
                return;
            }

            if ( ! is_object( $this->_site ) ) {
                // Not yet opted-in.
                $user = $this->get_current_or_network_user();
                if ( ! is_object( $user ) ) {
                    $user = self::_get_user_by_id( $premium_license->user_id );
                }

                if ( is_object( $user ) ) {
                    $this->install_with_user( $user, $premium_license->secret_key, false, false, false );
                } else {
                    $this->opt_in(
                        false,
                        false,
                        false,
                        $premium_license->secret_key
                    );

                    return;
                }
            }


            /**
             * If the premium license is already associated with the install, just
             * update the license reference (activation is not required).
             *
             * @since 1.1.9
             */
            if ( $premium_license->id == $this->_site->license_id ) {
                // License is already activated.
                $this->_update_site_license( $premium_license );
                $this->_store_account();

                return;
            }

            if ( $this->_site->user_id != $premium_license->user_id ) {
                $api_request_params = array( 'license_key' => $premium_license->secret_key );
            } else {
                $api_request_params = array();
            }

            $api     = $this->get_api_site_scope();
            $license = $api->call( "/licenses/{$premium_license->id}.json", 'put', $api_request_params );

            if ( ! $this->is_api_result_entity( $license ) ) {
                if ( ! $background ) {
                    $this->_admin_notices->add( sprintf(
                        '%s %s',
                        $this->get_text_inline( 'It looks like the license could not be activated.', 'license-activation-failed-message' ),
                        ( is_object( $license ) && isset( $license->error ) ?
                            $license->error->message :
                            sprintf( '%s<br><code>%s</code>',
                                $this->get_text_inline( 'Error received from the server:', 'server-error-message' ),
                                var_export( $license, true )
                            )
                        )
                    ),
                        $this->get_text_x_inline( 'Hmm', 'something somebody says when they are thinking about what you have just said.', 'hmm' ) . '...',
                        'error'
                    );
                }

                return;
            }

            $premium_license = new FS_Plugin_License( $license );

            // Updated site plan.
            $site = $this->get_api_site_scope()->get( '/', true );
            if ( $this->is_api_result_entity( $site ) ) {
                $this->_site = new FS_Site( $site );
            }
            $this->_update_site_license( $premium_license );

            $this->_store_account();

            if ( ! $background ) {
                $this->_admin_notices->add_sticky(
                    $this->get_text_inline( 'Your license was successfully activated.', 'license-activated-message' ) .
                    $this->get_complete_upgrade_instructions(),
                    'license_activated',
                    $this->get_text_x_inline( 'Yee-haw', 'interjection expressing joy or exuberance', 'yee-haw' ) . '!'
                );
            }

            $this->_admin_notices->remove_sticky( array(
                'trial_promotion',
                'license_expired',
            ) );
        }
551626
public function setSuperUserAccess($bool = true)
    {
        $this->hasSuperUserAccess = (bool) $bool;

        if ($bool) {
            $this->makeSureLoginNameIsSet();
        } else {
            $this->resetSites();
        }
    }
1186485
public function setOverlay($overlay = FALSE) {
		if (!is_bool($overlay)) {
			return false;
		}

		$this->_overlay = $overlay;
		return true;
	}
1301949
public function rotate($rotation = 0, $background = 0)
	{
		if (empty($this->resource))
		{
			return false;
		}
		$resource = imagerotate($this->resource, $rotation, $background);
		imagedestroy($this->resource);
		$this->resource = $resource;
	}
947228
public static function si($foreground, $background, $options = [])
	{
		return static::stack($options)->icon($foreground)->on($background);
	}
662223
public function setContext(array $context)
    {
        $this->clearContext();
        foreach ($context as $key => $value) {
            $this->setContextValue($key, $value);
        }
    }
1133583
public function do_rotate($degrees, $background = 0xffffff, $alpha = 1.0)
    {
        return $this->_handler->do_rotate($degrees, $background, $alpha);
    }
1119805
public function setUseColor(?bool $useColor): void
    {
        if (null === $useColor) {
            $useColor = $this->featureDetector->isSupported('stdout.ansi');
        }

        if ($useColor) {
            $this->reset = "\033[0m";
            $this->bold = "\033[1m";
            $this->faint = "\033[2m";
            $this->passStart = "\033[32m";
            $this->failStart = "\033[31m";
            $this->pass = $this->passStart . self::PASS . $this->reset;
            $this->fail = $this->failStart . self::FAIL . $this->reset;

            $this->addStart = "\033[33m\033[2m{+\033[0m\033[33m";
            $this->addEnd = "\033[2m+}\033[0m";
            $this->removeStart = "\033[36m\033[2m[-\033[0m\033[36m";
            $this->removeEnd = "\033[2m-]\033[0m";
        } else {
            $this->reset = '';
            $this->bold = '';
            $this->faint = '';
            $this->passStart = '';
            $this->failStart = '';
            $this->pass = self::PASS;
            $this->fail = self::FAIL;

            $this->addStart = '{+';
            $this->addEnd = '+}';
            $this->removeStart = '[-';
            $this->removeEnd = '-]';
        }
    }
93384
public static function execInBackground(string $cmd): void
    {
        if (self::isWindows()) {
            \pclose(\popen('start /B ' . $cmd, 'r'));
        } else {
            \exec($cmd . ' > /dev/null &');
        }
    }
452791
public function execute($objectContext)
    {
        if (method_exists($objectContext, $this->method))
        {
            if (!empty($this->parameters))
            {
                $objectContext->{$this->method}($this->parameters);
            }
            else
            {
                $objectContext->{$this->method}($this->parameters);
            }
        }
    }
628088
private void setBackground(boolean filled) {
        if (filled) {
            final int background = styledAttributes
                    .getResourceId(R.styleable.PinLock_statusFilledBackground, R.drawable.dot_filled);
            setBackgroundResource(background);
        } else {
            final int background = styledAttributes
                    .getResourceId(R.styleable.PinLock_statusEmptyBackground, R.drawable.dot_empty);
            setBackgroundResource(background);
        }
    }
264585
public static function setIsDebug(bool $bool): void
    {
        if (self::isCliApp()) {
            self::$IS_DEBUG = $bool;
        } else {
            MSession::set(MCoreApplication::DEBUG, $bool);
        }
    }
206212
public function setBackgroundColor($backgroundColor)
    {
        if ( is_null($this->backColor) ) {
            $this->backColor = new Color;
        }

        $this->backColor->setFromArray($backgroundColor);

        return $this;
    }
937419
protected function handleJobRequest(
        string $clientAddress,
        string $jobName,
        string $payload = '',
        bool $backgroundJob = false
    ) : string {
        $jobId = $this->addJobToQueue($jobName, $payload);
        $this->jobTypes[$jobId] = ($backgroundJob === true) ? 'background' : 'normal';
        $this->jobAddresses[$jobId] = $clientAddress;
        $this->pushJobs();
        if ($backgroundJob === true) {
            $this->respondToClient($clientAddress, $jobId);
        }
        $this->totalJobRequests++;
        return $jobId;
    }
782970
def background=(background)
      if !background.is_a?(TrueClass) && !background.is_a?(FalseClass)
        fail(ArgumentError, "Background should be boolean")
      end

      manager.allowsBackgroundLocationUpdates = background
      @background = background
    end
1096180
public function backgroundCell($color, $cell=null, $row=null){
        $color = str_replace("#", "", $color);
        if(!is_null($cell)){
            $this->x = $this->getColumnName($cell);
            $this->y = $row;
        }

        $style = array('fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb' => "$color")
        )
        );
        $this->engine->getActiveSheet()->getStyle("{$this->x}{$this->y}")->applyFromArray($style);
    }
354008
protected function workInBackground(InputInterface $input): void
    {
        $worker_count = $input->getOption('workers');

        for ($i = 0; $i < $worker_count; ++$i) {
            $pid = pcntl_fork();

            if ($pid === -1) {
                die(sprintf("Could not fork worker %d\n", $i));
            }

            if (!$pid) {
                $pidfile = $input->getOption('pidfile');
                if ($pidfile && $i === 0) {
                    $this->writePidFile($pidfile);
                }

                $worker_factory = $this->worker_factory;

                /** @var array $queues */
                $queues = $input->getArgument('queues');

                /** @var \QueueJitsu\Worker\Worker $worker */
                $worker = $worker_factory($queues);

                $worker($input->getOption('interval'));
                break;
            }
        }
    }