{@inheritDoc}
@see \n2n\impl\web\ui\view\html\Library::apply()
197938
public function apply(HtmlView $view, HtmlBuilderMeta $htmlMeta) {
		if ($this->loadBootstrapCss) {
			$htmlMeta->addCss('dist/css/bootstrap.min.css', null, 'n2nutil\bootstrap');
		}
		
		if ($this->loadJs) {
			$htmlMeta->addLibrary(new JQueryLibrary(3, $this->bodyEnd));
			if ($this->bodyEnd) {
				$htmlMeta = $htmlMeta->bodyEnd();
			}
			$htmlMeta->addJs('dist/js/bootstrap.min.js', 'n2nutil\bootstrap');
		}
	}
1244536
public function apply($method, array $args = [])
    {
        $result = new Map;
        $this->walk(function ($object, $key) use ($method, $args, $result) {
            $result[$key] = call_user_func_array([$object, $method], $args);
        });
        return $result;
    }
1033512
public function apply()
    {
        if ($this->canApply()) {
            $before = self::cloneNodeWithNodeData($this->getSubject());
            $parent = $before->getParent();

            if ($this->nodeNameAvailableBelowNode($this->getSiblingNode()->getParent(), $this->getSubject())) {
                $this->getSubject()->moveAfter($this->getSiblingNode());
            } else {
                $nodeName = $this->generateUniqueNodeName($this->getSiblingNode()->getParent());
                $this->getSubject()->moveAfter($this->getSiblingNode(), $nodeName);
            }

            $updateParentNodeInfo = new UpdateNodeInfo();
            $updateParentNodeInfo->setNode($parent);

            $this->feedbackCollection->add($updateParentNodeInfo);

            $this->finish($before);
        }
    }
550259
public function apply()
    {
        Schema::create(Model::TABLE_NAME, function (Blueprint $table) {
            $table->increments(Model::FIELD_ID);
            $table->unsignedInteger(Model::FIELD_ID_BOARD);
            $table->unsignedInteger(Model::FIELD_ID_USER);
            $table->string(Model::FIELD_TITLE, Model::LENGTH_TITLE);
            $table->text(Model::FIELD_TEXT);
            $table->softDeletes();
            $table->timestamps();

            /** @noinspection PhpUndefinedMethodInspection */
            $table->foreign(Model::FIELD_ID_BOARD)
                ->references(Board::FIELD_ID)->on(Board::TABLE_NAME)->onDelete('cascade');

            /** @noinspection PhpUndefinedMethodInspection */
            $table->foreign(Model::FIELD_ID_USER)
                ->references(User::FIELD_ID)->on(User::TABLE_NAME)->onDelete('cascade');
        });
    }
944128
public function apply(Collection $collection)
    {
        $this->collection = $collection;

        foreach ($this->filters() as $name => $value) {
            if (! method_exists($this, $name)) {
                continue;
            }

            if (is_array($value) or trim($value)) {
                $this->collection = $this->$name($value);
            } else {
                $this->collection = $this->$name();
            }
        }

        return $this->collection;
    }
525486
public function applyTo($object)
	{
		foreach($this->toArray() as $key=>$value)
			$object->$key=$value;
	}
183307
public function applyScopes()
	{
		if ( !$this->scopes )
		{
			return $this;
		}

		$builder = clone $this;

		foreach ( $this->scopes as $scope )
		{
			$builder->callScope( function ( Builder $builder ) use ( $scope )
			{
				if ( $scope instanceof Closure )
				{
					$scope( $builder );
				}
				elseif ( $scope instanceof Scope )
				{
					$scope->apply( $builder, $this->getModel() );
				}
			} );
		}

		return $builder;
	}
659151
@Override
    public Object apply(Object value, Object... params) {

        return super.asString(value).toLowerCase();
    }
203269
public function apply(callable $fn)
    {
        foreach ($this->items as &$item) {
            $out = call_user_func($fn, $item);
            if (isset($out) && ($out instanceof NodeInterface)) {
                $item = $out;
            }
        }

        return $this;
    }
319206
public function apply()
    {
        if ($this->canApply()) {
            $subject = $this->getSubject();
            $parent = $subject->getParent();
            $node = $this->createNode($parent);

            $node->moveAfter($subject);
            $this->updateWorkspaceInfo();
        }
    }
789527
public function applySort()
    {
        parent::applySort();

        if ($this->getSortBy() && $this->itemCreate) {
            //Remove previous click handler to Add new Item button and attach new one using sort argument.
            $this->container->js(true, $this->itemCreate->js()->off('click.atk_CRUD'));
            $this->container->js(true,
                                 $this->itemCreate->js()->on('click.atk_CRUD',
                                 new jsFunction([
                                     new jsModal('Add new', $this->pageCreate, [$this->name.'_sort' => $this->getSortBy()]),
                                 ]))
            );
        }
    }
160932
public function apply( $image ) {

        $pixels = array();
        $finalPx = array();
        // Localize vars
        $width = $image->getWidth();
        $height = $image->getHeight();

        // Loop
        $pixelIterator = $image->getCore()->getPixelIterator();
        foreach ($pixelIterator as $y => $rows) { /* Loop through pixel rows */
            foreach ( $rows as $x => $px ) { /* Loop through the pixels in the row (columns) */

                // row 0
                if ($x > 0 and $y > 0) {
                    $matrix[0][0] = $this->getColor($px, $pixels, $x - 1, $y - 1);
                } else {
                    $matrix[0][0] = $this->getColor($px, $pixels, $x, $y);
                }

                if ($y > 0) {
                    $matrix[1][0] = $this->getColor($px, $pixels, $x, $y - 1);
                } else {
                    $matrix[1][0] = $this->getColor($px, $pixels, $x, $y);
                }

                if ($x + 1 < $width and $y > 0) {
                    $matrix[2][0] = $this->getColor($px, $pixels, $x + 1, $y - 1);
                } else {
                    $matrix[2][0] = $this->getColor($px, $pixels, $x, $y);
                }

                // row 1
                if ($x > 0) {
                    $matrix[0][1] = $this->getColor($px, $pixels, $x - 1, $y);
                } else {
                    $matrix[0][1] = $this->getColor($px, $pixels, $x, $y);
                }

                if ($x + 1 < $width) {
                    $matrix[2][1] = $this->getColor($px, $pixels, $x + 1, $y);
                } else {
                    $matrix[2][1] = $this->getColor($px, $pixels, $x, $y);
                }

                // row 1
                if ($x > 0 and $y + 1 < $height) {
                    $matrix[0][2] = $this->getColor($px, $pixels, $x - 1, $y + 1);
                } else {
                    $matrix[0][2] = $this->getColor($px, $pixels, $x, $y);
                }

                if ($y + 1 < $height) {
                    $matrix[1][2] = $this->getColor($px, $pixels, $x, $y + 1);
                } else {
                    $matrix[1][2] = $this->getColor($px, $pixels, $x, $y);
                }

                if ($x + 1 < $width and $y + 1 < $height) {
                    $matrix[2][2] = $this->getColor($px, $pixels, $x + 1, $y + 1);
                } else {
                    $matrix[2][2] = $this->getColor($px, $pixels, $x, $y);
                }

                $edge = $this->convolve($matrix);
                $edge = intval($edge / 2);
                if ($edge > 255) {
                    $edge = 255;
                }

                /**
                 * @var \ImagickPixel $px Current pixel.
                 */
                $finalPx[] = $edge; // R
                $finalPx[] = $edge; // G
                $finalPx[] = $edge; // B

            }
            $pixelIterator->syncIterator(); /* Sync the iterator, this is important to do on each iteration */
        }

        $new = new \Imagick();
        $new->newImage($width, $height, new \ImagickPixel('black'));
        /* Import the pixels into image.
        width * height * strlen("RGB") must match count($pixels) */
        $new->importImagePixels(0, 0, $width, $height, "RGB", \Imagick::PIXEL_CHAR, $finalPx);

        $type = $image->getType();
        $file = $image->getImageFile();

        return new Image( $new, $file, $width, $height, $type ); // Create new image with updated core

    }
799598
public function applyFilter() {
        foreach($this->getFormElements() as $name => $child) {
            $this->value->offsetSet($name, $child->getValue(TRUE));
        }
    }
577797
public function apply()
    {
        $this->backup = isset($_SERVER[$this->name]) ? $_SERVER[$this->name] : new NotSet();
        $_SERVER[$this->name] = $this->value;
    }
1271854
public function apply()
	{
		foreach ($this->patches as $patch)
		{
			// Separate the input into lines
			$lines = self::splitLines($patch['udiff']);

			// Loop for each header
			while (self::findHeader($lines, $src, $dst))
			{
				$done = false;

				if ($patch['strip'] === null)
				{
					$src = $patch['root'] . preg_replace('#^([^/]*/)*#', '', $src);
					$dst = $patch['root'] . preg_replace('#^([^/]*/)*#', '', $dst);
				}
				else
				{
					$src = $patch['root'] . preg_replace('#^([^/]*/){' . (int) $patch['strip'] . '}#', '', $src);
					$dst = $patch['root'] . preg_replace('#^([^/]*/){' . (int) $patch['strip'] . '}#', '', $dst);
				}

				// Loop for each hunk of differences
				while (self::findHunk($lines, $src_line, $src_size, $dst_line, $dst_size))
				{
					$done = true;

					// Apply the hunk of differences
					$this->applyHunk($lines, $src, $dst, $src_line, $src_size, $dst_line, $dst_size);
				}

				// If no modifications were found, throw an exception
				if (!$done)
				{
					throw new \RuntimeException('Invalid Diff');
				}
			}
		}

		// Initialize the counter
		$done = 0;

		// Patch each destination file
		foreach ($this->destinations as $file => $content)
		{
			$content = implode("\n", $content);

			if (File::write($file, $content))
			{
				if (isset($this->sources[$file]))
				{
					$this->sources[$file] = $content;
				}

				$done++;
			}
		}

		// Remove each removed file
		foreach ($this->removals as $file)
		{
			if (File::delete($file))
			{
				if (isset($this->sources[$file]))
				{
					unset($this->sources[$file]);
				}

				$done++;
			}
		}

		// Clear the destinations cache
		$this->destinations = array();

		// Clear the removals
		$this->removals = array();

		// Clear the patches
		$this->patches = array();

		return $done;
	}
104166
public function apply()
	{
		if (!$this->isActive()) return;
		
		foreach ($this->getInfo() as $f)
		{
			switch($f['filter_type']) 
			{
				case self::TYPE_NUMERIC:
				case self::TYPE_NUMERIC_SLIDER:
					if ($this->submittedValue($f['name'].'_min') !== null)
					{
						$this->iterator->where( $this->generateField($f['field']).' >= '.(float)$this->submittedValue($f['name'].'_min') );
					}
					if ($this->submittedValue($f['name'].'_max') !== null && $this->submittedValue($f['name'].'_max'))
					{
						$this->iterator->where( $this->generateField($f['field']).' <= '.(float)$this->submittedValue($f['name'].'_max') );
					}	
					break;
				case self::TYPE_RADIO:
				case self::TYPE_DROPDOWN:
					if ($this->submittedValue($f['name']) !== null) {
						$this->iterator->where( $this->generateField($f['field']).' = :'.$f['name'] )
									   ->setParameter($f['name'], $this->submittedValue($f['name']));
					}				
					break;
				case self::TYPE_CHECKBOX:
					if ($this->submittedValue($f['name']) !== null) {
						if (is_array($this->submittedValue($f['name']))) {
							$a = array();
							foreach ($this->submittedValue($f['name']) as $value => $dummy) {
								$a[] = '"'.$value.'"';
							}
							$this->iterator->where( $this->generateField($f['field']).' IN ('.implode(',',$a).')' );
						}
						else {
							if ($this->submittedValue($f['name'])) {
								$this->iterator->where( $this->generateField($f['field']).' > 0' );
							}
						}
					}
					break;
				case self::TYPE_DROPDOWN_MULTIPLE:
					if ($this->submittedValue($f['name']) !== null) {
						if (is_array($this->submittedValue($f['name']))) {
							$this->iterator->where( $this->generateField($f['field']).' IN ("'.implode('","',$this->submittedValue($f['name'])).'")' );
						}
					}
					break;                    
				case self::TYPE_DATE_INTERVAL:
					if ($f['value_min']) {
						$this->iterator->where( $this->generateField($f['field']).' >= STR_TO_DATE(:'.$f['name'].'_min,"%Y-%m-%d")' )
									   ->setParameter($f['name'].'_min', $f['value_min']);						
					}
					if ($f['value_max']) {
						$this->iterator->where( $this->generateField($f['field']).' <= DATE_ADD(STR_TO_DATE(:'.$f['name'].'_max,"%Y-%m-%d"), INTERVAL 1 DAY)' )
									   ->setParameter($f['name'].'_max', $f['value_max']);						
					}
					break;
				case self::TYPE_DATE:
					if ($f['value']) {
						$this->iterator->where( 'DATE_FORMAT('.$this->generateField($f['field']).',"%Y-%m-%d") = :'.$f['name'] )
									   ->setParameter($f['name'], $f['value']);						
					}				
					break;
				case self::TYPE_TEXT:
					if ($f['value']) {
						$this->iterator->where( $this->generateField($f['field']).' LIKE :'.$f['name'] )
									   ->setParameter($f['name'], '%'.$f['value'].'%');						
					}					
					break;
			}
		}
		$this->iterator->groupBy('main.id');
	}
209984
protected function applyScope()
    {
        if (isset($this->scopeQuery) && is_callable($this->scopeQuery)) {
            $callback = $this->scopeQuery;
            $this->model = $callback($this->model);
        }

        return $this;
    }