Sets the JSONP callback.

@param string $callback
@throws InvalidArgumentException If the padding is not a valid javascript identifier
@return KDispatcherResponseTransportJson
195492
public function setCallback($callback)
    {
        // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
        $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
        $parts = explode('.', $callback);

        foreach ($parts as $part)
        {
            if (!preg_match($pattern, $part)) {
                throw new InvalidArgumentException('The callback name is not valid.');
            }
        }

        $this->_padding = $callback;
    }
86190
public function mapSpread(callable $callback)
    {
        return $this->map(function ($chunk, $key) use ($callback) {
            $chunk[] = $key;

            return $callback(...$chunk);
        });
    }
149438
public function select ($callback)
	{
		if(!is_callable($callback)) {
			throw new \InvalidArgumentException('Invalid (not callable) callback given');
		}

		return $this->map(function ($v) use ($callback) {
			if ($callback($v)) {
				return $v;
			}
		});
	}
1370368
public function map($callback) : Vector
    {
        $values = $this->_map($callback);
        $this->setValues($values);
        return $this;
    }
258290
public function setCallbacks(array $callbacks)
    {
        @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "callbacks" key of the context instead.', __METHOD__), E_USER_DEPRECATED);

        foreach ($callbacks as $attribute => $callback) {
            if (!\is_callable($callback)) {
                throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
            }
        }
        $this->defaultContext[self::CALLBACKS] = $this->callbacks = $callbacks;

        return $this;
    }
1188185
public function setCallback($callback)
    {
        if (is_array($callback)) {
            require_once 'Zend/Server/Method/Callback.php';
            $callback = new Zend_Server_Method_Callback($callback);
        } elseif (!$callback instanceof Zend_Server_Method_Callback) {
            require_once 'Zend/Server/Exception.php';
            throw new Zend_Server_Exception('Invalid method callback provided');
        }
        $this->_callback = $callback;
        return $this;
    }
386263
public function each($callback)
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('Mapping function is not callable!');
        }

        array_walk($this->attributes, $callback);

        return $this;
    }
956006
public function map ($callback)
	{
		if(!is_callable($callback)) {
			throw new \InvalidArgumentException('Invalid (not callable) callback given');
		}

		$result = new self();

		for ($i = 0; $i < $this->count(); $i++) {
			$value = $callback($this->storage[$i]);

			if (null !== $value) {
				$result->push($value);
			}
		}

		return $result;
	}
1232675
public function setCleanupCallback($callback)
    {
        if (!is_null($callback)
            && !is_callable($callback)
        ) {
            throw new InvalidArgumentException("No callable function provided");
        }

        $this->cleanupCallback = $callback;

        return $this;
    }
427934
public function AssignCallback($Callback, $Options = NULL) {
      if (!is_callable($Callback)) return FALSE;
      
      $this->Callback = $Callback;
      $this->CallbackOptions = $Options;
   }
186826
public function setFilterFunction($callback)
    {
        if (!is_callable($callback, true)) {
            throw new InvalidArgumentException('TreeDropdownField->setFilterCallback(): not passed a valid callback');
        }

        $this->filterCallback = $callback;
        return $this;
    }
434695
public function each(callable $callback) : self {

      if (!is_callable($callback)) {
        throw new \InvalidArgumentException('Invalid callback function');
      }

      foreach ($this->getTokens() as $index => $item) {
        call_user_func($callback, $item, $index, $this);
      }

      $this->rewind();

      return $this;
    }
1214530
public function after($callback)
    {
        $callbacks = $this->getOption('_after_middlewares');
        $callbacks[] = $callback;
        $this->setOption('_after_middlewares', $callbacks);

        return $this;
    }
890885
public static function object(\Closure $callback) {
		$obj = new Object;
		$callback->__invoke($obj);
		return json_encode($obj);
	}
48133
public function setCallback($callback = null)
    {
        if (!is_null($callback) && !is_callable($callback)) {
            throw new Exception("callback must be of type callable or null");
        }

        $this->callback = $callback;

        return $this;
    }
618984
public function setCallback($callback){
		if(!is_callable($callback))
			throw new Exception('Invalid callback passed for logging: '.$callback);
		$this->callback = $callback;
		return $this;
	}
1270799
public function onReservationKeyReady(callable $callback = null)
    {
        if ($callback === null || is_callable($callback)) {
            $this->on_reservation_key_ready = $callback;
        } else {
            throw new InvalidArgumentException('Callable or NULL expected');
        }
    }