id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
226,300
phergie/phergie-irc-client-react
src/Client.php
Client.getErrorCallback
protected function getErrorCallback(ConnectionInterface $connection) { $logger = $this->getLogger(); return function($exception) use ($connection, $logger) { $this->emit('connect.error', array($exception, $connection, $logger)); }; }
php
protected function getErrorCallback(ConnectionInterface $connection) { $logger = $this->getLogger(); return function($exception) use ($connection, $logger) { $this->emit('connect.error', array($exception, $connection, $logger)); }; }
[ "protected", "function", "getErrorCallback", "(", "ConnectionInterface", "$", "connection", ")", "{", "$", "logger", "=", "$", "this", "->", "getLogger", "(", ")", ";", "return", "function", "(", "$", "exception", ")", "use", "(", "$", "connection", ",", "$", "logger", ")", "{", "$", "this", "->", "emit", "(", "'connect.error'", ",", "array", "(", "$", "exception", ",", "$", "connection", ",", "$", "logger", ")", ")", ";", "}", ";", "}" ]
Returns a callback for proxying connection error events to listeners of the client. @param \Phergie\Irc\ConnectionInterface $connection Connection on which the error occurred @return callable
[ "Returns", "a", "callback", "for", "proxying", "connection", "error", "events", "to", "listeners", "of", "the", "client", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L505-L511
226,301
phergie/phergie-irc-client-react
src/Client.php
Client.getEndCallback
protected function getEndCallback(ReadStream $read, WriteStream $write, ConnectionInterface $connection, TimerInterface $timer) { $logger = $this->getLogger(); return function() use ($read, $write, $connection, $timer, $logger) { $this->removeActiveConnection($connection); $this->emit('connect.end', array($connection, $logger)); $this->cancelTimer($timer); $connection->clearData(); $read->close(); $write->close(); }; }
php
protected function getEndCallback(ReadStream $read, WriteStream $write, ConnectionInterface $connection, TimerInterface $timer) { $logger = $this->getLogger(); return function() use ($read, $write, $connection, $timer, $logger) { $this->removeActiveConnection($connection); $this->emit('connect.end', array($connection, $logger)); $this->cancelTimer($timer); $connection->clearData(); $read->close(); $write->close(); }; }
[ "protected", "function", "getEndCallback", "(", "ReadStream", "$", "read", ",", "WriteStream", "$", "write", ",", "ConnectionInterface", "$", "connection", ",", "TimerInterface", "$", "timer", ")", "{", "$", "logger", "=", "$", "this", "->", "getLogger", "(", ")", ";", "return", "function", "(", ")", "use", "(", "$", "read", ",", "$", "write", ",", "$", "connection", ",", "$", "timer", ",", "$", "logger", ")", "{", "$", "this", "->", "removeActiveConnection", "(", "$", "connection", ")", ";", "$", "this", "->", "emit", "(", "'connect.end'", ",", "array", "(", "$", "connection", ",", "$", "logger", ")", ")", ";", "$", "this", "->", "cancelTimer", "(", "$", "timer", ")", ";", "$", "connection", "->", "clearData", "(", ")", ";", "$", "read", "->", "close", "(", ")", ";", "$", "write", "->", "close", "(", ")", ";", "}", ";", "}" ]
Returns a callback for when a connection is terminated, whether explicitly by the bot or server or as a result of loss of connectivity. @param \Phergie\Irc\Client\React\ReadStream $read Read stream for this connection @param \Phergie\Irc\Client\React\WriteStream $write Write stream for this connection @param \Phergie\Irc\ConnectionInterface $connection Terminated connection @param \React\EventLoop\Timer\TimerInterface $timer Timer used to handle asynchronously queued events on the connection, which must be cancelled @return callable
[ "Returns", "a", "callback", "for", "when", "a", "connection", "is", "terminated", "whether", "explicitly", "by", "the", "bot", "or", "server", "or", "as", "a", "result", "of", "loss", "of", "connectivity", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L527-L538
226,302
phergie/phergie-irc-client-react
src/Client.php
Client.getTickCallback
protected function getTickCallback(WriteStream $write, ConnectionInterface $connection) { $logger = $this->getLogger(); return function() use ($write, $connection, $logger) { $this->emit('irc.tick', array($write, $connection, $logger)); }; }
php
protected function getTickCallback(WriteStream $write, ConnectionInterface $connection) { $logger = $this->getLogger(); return function() use ($write, $connection, $logger) { $this->emit('irc.tick', array($write, $connection, $logger)); }; }
[ "protected", "function", "getTickCallback", "(", "WriteStream", "$", "write", ",", "ConnectionInterface", "$", "connection", ")", "{", "$", "logger", "=", "$", "this", "->", "getLogger", "(", ")", ";", "return", "function", "(", ")", "use", "(", "$", "write", ",", "$", "connection", ",", "$", "logger", ")", "{", "$", "this", "->", "emit", "(", "'irc.tick'", ",", "array", "(", "$", "write", ",", "$", "connection", ",", "$", "logger", ")", ")", ";", "}", ";", "}" ]
Returns a callback executed periodically to allow events to be sent asynchronously versus in response to received or sent events. @param \Phergie\Irc\Client\React\WriteStream $write Stream used to send events to the server @param \Phergie\Irc\ConnectionInterface $connection Connection to receive the event
[ "Returns", "a", "callback", "executed", "periodically", "to", "allow", "events", "to", "be", "sent", "asynchronously", "versus", "in", "response", "to", "received", "or", "sent", "events", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L549-L555
226,303
phergie/phergie-irc-client-react
src/Client.php
Client.configureStreams
protected function configureStreams(ConnectionInterface $connection, DuplexStreamInterface $stream, WriteStream $write) { $timer = $this->addPeriodicTimer($this->getTickInterval(), $this->getTickCallback($write, $connection)); $read = $this->getReadStream($connection); $write->pipe($stream)->pipe($read); $read->on('irc.received', $this->getReadCallback($write, $connection)); $write->on('data', $this->getWriteCallback($write, $connection)); $end = array($stream, 'end'); $read->on('end', $end); $write->on('end', $end); $stream->on('end', $this->getEndCallback($read, $write, $connection, $timer)); $error = $this->getErrorCallback($connection); $read->on('error', $error); $write->on('error', $error); }
php
protected function configureStreams(ConnectionInterface $connection, DuplexStreamInterface $stream, WriteStream $write) { $timer = $this->addPeriodicTimer($this->getTickInterval(), $this->getTickCallback($write, $connection)); $read = $this->getReadStream($connection); $write->pipe($stream)->pipe($read); $read->on('irc.received', $this->getReadCallback($write, $connection)); $write->on('data', $this->getWriteCallback($write, $connection)); $end = array($stream, 'end'); $read->on('end', $end); $write->on('end', $end); $stream->on('end', $this->getEndCallback($read, $write, $connection, $timer)); $error = $this->getErrorCallback($connection); $read->on('error', $error); $write->on('error', $error); }
[ "protected", "function", "configureStreams", "(", "ConnectionInterface", "$", "connection", ",", "DuplexStreamInterface", "$", "stream", ",", "WriteStream", "$", "write", ")", "{", "$", "timer", "=", "$", "this", "->", "addPeriodicTimer", "(", "$", "this", "->", "getTickInterval", "(", ")", ",", "$", "this", "->", "getTickCallback", "(", "$", "write", ",", "$", "connection", ")", ")", ";", "$", "read", "=", "$", "this", "->", "getReadStream", "(", "$", "connection", ")", ";", "$", "write", "->", "pipe", "(", "$", "stream", ")", "->", "pipe", "(", "$", "read", ")", ";", "$", "read", "->", "on", "(", "'irc.received'", ",", "$", "this", "->", "getReadCallback", "(", "$", "write", ",", "$", "connection", ")", ")", ";", "$", "write", "->", "on", "(", "'data'", ",", "$", "this", "->", "getWriteCallback", "(", "$", "write", ",", "$", "connection", ")", ")", ";", "$", "end", "=", "array", "(", "$", "stream", ",", "'end'", ")", ";", "$", "read", "->", "on", "(", "'end'", ",", "$", "end", ")", ";", "$", "write", "->", "on", "(", "'end'", ",", "$", "end", ")", ";", "$", "stream", "->", "on", "(", "'end'", ",", "$", "this", "->", "getEndCallback", "(", "$", "read", ",", "$", "write", ",", "$", "connection", ",", "$", "timer", ")", ")", ";", "$", "error", "=", "$", "this", "->", "getErrorCallback", "(", "$", "connection", ")", ";", "$", "read", "->", "on", "(", "'error'", ",", "$", "error", ")", ";", "$", "write", "->", "on", "(", "'error'", ",", "$", "error", ")", ";", "}" ]
Configure streams to handle messages received from and sent to the server. @param \Phergie\Irc\ConnectionInterface $connection Metadata for the connection over which messages are being exchanged @param \React\Stream\DuplexStreamInterface $stream Stream representing the connection to the server @param \Phergie\Irc\Client\React\WriteStream $write Stream used to send events to the server
[ "Configure", "streams", "to", "handle", "messages", "received", "from", "and", "sent", "to", "the", "server", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L568-L582
226,304
phergie/phergie-irc-client-react
src/Client.php
Client.identifyUser
protected function identifyUser(ConnectionInterface $connection, WriteStream $writeStream) { $password = $connection->getPassword(); if ($password) { $writeStream->ircPass($password); } $writeStream->ircUser( $connection->getUsername(), $connection->getHostname(), $connection->getServername(), $connection->getRealname() ); $writeStream->ircNick($connection->getNickname()); }
php
protected function identifyUser(ConnectionInterface $connection, WriteStream $writeStream) { $password = $connection->getPassword(); if ($password) { $writeStream->ircPass($password); } $writeStream->ircUser( $connection->getUsername(), $connection->getHostname(), $connection->getServername(), $connection->getRealname() ); $writeStream->ircNick($connection->getNickname()); }
[ "protected", "function", "identifyUser", "(", "ConnectionInterface", "$", "connection", ",", "WriteStream", "$", "writeStream", ")", "{", "$", "password", "=", "$", "connection", "->", "getPassword", "(", ")", ";", "if", "(", "$", "password", ")", "{", "$", "writeStream", "->", "ircPass", "(", "$", "password", ")", ";", "}", "$", "writeStream", "->", "ircUser", "(", "$", "connection", "->", "getUsername", "(", ")", ",", "$", "connection", "->", "getHostname", "(", ")", ",", "$", "connection", "->", "getServername", "(", ")", ",", "$", "connection", "->", "getRealname", "(", ")", ")", ";", "$", "writeStream", "->", "ircNick", "(", "$", "connection", "->", "getNickname", "(", ")", ")", ";", "}" ]
Identifies the user to a server. @param \Phergie\Irc\ConnectionInterface $connection Connection on which to identify the user @param \Phergie\Irc\Client\React\WriteStream $writeStream Stream to receive commands identifying the user
[ "Identifies", "the", "user", "to", "a", "server", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L592-L607
226,305
phergie/phergie-irc-client-react
src/Client.php
Client.emitConnectionError
protected function emitConnectionError(\Exception $exception, ConnectionInterface $connection) { $this->emit( 'connect.error', array( $exception->getMessage(), $connection, $this->getLogger() ) ); }
php
protected function emitConnectionError(\Exception $exception, ConnectionInterface $connection) { $this->emit( 'connect.error', array( $exception->getMessage(), $connection, $this->getLogger() ) ); }
[ "protected", "function", "emitConnectionError", "(", "\\", "Exception", "$", "exception", ",", "ConnectionInterface", "$", "connection", ")", "{", "$", "this", "->", "emit", "(", "'connect.error'", ",", "array", "(", "$", "exception", "->", "getMessage", "(", ")", ",", "$", "connection", ",", "$", "this", "->", "getLogger", "(", ")", ")", ")", ";", "}" ]
Emits a connection error event. @param \Exception $exception @param \Phergie\Irc\ConnectionInterface $connection
[ "Emits", "a", "connection", "error", "event", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L615-L625
226,306
phergie/phergie-irc-client-react
src/Client.php
Client.addUnsecuredConnection
protected function addUnsecuredConnection(ConnectionInterface $connection) { $this->getRemote($connection)->then( function($remote) use($connection) { $this->initializeConnection($remote, $connection); }, function($error) use($connection) { $this->emitConnectionError($error, $connection); } ); }
php
protected function addUnsecuredConnection(ConnectionInterface $connection) { $this->getRemote($connection)->then( function($remote) use($connection) { $this->initializeConnection($remote, $connection); }, function($error) use($connection) { $this->emitConnectionError($error, $connection); } ); }
[ "protected", "function", "addUnsecuredConnection", "(", "ConnectionInterface", "$", "connection", ")", "{", "$", "this", "->", "getRemote", "(", "$", "connection", ")", "->", "then", "(", "function", "(", "$", "remote", ")", "use", "(", "$", "connection", ")", "{", "$", "this", "->", "initializeConnection", "(", "$", "remote", ",", "$", "connection", ")", ";", "}", ",", "function", "(", "$", "error", ")", "use", "(", "$", "connection", ")", "{", "$", "this", "->", "emitConnectionError", "(", "$", "error", ",", "$", "connection", ")", ";", "}", ")", ";", "}" ]
Initializes an unsecured connection. @param \Phergie\Irc\ConnectionInterface $connection
[ "Initializes", "an", "unsecured", "connection", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L632-L642
226,307
phergie/phergie-irc-client-react
src/Client.php
Client.getSecureConnector
protected function getSecureConnector($connection) { if (!$this->secureConnector) { $loop = $this->getLoop(); $connector = new \React\Socket\Connector( $loop, [ 'dns' => $this->getResolver(), ] ); $this->secureConnector = new \React\Socket\SecureConnector($connector, $loop, $this->getSecureContext($connection)); } return $this->secureConnector; }
php
protected function getSecureConnector($connection) { if (!$this->secureConnector) { $loop = $this->getLoop(); $connector = new \React\Socket\Connector( $loop, [ 'dns' => $this->getResolver(), ] ); $this->secureConnector = new \React\Socket\SecureConnector($connector, $loop, $this->getSecureContext($connection)); } return $this->secureConnector; }
[ "protected", "function", "getSecureConnector", "(", "$", "connection", ")", "{", "if", "(", "!", "$", "this", "->", "secureConnector", ")", "{", "$", "loop", "=", "$", "this", "->", "getLoop", "(", ")", ";", "$", "connector", "=", "new", "\\", "React", "\\", "Socket", "\\", "Connector", "(", "$", "loop", ",", "[", "'dns'", "=>", "$", "this", "->", "getResolver", "(", ")", ",", "]", ")", ";", "$", "this", "->", "secureConnector", "=", "new", "\\", "React", "\\", "Socket", "\\", "SecureConnector", "(", "$", "connector", ",", "$", "loop", ",", "$", "this", "->", "getSecureContext", "(", "$", "connection", ")", ")", ";", "}", "return", "$", "this", "->", "secureConnector", ";", "}" ]
Returns a connector for establishing SSL connections. @return \React\Socket\SecureConnector
[ "Returns", "a", "connector", "for", "establishing", "SSL", "connections", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L649-L662
226,308
phergie/phergie-irc-client-react
src/Client.php
Client.addSecureConnection
protected function addSecureConnection(ConnectionInterface $connection) { $hostname = $connection->getServerHostname(); $port = $connection->getServerPort(); $this->getSecureConnector($connection) ->connect($hostname . ':' . $port) ->then( function(DuplexStreamInterface $stream) use ($connection) { $this->initializeStream($stream, $connection); $this->emit('connect.after.each', array($connection, $connection->getData('write'))); }, function($error) use($connection) { $this->emitConnectionError($error, $connection); } ); }
php
protected function addSecureConnection(ConnectionInterface $connection) { $hostname = $connection->getServerHostname(); $port = $connection->getServerPort(); $this->getSecureConnector($connection) ->connect($hostname . ':' . $port) ->then( function(DuplexStreamInterface $stream) use ($connection) { $this->initializeStream($stream, $connection); $this->emit('connect.after.each', array($connection, $connection->getData('write'))); }, function($error) use($connection) { $this->emitConnectionError($error, $connection); } ); }
[ "protected", "function", "addSecureConnection", "(", "ConnectionInterface", "$", "connection", ")", "{", "$", "hostname", "=", "$", "connection", "->", "getServerHostname", "(", ")", ";", "$", "port", "=", "$", "connection", "->", "getServerPort", "(", ")", ";", "$", "this", "->", "getSecureConnector", "(", "$", "connection", ")", "->", "connect", "(", "$", "hostname", ".", "':'", ".", "$", "port", ")", "->", "then", "(", "function", "(", "DuplexStreamInterface", "$", "stream", ")", "use", "(", "$", "connection", ")", "{", "$", "this", "->", "initializeStream", "(", "$", "stream", ",", "$", "connection", ")", ";", "$", "this", "->", "emit", "(", "'connect.after.each'", ",", "array", "(", "$", "connection", ",", "$", "connection", "->", "getData", "(", "'write'", ")", ")", ")", ";", "}", ",", "function", "(", "$", "error", ")", "use", "(", "$", "connection", ")", "{", "$", "this", "->", "emitConnectionError", "(", "$", "error", ",", "$", "connection", ")", ";", "}", ")", ";", "}" ]
Initializes a secured connection. @param \Phergie\Irc\ConnectionInterface $connection @throws \Phergie\Irc\Client\React\Exception if the SSL transport and forcing IPv4 usage are both enabled
[ "Initializes", "a", "secured", "connection", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L671-L687
226,309
phergie/phergie-irc-client-react
src/Client.php
Client.initializeStream
protected function initializeStream(DuplexStreamInterface $stream, ConnectionInterface $connection) { try { $connection->setData('stream', $stream); $write = $this->getWriteStream($connection); $connection->setData('write', $write); $this->configureStreams($connection, $stream, $write); $this->identifyUser($connection, $write); } catch (\Exception $e) { $this->emitConnectionError($e, $connection); } }
php
protected function initializeStream(DuplexStreamInterface $stream, ConnectionInterface $connection) { try { $connection->setData('stream', $stream); $write = $this->getWriteStream($connection); $connection->setData('write', $write); $this->configureStreams($connection, $stream, $write); $this->identifyUser($connection, $write); } catch (\Exception $e) { $this->emitConnectionError($e, $connection); } }
[ "protected", "function", "initializeStream", "(", "DuplexStreamInterface", "$", "stream", ",", "ConnectionInterface", "$", "connection", ")", "{", "try", "{", "$", "connection", "->", "setData", "(", "'stream'", ",", "$", "stream", ")", ";", "$", "write", "=", "$", "this", "->", "getWriteStream", "(", "$", "connection", ")", ";", "$", "connection", "->", "setData", "(", "'write'", ",", "$", "write", ")", ";", "$", "this", "->", "configureStreams", "(", "$", "connection", ",", "$", "stream", ",", "$", "write", ")", ";", "$", "this", "->", "identifyUser", "(", "$", "connection", ",", "$", "write", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "this", "->", "emitConnectionError", "(", "$", "e", ",", "$", "connection", ")", ";", "}", "}" ]
Configures an established stream for a given connection. @param \React\Stream\DuplexStreamInterface $stream @param \Phergie\Irc\ConnectionInterface $connection
[ "Configures", "an", "established", "stream", "for", "a", "given", "connection", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L695-L706
226,310
phergie/phergie-irc-client-react
src/Client.php
Client.initializeConnection
protected function initializeConnection($remote, $connection) { try { $context = $this->getContext($connection); $socket = $this->getSocket($remote, $context); $stream = $this->getStream($socket); $this->initializeStream($stream, $connection); $this->addActiveConnection($connection); } catch (\Exception $e) { $this->emitConnectionError($e, $connection); } $this->emit('connect.after.each', array($connection, $connection->getData('write'))); }
php
protected function initializeConnection($remote, $connection) { try { $context = $this->getContext($connection); $socket = $this->getSocket($remote, $context); $stream = $this->getStream($socket); $this->initializeStream($stream, $connection); $this->addActiveConnection($connection); } catch (\Exception $e) { $this->emitConnectionError($e, $connection); } $this->emit('connect.after.each', array($connection, $connection->getData('write'))); }
[ "protected", "function", "initializeConnection", "(", "$", "remote", ",", "$", "connection", ")", "{", "try", "{", "$", "context", "=", "$", "this", "->", "getContext", "(", "$", "connection", ")", ";", "$", "socket", "=", "$", "this", "->", "getSocket", "(", "$", "remote", ",", "$", "context", ")", ";", "$", "stream", "=", "$", "this", "->", "getStream", "(", "$", "socket", ")", ";", "$", "this", "->", "initializeStream", "(", "$", "stream", ",", "$", "connection", ")", ";", "$", "this", "->", "addActiveConnection", "(", "$", "connection", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "this", "->", "emitConnectionError", "(", "$", "e", ",", "$", "connection", ")", ";", "}", "$", "this", "->", "emit", "(", "'connect.after.each'", ",", "array", "(", "$", "connection", ",", "$", "connection", "->", "getData", "(", "'write'", ")", ")", ")", ";", "}" ]
Initializes an added connection. @param string $remote @param \Phergie\Irc\ConnectionInterface $connection
[ "Initializes", "an", "added", "connection", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L714-L727
226,311
phergie/phergie-irc-client-react
src/Client.php
Client.addConnection
public function addConnection(ConnectionInterface $connection) { $this->emit('connect.before.each', array($connection)); if ($this->getTransport($connection) === 'ssl') { $this->addSecureConnection($connection); } else { $this->addUnsecuredConnection($connection); } }
php
public function addConnection(ConnectionInterface $connection) { $this->emit('connect.before.each', array($connection)); if ($this->getTransport($connection) === 'ssl') { $this->addSecureConnection($connection); } else { $this->addUnsecuredConnection($connection); } }
[ "public", "function", "addConnection", "(", "ConnectionInterface", "$", "connection", ")", "{", "$", "this", "->", "emit", "(", "'connect.before.each'", ",", "array", "(", "$", "connection", ")", ")", ";", "if", "(", "$", "this", "->", "getTransport", "(", "$", "connection", ")", "===", "'ssl'", ")", "{", "$", "this", "->", "addSecureConnection", "(", "$", "connection", ")", ";", "}", "else", "{", "$", "this", "->", "addUnsecuredConnection", "(", "$", "connection", ")", ";", "}", "}" ]
Initializes an IRC connection. Emits connect.before.each and connect.after.each events before and after connection attempts are established, respectively. Emits a connect.error event if a connection attempt fails. @param \Phergie\Irc\ConnectionInterface $connection Metadata for connection to establish @throws \Phergie\Irc\Client\React\Exception if unable to establish the connection
[ "Initializes", "an", "IRC", "connection", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L740-L749
226,312
phergie/phergie-irc-client-react
src/Client.php
Client.run
public function run($connections, $autorun = true) { if (!is_array($connections)) { $connections = array($connections); } $this->on('connect.error', function($message, $connection, $logger) { $logger->error($message); }); $this->emit('connect.before.all', array($connections)); foreach ($connections as $connection) { $this->addConnection($connection); } $writes = array_map( function($connection) { return $connection->getData('write'); }, $connections ); $this->emit('connect.after.all', array($connections, $writes)); if ($autorun) { $this->getLoop()->run(); } }
php
public function run($connections, $autorun = true) { if (!is_array($connections)) { $connections = array($connections); } $this->on('connect.error', function($message, $connection, $logger) { $logger->error($message); }); $this->emit('connect.before.all', array($connections)); foreach ($connections as $connection) { $this->addConnection($connection); } $writes = array_map( function($connection) { return $connection->getData('write'); }, $connections ); $this->emit('connect.after.all', array($connections, $writes)); if ($autorun) { $this->getLoop()->run(); } }
[ "public", "function", "run", "(", "$", "connections", ",", "$", "autorun", "=", "true", ")", "{", "if", "(", "!", "is_array", "(", "$", "connections", ")", ")", "{", "$", "connections", "=", "array", "(", "$", "connections", ")", ";", "}", "$", "this", "->", "on", "(", "'connect.error'", ",", "function", "(", "$", "message", ",", "$", "connection", ",", "$", "logger", ")", "{", "$", "logger", "->", "error", "(", "$", "message", ")", ";", "}", ")", ";", "$", "this", "->", "emit", "(", "'connect.before.all'", ",", "array", "(", "$", "connections", ")", ")", ";", "foreach", "(", "$", "connections", "as", "$", "connection", ")", "{", "$", "this", "->", "addConnection", "(", "$", "connection", ")", ";", "}", "$", "writes", "=", "array_map", "(", "function", "(", "$", "connection", ")", "{", "return", "$", "connection", "->", "getData", "(", "'write'", ")", ";", "}", ",", "$", "connections", ")", ";", "$", "this", "->", "emit", "(", "'connect.after.all'", ",", "array", "(", "$", "connections", ",", "$", "writes", ")", ")", ";", "if", "(", "$", "autorun", ")", "{", "$", "this", "->", "getLoop", "(", ")", "->", "run", "(", ")", ";", "}", "}" ]
Executes the event loop, which continues running until no active connections remain. @param \Phergie\Irc\ConnectionInterface|\Phergie\Irc\ConnectionInterface[] $connections @param bool $autorun
[ "Executes", "the", "event", "loop", "which", "continues", "running", "until", "no", "active", "connections", "remain", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/Client.php#L758-L785
226,313
odannyc/laravel-alertify
src/Alertify/Log.php
Log.success
public function success(?string $message = null): Log { if (!is_null($message)) { $this->message = $message; } $this->type = 'success'; Alertify::flash(); return $this; }
php
public function success(?string $message = null): Log { if (!is_null($message)) { $this->message = $message; } $this->type = 'success'; Alertify::flash(); return $this; }
[ "public", "function", "success", "(", "?", "string", "$", "message", "=", "null", ")", ":", "Log", "{", "if", "(", "!", "is_null", "(", "$", "message", ")", ")", "{", "$", "this", "->", "message", "=", "$", "message", ";", "}", "$", "this", "->", "type", "=", "'success'", ";", "Alertify", "::", "flash", "(", ")", ";", "return", "$", "this", ";", "}" ]
Sets a success message. @param string $message The success message @return Log
[ "Sets", "a", "success", "message", "." ]
0210586d2c6c176084d2636e12c14516e88b3b5f
https://github.com/odannyc/laravel-alertify/blob/0210586d2c6c176084d2636e12c14516e88b3b5f/src/Alertify/Log.php#L71-L79
226,314
odannyc/laravel-alertify
src/Alertify/Log.php
Log.delay
public function delay(int $time): Log { $this->delay = $time; Alertify::flash(); return $this; }
php
public function delay(int $time): Log { $this->delay = $time; Alertify::flash(); return $this; }
[ "public", "function", "delay", "(", "int", "$", "time", ")", ":", "Log", "{", "$", "this", "->", "delay", "=", "$", "time", ";", "Alertify", "::", "flash", "(", ")", ";", "return", "$", "this", ";", "}" ]
Sets the delay of the alert. @param int $time The time delay in milliseconds @return Log
[ "Sets", "the", "delay", "of", "the", "alert", "." ]
0210586d2c6c176084d2636e12c14516e88b3b5f
https://github.com/odannyc/laravel-alertify/blob/0210586d2c6c176084d2636e12c14516e88b3b5f/src/Alertify/Log.php#L103-L108
226,315
odannyc/laravel-alertify
src/Alertify/Log.php
Log.position
public function position(string $position): Log { $acceptablePositions = [ 'top right', 'top left', 'bottom right', 'bottom left' ]; if (array_search(strtolower($position), $acceptablePositions) === false) { $acceptablePositions = implode(', ', $acceptablePositions); throw new \Exception("position can only be: ${acceptablePositions}"); } $this->position = $position; Alertify::flash(); return $this; }
php
public function position(string $position): Log { $acceptablePositions = [ 'top right', 'top left', 'bottom right', 'bottom left' ]; if (array_search(strtolower($position), $acceptablePositions) === false) { $acceptablePositions = implode(', ', $acceptablePositions); throw new \Exception("position can only be: ${acceptablePositions}"); } $this->position = $position; Alertify::flash(); return $this; }
[ "public", "function", "position", "(", "string", "$", "position", ")", ":", "Log", "{", "$", "acceptablePositions", "=", "[", "'top right'", ",", "'top left'", ",", "'bottom right'", ",", "'bottom left'", "]", ";", "if", "(", "array_search", "(", "strtolower", "(", "$", "position", ")", ",", "$", "acceptablePositions", ")", "===", "false", ")", "{", "$", "acceptablePositions", "=", "implode", "(", "', '", ",", "$", "acceptablePositions", ")", ";", "throw", "new", "\\", "Exception", "(", "\"position can only be: ${acceptablePositions}\"", ")", ";", "}", "$", "this", "->", "position", "=", "$", "position", ";", "Alertify", "::", "flash", "(", ")", ";", "return", "$", "this", ";", "}" ]
Sets the position of the alert. @param string $position The position of the alert @throws \Exception @return Log
[ "Sets", "the", "position", "of", "the", "alert", "." ]
0210586d2c6c176084d2636e12c14516e88b3b5f
https://github.com/odannyc/laravel-alertify/blob/0210586d2c6c176084d2636e12c14516e88b3b5f/src/Alertify/Log.php#L117-L134
226,316
gjerokrsteski/pimf-framework
core/Pimf/Util/Serializer.php
Serializer.serialize
public static function serialize($object) { $masked = false; if (false === is_object($object)) { $object = self::mask($object); $masked = true; } $capsule = new \stdClass(); $capsule->type = get_class($object); $capsule->object = $object; $capsule->fake = $masked; if ($object instanceof \SimpleXMLElement) { $capsule->object = $object->asXml(); } return '' . self::serializeNative($capsule); }
php
public static function serialize($object) { $masked = false; if (false === is_object($object)) { $object = self::mask($object); $masked = true; } $capsule = new \stdClass(); $capsule->type = get_class($object); $capsule->object = $object; $capsule->fake = $masked; if ($object instanceof \SimpleXMLElement) { $capsule->object = $object->asXml(); } return '' . self::serializeNative($capsule); }
[ "public", "static", "function", "serialize", "(", "$", "object", ")", "{", "$", "masked", "=", "false", ";", "if", "(", "false", "===", "is_object", "(", "$", "object", ")", ")", "{", "$", "object", "=", "self", "::", "mask", "(", "$", "object", ")", ";", "$", "masked", "=", "true", ";", "}", "$", "capsule", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "capsule", "->", "type", "=", "get_class", "(", "$", "object", ")", ";", "$", "capsule", "->", "object", "=", "$", "object", ";", "$", "capsule", "->", "fake", "=", "$", "masked", ";", "if", "(", "$", "object", "instanceof", "\\", "SimpleXMLElement", ")", "{", "$", "capsule", "->", "object", "=", "$", "object", "->", "asXml", "(", ")", ";", "}", "return", "''", ".", "self", "::", "serializeNative", "(", "$", "capsule", ")", ";", "}" ]
Serialize things. @param mixed $object Item you want - string, array, integer, object @return string Containing a byte-stream representation.
[ "Serialize", "things", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Serializer.php#L29-L48
226,317
gjerokrsteski/pimf-framework
core/Pimf/Util/Serializer.php
Serializer.unserialize
public static function unserialize($object) { $capsule = self::unserializeNative($object); if (true === $capsule->fake) { $capsule->object = self::unmask($capsule->object); } if ($capsule->type == 'SimpleXMLElement') { $capsule->object = simplexml_load_string($capsule->object); } return $capsule->object; }
php
public static function unserialize($object) { $capsule = self::unserializeNative($object); if (true === $capsule->fake) { $capsule->object = self::unmask($capsule->object); } if ($capsule->type == 'SimpleXMLElement') { $capsule->object = simplexml_load_string($capsule->object); } return $capsule->object; }
[ "public", "static", "function", "unserialize", "(", "$", "object", ")", "{", "$", "capsule", "=", "self", "::", "unserializeNative", "(", "$", "object", ")", ";", "if", "(", "true", "===", "$", "capsule", "->", "fake", ")", "{", "$", "capsule", "->", "object", "=", "self", "::", "unmask", "(", "$", "capsule", "->", "object", ")", ";", "}", "if", "(", "$", "capsule", "->", "type", "==", "'SimpleXMLElement'", ")", "{", "$", "capsule", "->", "object", "=", "simplexml_load_string", "(", "$", "capsule", "->", "object", ")", ";", "}", "return", "$", "capsule", "->", "object", ";", "}" ]
Unserialize things. @param string $object Serialized object. @return mixed
[ "Unserialize", "things", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Serializer.php#L57-L70
226,318
crip-laravel/filesys
src/App/File.php
File.init
public function init(ServiceBlob $blob) { parent::init($blob); $this->extension = $blob->metadata->getExtension(); $this->mime = $blob->getMime(); $this->mimeType = $blob->metadata->getMimeType(); $this->thumbs = $blob->getThumbsDetails(); }
php
public function init(ServiceBlob $blob) { parent::init($blob); $this->extension = $blob->metadata->getExtension(); $this->mime = $blob->getMime(); $this->mimeType = $blob->metadata->getMimeType(); $this->thumbs = $blob->getThumbsDetails(); }
[ "public", "function", "init", "(", "ServiceBlob", "$", "blob", ")", "{", "parent", "::", "init", "(", "$", "blob", ")", ";", "$", "this", "->", "extension", "=", "$", "blob", "->", "metadata", "->", "getExtension", "(", ")", ";", "$", "this", "->", "mime", "=", "$", "blob", "->", "getMime", "(", ")", ";", "$", "this", "->", "mimeType", "=", "$", "blob", "->", "metadata", "->", "getMimeType", "(", ")", ";", "$", "this", "->", "thumbs", "=", "$", "blob", "->", "getThumbsDetails", "(", ")", ";", "}" ]
Initialize File properties from service instance. @param ServiceBlob $blob
[ "Initialize", "File", "properties", "from", "service", "instance", "." ]
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/App/File.php#L35-L43
226,319
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Client.php
Client.Rest
public static function Rest($username, $password, $service) { if (is_string($service)) { return static::createRestClient($username, $password, $service); } elseif (is_array($service)) { $services = array(); foreach ($service as $serviceName) { $services[] = static::createRestClient($username, $password, $serviceName); } return $services; } throw new InvalidArgumentException('Client::Rest accepts either a service name, or an array of service names'); }
php
public static function Rest($username, $password, $service) { if (is_string($service)) { return static::createRestClient($username, $password, $service); } elseif (is_array($service)) { $services = array(); foreach ($service as $serviceName) { $services[] = static::createRestClient($username, $password, $serviceName); } return $services; } throw new InvalidArgumentException('Client::Rest accepts either a service name, or an array of service names'); }
[ "public", "static", "function", "Rest", "(", "$", "username", ",", "$", "password", ",", "$", "service", ")", "{", "if", "(", "is_string", "(", "$", "service", ")", ")", "{", "return", "static", "::", "createRestClient", "(", "$", "username", ",", "$", "password", ",", "$", "service", ")", ";", "}", "elseif", "(", "is_array", "(", "$", "service", ")", ")", "{", "$", "services", "=", "array", "(", ")", ";", "foreach", "(", "$", "service", "as", "$", "serviceName", ")", "{", "$", "services", "[", "]", "=", "static", "::", "createRestClient", "(", "$", "username", ",", "$", "password", ",", "$", "serviceName", ")", ";", "}", "return", "$", "services", ";", "}", "throw", "new", "InvalidArgumentException", "(", "'Client::Rest accepts either a service name, or an array of service names'", ")", ";", "}" ]
Create one or more REST service clients @static @param string $username API Login @param string $password API Password @param string|array $service Service name(s) @return CallFire\Api\Rest\Client|CallFire\Api\Rest\Client[] REST API client(s)
[ "Create", "one", "or", "more", "REST", "service", "clients" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Client.php#L20-L35
226,320
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Client.php
Client.createRestClient
protected static function createRestClient($username, $password, $service) { $serviceClass = RestClient::ns()."\\{$service}"; $client = new $serviceClass; $client->setUsername($username); $client->setPassword($password); return $client; }
php
protected static function createRestClient($username, $password, $service) { $serviceClass = RestClient::ns()."\\{$service}"; $client = new $serviceClass; $client->setUsername($username); $client->setPassword($password); return $client; }
[ "protected", "static", "function", "createRestClient", "(", "$", "username", ",", "$", "password", ",", "$", "service", ")", "{", "$", "serviceClass", "=", "RestClient", "::", "ns", "(", ")", ".", "\"\\\\{$service}\"", ";", "$", "client", "=", "new", "$", "serviceClass", ";", "$", "client", "->", "setUsername", "(", "$", "username", ")", ";", "$", "client", "->", "setPassword", "(", "$", "password", ")", ";", "return", "$", "client", ";", "}" ]
Instantiate a REST service client @static @param string $username API Login @param string $password API Password @param string $service Service name @return CallFire\Api\Rest\Client REST API client
[ "Instantiate", "a", "REST", "service", "client" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Client.php#L46-L55
226,321
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Client.php
Client.Soap
public static function Soap($username, $password, $service, $version = 'SOAP_1_2', $wsdl = 'http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl') { $options = array( 'soap_version' => $version, 'login' => $username, 'password' => $password ); $classmap = include __DIR__.'/Soap/classmap.php'; if (is_array($classmap)) { $options['classmap'] = $classmap; } if (is_string($service)) { return static::createSoapClient($username, $password, $service, $wsdl, $options); } elseif (is_array($service)) { $services = array(); foreach ($service as $serviceName) { $services[] = static::createSoapClient($username, $password, $serviceName, $wsdl, $options); } return $services; } throw new InvalidArgumentException('Client::Rest accepts either a service name, or an array of service names'); }
php
public static function Soap($username, $password, $service, $version = 'SOAP_1_2', $wsdl = 'http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl') { $options = array( 'soap_version' => $version, 'login' => $username, 'password' => $password ); $classmap = include __DIR__.'/Soap/classmap.php'; if (is_array($classmap)) { $options['classmap'] = $classmap; } if (is_string($service)) { return static::createSoapClient($username, $password, $service, $wsdl, $options); } elseif (is_array($service)) { $services = array(); foreach ($service as $serviceName) { $services[] = static::createSoapClient($username, $password, $serviceName, $wsdl, $options); } return $services; } throw new InvalidArgumentException('Client::Rest accepts either a service name, or an array of service names'); }
[ "public", "static", "function", "Soap", "(", "$", "username", ",", "$", "password", ",", "$", "service", ",", "$", "version", "=", "'SOAP_1_2'", ",", "$", "wsdl", "=", "'http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl'", ")", "{", "$", "options", "=", "array", "(", "'soap_version'", "=>", "$", "version", ",", "'login'", "=>", "$", "username", ",", "'password'", "=>", "$", "password", ")", ";", "$", "classmap", "=", "include", "__DIR__", ".", "'/Soap/classmap.php'", ";", "if", "(", "is_array", "(", "$", "classmap", ")", ")", "{", "$", "options", "[", "'classmap'", "]", "=", "$", "classmap", ";", "}", "if", "(", "is_string", "(", "$", "service", ")", ")", "{", "return", "static", "::", "createSoapClient", "(", "$", "username", ",", "$", "password", ",", "$", "service", ",", "$", "wsdl", ",", "$", "options", ")", ";", "}", "elseif", "(", "is_array", "(", "$", "service", ")", ")", "{", "$", "services", "=", "array", "(", ")", ";", "foreach", "(", "$", "service", "as", "$", "serviceName", ")", "{", "$", "services", "[", "]", "=", "static", "::", "createSoapClient", "(", "$", "username", ",", "$", "password", ",", "$", "serviceName", ",", "$", "wsdl", ",", "$", "options", ")", ";", "}", "return", "$", "services", ";", "}", "throw", "new", "InvalidArgumentException", "(", "'Client::Rest accepts either a service name, or an array of service names'", ")", ";", "}" ]
Create a SOAP client @static @param string $username API Login @param string $password API Password @param string $version = 'SOAP_1_2' SOAP version @param string $wsdl = 'http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl' SOAP WSDL @return CallFire\Api\Soap\Client SOAP API client
[ "Create", "a", "SOAP", "client" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Client.php#L67-L93
226,322
infomaniac-amf/php
lib/Util/ReferenceStore.php
ReferenceStore.getReference
public function getReference($data, $type) { $index = array_search($data, $this->store[$type], true); if ($index !== false) { return $index; } if (!$this->validate($data)) { return false; } $this->addReference($data, $type); return false; }
php
public function getReference($data, $type) { $index = array_search($data, $this->store[$type], true); if ($index !== false) { return $index; } if (!$this->validate($data)) { return false; } $this->addReference($data, $type); return false; }
[ "public", "function", "getReference", "(", "$", "data", ",", "$", "type", ")", "{", "$", "index", "=", "array_search", "(", "$", "data", ",", "$", "this", "->", "store", "[", "$", "type", "]", ",", "true", ")", ";", "if", "(", "$", "index", "!==", "false", ")", "{", "return", "$", "index", ";", "}", "if", "(", "!", "$", "this", "->", "validate", "(", "$", "data", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "addReference", "(", "$", "data", ",", "$", "type", ")", ";", "return", "false", ";", "}" ]
Creates or retrieves an object reference from the store @param $data @param $type @return int
[ "Creates", "or", "retrieves", "an", "object", "reference", "from", "the", "store" ]
1b71c125352ec562f473cd51958a03f786aa7ac9
https://github.com/infomaniac-amf/php/blob/1b71c125352ec562f473cd51958a03f786aa7ac9/lib/Util/ReferenceStore.php#L29-L42
226,323
infomaniac-amf/php
lib/Util/ReferenceStore.php
ReferenceStore.getByReference
public function getByReference($reference, $type) { if (!isset($this->store[$type])) { return false; } $count = count($this->store[$type]); if ($reference >= $count) { throw new DeserializationException('Invalid ' . $type . ' reference: ' . $reference); } if (!$count) { return false; } return $this->store[$type][$reference]; }
php
public function getByReference($reference, $type) { if (!isset($this->store[$type])) { return false; } $count = count($this->store[$type]); if ($reference >= $count) { throw new DeserializationException('Invalid ' . $type . ' reference: ' . $reference); } if (!$count) { return false; } return $this->store[$type][$reference]; }
[ "public", "function", "getByReference", "(", "$", "reference", ",", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "store", "[", "$", "type", "]", ")", ")", "{", "return", "false", ";", "}", "$", "count", "=", "count", "(", "$", "this", "->", "store", "[", "$", "type", "]", ")", ";", "if", "(", "$", "reference", ">=", "$", "count", ")", "{", "throw", "new", "DeserializationException", "(", "'Invalid '", ".", "$", "type", ".", "' reference: '", ".", "$", "reference", ")", ";", "}", "if", "(", "!", "$", "count", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "store", "[", "$", "type", "]", "[", "$", "reference", "]", ";", "}" ]
Retrieves a value of a given type by reference @param $reference @param $type @return bool @throws \Infomaniac\Exception\DeserializationException
[ "Retrieves", "a", "value", "of", "a", "given", "type", "by", "reference" ]
1b71c125352ec562f473cd51958a03f786aa7ac9
https://github.com/infomaniac-amf/php/blob/1b71c125352ec562f473cd51958a03f786aa7ac9/lib/Util/ReferenceStore.php#L53-L70
226,324
infomaniac-amf/php
lib/Util/ReferenceStore.php
ReferenceStore.addReference
public function addReference(&$data, $type) { if (!$this->validate($data)) { return false; } $this->store[$type][] =& $data; return $data; }
php
public function addReference(&$data, $type) { if (!$this->validate($data)) { return false; } $this->store[$type][] =& $data; return $data; }
[ "public", "function", "addReference", "(", "&", "$", "data", ",", "$", "type", ")", "{", "if", "(", "!", "$", "this", "->", "validate", "(", "$", "data", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "store", "[", "$", "type", "]", "[", "]", "=", "&", "$", "data", ";", "return", "$", "data", ";", "}" ]
Adds a new reference by type @param $data @param $type @return bool
[ "Adds", "a", "new", "reference", "by", "type" ]
1b71c125352ec562f473cd51958a03f786aa7ac9
https://github.com/infomaniac-amf/php/blob/1b71c125352ec562f473cd51958a03f786aa7ac9/lib/Util/ReferenceStore.php#L80-L88
226,325
infomaniac-amf/php
lib/Util/ReferenceStore.php
ReferenceStore.validate
private function validate($data) { // null or zero-length values cannot be assigned references if (is_null($data) || (is_string($data) && !strlen($data))) { return false; } return true; }
php
private function validate($data) { // null or zero-length values cannot be assigned references if (is_null($data) || (is_string($data) && !strlen($data))) { return false; } return true; }
[ "private", "function", "validate", "(", "$", "data", ")", "{", "// null or zero-length values cannot be assigned references", "if", "(", "is_null", "(", "$", "data", ")", "||", "(", "is_string", "(", "$", "data", ")", "&&", "!", "strlen", "(", "$", "data", ")", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Validates a given value and type for issues and prepares array for possible reference addition @param $data @return bool
[ "Validates", "a", "given", "value", "and", "type", "for", "issues", "and", "prepares", "array", "for", "possible", "reference", "addition" ]
1b71c125352ec562f473cd51958a03f786aa7ac9
https://github.com/infomaniac-amf/php/blob/1b71c125352ec562f473cd51958a03f786aa7ac9/lib/Util/ReferenceStore.php#L98-L106
226,326
gjerokrsteski/pimf-framework
core/Pimf/Logger.php
Logger.format
private function format($message, $severity) { $msg = date("m-d-Y") . " " . date("G:i:s") . " " . self::$remoteIp; $IPLength = strlen(self::$remoteIp); $numWhitespaces = 15 - $IPLength; for ($i = 0; $i < $numWhitespaces; $i++) { $msg .= " "; } $msg .= " " . $severity . ": "; $lastSlashIndex = strrpos(self::$script, "/"); $fileName = self::$script; if ($lastSlashIndex !== false) { $fileName = substr(self::$script, $lastSlashIndex + 1); } $msg .= $fileName . "\t"; $msg .= ": " . $message . "\r\n"; return $msg; }
php
private function format($message, $severity) { $msg = date("m-d-Y") . " " . date("G:i:s") . " " . self::$remoteIp; $IPLength = strlen(self::$remoteIp); $numWhitespaces = 15 - $IPLength; for ($i = 0; $i < $numWhitespaces; $i++) { $msg .= " "; } $msg .= " " . $severity . ": "; $lastSlashIndex = strrpos(self::$script, "/"); $fileName = self::$script; if ($lastSlashIndex !== false) { $fileName = substr(self::$script, $lastSlashIndex + 1); } $msg .= $fileName . "\t"; $msg .= ": " . $message . "\r\n"; return $msg; }
[ "private", "function", "format", "(", "$", "message", ",", "$", "severity", ")", "{", "$", "msg", "=", "date", "(", "\"m-d-Y\"", ")", ".", "\" \"", ".", "date", "(", "\"G:i:s\"", ")", ".", "\" \"", ".", "self", "::", "$", "remoteIp", ";", "$", "IPLength", "=", "strlen", "(", "self", "::", "$", "remoteIp", ")", ";", "$", "numWhitespaces", "=", "15", "-", "$", "IPLength", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "numWhitespaces", ";", "$", "i", "++", ")", "{", "$", "msg", ".=", "\" \"", ";", "}", "$", "msg", ".=", "\" \"", ".", "$", "severity", ".", "\": \"", ";", "$", "lastSlashIndex", "=", "strrpos", "(", "self", "::", "$", "script", ",", "\"/\"", ")", ";", "$", "fileName", "=", "self", "::", "$", "script", ";", "if", "(", "$", "lastSlashIndex", "!==", "false", ")", "{", "$", "fileName", "=", "substr", "(", "self", "::", "$", "script", ",", "$", "lastSlashIndex", "+", "1", ")", ";", "}", "$", "msg", ".=", "$", "fileName", ".", "\"\\t\"", ";", "$", "msg", ".=", "\": \"", ".", "$", "message", ".", "\"\\r\\n\"", ";", "return", "$", "msg", ";", "}" ]
Formats the error message in representable manner. @param string $message @param string $severity @return string
[ "Formats", "the", "error", "message", "in", "representable", "manner", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Logger.php#L183-L207
226,327
gjerokrsteski/pimf-framework
core/Pimf/DataMapper/Base.php
Base.reflect
public function reflect($model, $value, $property = 'id') { $attribute = new \ReflectionProperty($model, $property); $attribute->setAccessible(true); $attribute->setValue($model, $value); return $model; }
php
public function reflect($model, $value, $property = 'id') { $attribute = new \ReflectionProperty($model, $property); $attribute->setAccessible(true); $attribute->setValue($model, $value); return $model; }
[ "public", "function", "reflect", "(", "$", "model", ",", "$", "value", ",", "$", "property", "=", "'id'", ")", "{", "$", "attribute", "=", "new", "\\", "ReflectionProperty", "(", "$", "model", ",", "$", "property", ")", ";", "$", "attribute", "->", "setAccessible", "(", "true", ")", ";", "$", "attribute", "->", "setValue", "(", "$", "model", ",", "$", "value", ")", ";", "return", "$", "model", ";", "}" ]
Makes a given model-property accessible. @param object $model @param int $value @param string $property @return mixed
[ "Makes", "a", "given", "model", "-", "property", "accessible", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/DataMapper/Base.php#L63-L70
226,328
Techworker/ssml
src/Traits/SayAsTrait.php
SayAsTrait.sayAs
public function sayAs(string $interpretAs, string $content, string $format = null): ContainerElement { /** @var ContainerElement $this */ return $this->addElement(SayAs::factory($interpretAs, $content, $format)); }
php
public function sayAs(string $interpretAs, string $content, string $format = null): ContainerElement { /** @var ContainerElement $this */ return $this->addElement(SayAs::factory($interpretAs, $content, $format)); }
[ "public", "function", "sayAs", "(", "string", "$", "interpretAs", ",", "string", "$", "content", ",", "string", "$", "format", "=", "null", ")", ":", "ContainerElement", "{", "/** @var ContainerElement $this */", "return", "$", "this", "->", "addElement", "(", "SayAs", "::", "factory", "(", "$", "interpretAs", ",", "$", "content", ",", "$", "format", ")", ")", ";", "}" ]
Adds a new say-as element. @param string $interpretAs @param string $content @param string|null $format @return ContainerElement
[ "Adds", "a", "new", "say", "-", "as", "element", "." ]
cafb979b777480baf7a01b5db2bf7c2cff837805
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Traits/SayAsTrait.php#L31-L35
226,329
lexik/ws-colissimo
src/WSColissimo/WSColiPosteLetterService/Request/ValueObject/Choice/RequestType.php
RequestType.getChoices
public static function getChoices() { $choices = array(); $reflect = new \ReflectionClass(__CLASS__); $constants = array_keys($reflect->getConstants()); foreach ($constants as $constant) { $choices[] = $reflect->getConstant($constant); } return $choices; }
php
public static function getChoices() { $choices = array(); $reflect = new \ReflectionClass(__CLASS__); $constants = array_keys($reflect->getConstants()); foreach ($constants as $constant) { $choices[] = $reflect->getConstant($constant); } return $choices; }
[ "public", "static", "function", "getChoices", "(", ")", "{", "$", "choices", "=", "array", "(", ")", ";", "$", "reflect", "=", "new", "\\", "ReflectionClass", "(", "__CLASS__", ")", ";", "$", "constants", "=", "array_keys", "(", "$", "reflect", "->", "getConstants", "(", ")", ")", ";", "foreach", "(", "$", "constants", "as", "$", "constant", ")", "{", "$", "choices", "[", "]", "=", "$", "reflect", "->", "getConstant", "(", "$", "constant", ")", ";", "}", "return", "$", "choices", ";", "}" ]
Return an array of the class constants @return array
[ "Return", "an", "array", "of", "the", "class", "constants" ]
df4ba30b05afed8e49d509c36592d4aa7797c259
https://github.com/lexik/ws-colissimo/blob/df4ba30b05afed8e49d509c36592d4aa7797c259/src/WSColissimo/WSColiPosteLetterService/Request/ValueObject/Choice/RequestType.php#L23-L35
226,330
Techworker/ssml
src/Element/Paragraph.php
Paragraph.toDOM
public function toDOM(\DOMDocument $doc): \DOMNode { $paragraph = $doc->createElement('p'); $this->customAttributesToDOM($paragraph); $this->containerToDOM($doc, $paragraph); return $paragraph; }
php
public function toDOM(\DOMDocument $doc): \DOMNode { $paragraph = $doc->createElement('p'); $this->customAttributesToDOM($paragraph); $this->containerToDOM($doc, $paragraph); return $paragraph; }
[ "public", "function", "toDOM", "(", "\\", "DOMDocument", "$", "doc", ")", ":", "\\", "DOMNode", "{", "$", "paragraph", "=", "$", "doc", "->", "createElement", "(", "'p'", ")", ";", "$", "this", "->", "customAttributesToDOM", "(", "$", "paragraph", ")", ";", "$", "this", "->", "containerToDOM", "(", "$", "doc", ",", "$", "paragraph", ")", ";", "return", "$", "paragraph", ";", "}" ]
Adds the element to the given document. @inheritdoc
[ "Adds", "the", "element", "to", "the", "given", "document", "." ]
cafb979b777480baf7a01b5db2bf7c2cff837805
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Element/Paragraph.php#L39-L47
226,331
gjerokrsteski/pimf-framework
core/Pimf/Redis.php
Redis.bulk
protected function bulk($head) { if ($head == '$-1') { return null; } list($read, $response, $size) = array(0, '', substr($head, 1)); if ($size > 0) { do { // Calculate and read the appropriate bytes off of the Redis response. $block = (($remaining = $size - $read) < 1024) ? $remaining : 1024; $response .= fread($this->connection, $block); $read += $block; } while ($read < $size); } // The response ends with a trailing CRLF. fread($this->connection, 2); return $response; }
php
protected function bulk($head) { if ($head == '$-1') { return null; } list($read, $response, $size) = array(0, '', substr($head, 1)); if ($size > 0) { do { // Calculate and read the appropriate bytes off of the Redis response. $block = (($remaining = $size - $read) < 1024) ? $remaining : 1024; $response .= fread($this->connection, $block); $read += $block; } while ($read < $size); } // The response ends with a trailing CRLF. fread($this->connection, 2); return $response; }
[ "protected", "function", "bulk", "(", "$", "head", ")", "{", "if", "(", "$", "head", "==", "'$-1'", ")", "{", "return", "null", ";", "}", "list", "(", "$", "read", ",", "$", "response", ",", "$", "size", ")", "=", "array", "(", "0", ",", "''", ",", "substr", "(", "$", "head", ",", "1", ")", ")", ";", "if", "(", "$", "size", ">", "0", ")", "{", "do", "{", "// Calculate and read the appropriate bytes off of the Redis response.", "$", "block", "=", "(", "(", "$", "remaining", "=", "$", "size", "-", "$", "read", ")", "<", "1024", ")", "?", "$", "remaining", ":", "1024", ";", "$", "response", ".=", "fread", "(", "$", "this", "->", "connection", ",", "$", "block", ")", ";", "$", "read", "+=", "$", "block", ";", "}", "while", "(", "$", "read", "<", "$", "size", ")", ";", "}", "// The response ends with a trailing CRLF.", "fread", "(", "$", "this", "->", "connection", ",", "2", ")", ";", "return", "$", "response", ";", "}" ]
Parse and handle a bulk response from the Redis database. @param string $head @return string
[ "Parse", "and", "handle", "a", "bulk", "response", "from", "the", "Redis", "database", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Redis.php#L225-L248
226,332
gjerokrsteski/pimf-framework
core/Pimf/Redis.php
Redis.multibulk
protected function multibulk($head) { if (($count = substr($head, 1)) == '-1') { return null; } $response = array(); // Iterate through each bulk response in the multi-bulk and parse it out. for ($i = 0; $i < $count; $i++) { $response[] = $this->parse(trim(fgets($this->connection, 512))); } return $response; }
php
protected function multibulk($head) { if (($count = substr($head, 1)) == '-1') { return null; } $response = array(); // Iterate through each bulk response in the multi-bulk and parse it out. for ($i = 0; $i < $count; $i++) { $response[] = $this->parse(trim(fgets($this->connection, 512))); } return $response; }
[ "protected", "function", "multibulk", "(", "$", "head", ")", "{", "if", "(", "(", "$", "count", "=", "substr", "(", "$", "head", ",", "1", ")", ")", "==", "'-1'", ")", "{", "return", "null", ";", "}", "$", "response", "=", "array", "(", ")", ";", "// Iterate through each bulk response in the multi-bulk and parse it out.", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i", "++", ")", "{", "$", "response", "[", "]", "=", "$", "this", "->", "parse", "(", "trim", "(", "fgets", "(", "$", "this", "->", "connection", ",", "512", ")", ")", ")", ";", "}", "return", "$", "response", ";", "}" ]
Parse and handle a multi-bulk reply from the Redis database. @param string $head @return array
[ "Parse", "and", "handle", "a", "multi", "-", "bulk", "reply", "from", "the", "Redis", "database", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Redis.php#L257-L271
226,333
tarsana/functional
src/Classes/Stream.php
Stream.operation
public static function operation($name, $signatures, $fn = null) { if (! is_array($signatures)) { $signatures = [$signatures]; } foreach ($signatures as $signature) { self::$operations[] = _stream_operation($name, $signature, $fn); } }
php
public static function operation($name, $signatures, $fn = null) { if (! is_array($signatures)) { $signatures = [$signatures]; } foreach ($signatures as $signature) { self::$operations[] = _stream_operation($name, $signature, $fn); } }
[ "public", "static", "function", "operation", "(", "$", "name", ",", "$", "signatures", ",", "$", "fn", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "signatures", ")", ")", "{", "$", "signatures", "=", "[", "$", "signatures", "]", ";", "}", "foreach", "(", "$", "signatures", "as", "$", "signature", ")", "{", "self", "::", "$", "operations", "[", "]", "=", "_stream_operation", "(", "$", "name", ",", "$", "signature", ",", "$", "fn", ")", ";", "}", "}" ]
Adds a new operation to the Stream class. @param string $name @param string $signature @param callable $fn @return void
[ "Adds", "a", "new", "operation", "to", "the", "Stream", "class", "." ]
77ab9cbe8e44865edb686c07cc0848d8a950ed19
https://github.com/tarsana/functional/blob/77ab9cbe8e44865edb686c07cc0848d8a950ed19/src/Classes/Stream.php#L54-L62
226,334
tarsana/functional
src/Classes/Stream.php
Stream.removeOperations
public static function removeOperations($name) { $names = func_get_args(); self::$operations = filter(function($operation) use($names) { return !in_array(get('name', $operation), $names); }, self::$operations); }
php
public static function removeOperations($name) { $names = func_get_args(); self::$operations = filter(function($operation) use($names) { return !in_array(get('name', $operation), $names); }, self::$operations); }
[ "public", "static", "function", "removeOperations", "(", "$", "name", ")", "{", "$", "names", "=", "func_get_args", "(", ")", ";", "self", "::", "$", "operations", "=", "filter", "(", "function", "(", "$", "operation", ")", "use", "(", "$", "names", ")", "{", "return", "!", "in_array", "(", "get", "(", "'name'", ",", "$", "operation", ")", ",", "$", "names", ")", ";", "}", ",", "self", "::", "$", "operations", ")", ";", "}" ]
Removes one or many operation from the Stream class. @param string $name @return void
[ "Removes", "one", "or", "many", "operation", "from", "the", "Stream", "class", "." ]
77ab9cbe8e44865edb686c07cc0848d8a950ed19
https://github.com/tarsana/functional/blob/77ab9cbe8e44865edb686c07cc0848d8a950ed19/src/Classes/Stream.php#L81-L87
226,335
phergie/phergie-irc-client-react
src/ReadStream.php
ReadStream.getParser
public function getParser() { if (!$this->parser) { $this->parser = new \Phergie\Irc\Parser(); } return $this->parser; }
php
public function getParser() { if (!$this->parser) { $this->parser = new \Phergie\Irc\Parser(); } return $this->parser; }
[ "public", "function", "getParser", "(", ")", "{", "if", "(", "!", "$", "this", "->", "parser", ")", "{", "$", "this", "->", "parser", "=", "new", "\\", "Phergie", "\\", "Irc", "\\", "Parser", "(", ")", ";", "}", "return", "$", "this", "->", "parser", ";", "}" ]
Returns the IRC message parser in use. @return \Phergie\Irc\ParserInterface
[ "Returns", "the", "IRC", "message", "parser", "in", "use", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/ReadStream.php#L60-L66
226,336
phergie/phergie-irc-client-react
src/ReadStream.php
ReadStream.write
public function write($data) { if ($this->closed) { return; } $all = $this->tail . $data; $messages = $this->getParser()->consumeAll($all); $this->tail = $all; foreach ($messages as $message) { if (isset($message['message'])) { $this->emit('data', array($message['message'])); $this->emit('irc.received', array($message)); } elseif (isset($message['invalid'])) { $this->emit('invalid', array($message['invalid'])); } } }
php
public function write($data) { if ($this->closed) { return; } $all = $this->tail . $data; $messages = $this->getParser()->consumeAll($all); $this->tail = $all; foreach ($messages as $message) { if (isset($message['message'])) { $this->emit('data', array($message['message'])); $this->emit('irc.received', array($message)); } elseif (isset($message['invalid'])) { $this->emit('invalid', array($message['invalid'])); } } }
[ "public", "function", "write", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "closed", ")", "{", "return", ";", "}", "$", "all", "=", "$", "this", "->", "tail", ".", "$", "data", ";", "$", "messages", "=", "$", "this", "->", "getParser", "(", ")", "->", "consumeAll", "(", "$", "all", ")", ";", "$", "this", "->", "tail", "=", "$", "all", ";", "foreach", "(", "$", "messages", "as", "$", "message", ")", "{", "if", "(", "isset", "(", "$", "message", "[", "'message'", "]", ")", ")", "{", "$", "this", "->", "emit", "(", "'data'", ",", "array", "(", "$", "message", "[", "'message'", "]", ")", ")", ";", "$", "this", "->", "emit", "(", "'irc.received'", ",", "array", "(", "$", "message", ")", ")", ";", "}", "elseif", "(", "isset", "(", "$", "message", "[", "'invalid'", "]", ")", ")", "{", "$", "this", "->", "emit", "(", "'invalid'", ",", "array", "(", "$", "message", "[", "'invalid'", "]", ")", ")", ";", "}", "}", "}" ]
Parses messages from data piped to this stream and emits them as events. @param string $data
[ "Parses", "messages", "from", "data", "piped", "to", "this", "stream", "and", "emits", "them", "as", "events", "." ]
b0d03f1e1ff34a2868f1f7d677786fdd1786b320
https://github.com/phergie/phergie-irc-client-react/blob/b0d03f1e1ff34a2868f1f7d677786fdd1786b320/src/ReadStream.php#L74-L92
226,337
gjerokrsteski/pimf-framework
core/Pimf/Cache/Storages/Dba.php
Dba.clean
public function clean() { $dba = $this->dba; $key = dba_firstkey($dba); while ($key !== false && $key !== null) { $this->retrieve($key); $key = dba_nextkey($dba); } return dba_optimize($dba); }
php
public function clean() { $dba = $this->dba; $key = dba_firstkey($dba); while ($key !== false && $key !== null) { $this->retrieve($key); $key = dba_nextkey($dba); } return dba_optimize($dba); }
[ "public", "function", "clean", "(", ")", "{", "$", "dba", "=", "$", "this", "->", "dba", ";", "$", "key", "=", "dba_firstkey", "(", "$", "dba", ")", ";", "while", "(", "$", "key", "!==", "false", "&&", "$", "key", "!==", "null", ")", "{", "$", "this", "->", "retrieve", "(", "$", "key", ")", ";", "$", "key", "=", "dba_nextkey", "(", "$", "dba", ")", ";", "}", "return", "dba_optimize", "(", "$", "dba", ")", ";", "}" ]
Cleans and optimizes the cache from all expired entries. @return bool
[ "Cleans", "and", "optimizes", "the", "cache", "from", "all", "expired", "entries", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cache/Storages/Dba.php#L198-L209
226,338
gjerokrsteski/pimf-framework
core/Pimf/Cache/Storages/Dba.php
Dba.flush
public function flush() { if (file_exists($this->file)) { // We close the dba file before deleting // and reopen on next use. $this->__destruct(); unlink($this->file); clearstatcache(); return true; } return false; }
php
public function flush() { if (file_exists($this->file)) { // We close the dba file before deleting // and reopen on next use. $this->__destruct(); unlink($this->file); clearstatcache(); return true; } return false; }
[ "public", "function", "flush", "(", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "file", ")", ")", "{", "// We close the dba file before deleting", "// and reopen on next use.", "$", "this", "->", "__destruct", "(", ")", ";", "unlink", "(", "$", "this", "->", "file", ")", ";", "clearstatcache", "(", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Flush the whole storage. @return bool
[ "Flush", "the", "whole", "storage", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cache/Storages/Dba.php#L216-L232
226,339
gjerokrsteski/pimf-framework
core/Pimf/Util/Header.php
Header.isModified
public static function isModified($mtime, $etag = '') { $modifiedSince = strtotime(preg_replace('/;.*$/', '', self::$IfModifiedSince)); return !($modifiedSince >= $mtime || self::$IfNoneMatch == $etag); }
php
public static function isModified($mtime, $etag = '') { $modifiedSince = strtotime(preg_replace('/;.*$/', '', self::$IfModifiedSince)); return !($modifiedSince >= $mtime || self::$IfNoneMatch == $etag); }
[ "public", "static", "function", "isModified", "(", "$", "mtime", ",", "$", "etag", "=", "''", ")", "{", "$", "modifiedSince", "=", "strtotime", "(", "preg_replace", "(", "'/;.*$/'", ",", "''", ",", "self", "::", "$", "IfModifiedSince", ")", ")", ";", "return", "!", "(", "$", "modifiedSince", ">=", "$", "mtime", "||", "self", "::", "$", "IfNoneMatch", "==", "$", "etag", ")", ";", "}" ]
Actual HTTP caching validation. @param int $mtime In seconds @param string $etag @return bool
[ "Actual", "HTTP", "caching", "validation", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Header.php#L150-L155
226,340
gjerokrsteski/pimf-framework
core/Pimf/Util/Header.php
Header.sendDownloadDialog
public static function sendDownloadDialog($fileOrString, $fileName, $exit = true) { $disposition = (false !== strpos(self::$userAgent, 'MSIE 5.5')) ? '' : 'attachment; '; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Disposition: " . $disposition . "filename=" . $fileName . ";"); if (is_file($fileOrString)) { readfile($fileOrString); } else { echo $fileOrString; } if ($exit) { exit(0); } }
php
public static function sendDownloadDialog($fileOrString, $fileName, $exit = true) { $disposition = (false !== strpos(self::$userAgent, 'MSIE 5.5')) ? '' : 'attachment; '; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Disposition: " . $disposition . "filename=" . $fileName . ";"); if (is_file($fileOrString)) { readfile($fileOrString); } else { echo $fileOrString; } if ($exit) { exit(0); } }
[ "public", "static", "function", "sendDownloadDialog", "(", "$", "fileOrString", ",", "$", "fileName", ",", "$", "exit", "=", "true", ")", "{", "$", "disposition", "=", "(", "false", "!==", "strpos", "(", "self", "::", "$", "userAgent", ",", "'MSIE 5.5'", ")", ")", "?", "''", ":", "'attachment; '", ";", "header", "(", "\"Pragma: public\"", ")", ";", "header", "(", "\"Expires: 0\"", ")", ";", "header", "(", "\"Cache-Control: must-revalidate, post-check=0, pre-check=0\"", ")", ";", "header", "(", "\"Cache-Control: private\"", ",", "false", ")", ";", "header", "(", "\"Content-Disposition: \"", ".", "$", "disposition", ".", "\"filename=\"", ".", "$", "fileName", ".", "\";\"", ")", ";", "if", "(", "is_file", "(", "$", "fileOrString", ")", ")", "{", "readfile", "(", "$", "fileOrString", ")", ";", "}", "else", "{", "echo", "$", "fileOrString", ";", "}", "if", "(", "$", "exit", ")", "{", "exit", "(", "0", ")", ";", "}", "}" ]
Sends file as download-header through any firewall to the browsers like >=IE6 >=FF3.6, Safari, Chrome, Opera. @link http://reeg.junetz.de/DSP/node16.html @link http://www.php.net/manual/de/function.header.php#88038 @param string $fileOrString @param string $fileName @param boolean $exit Optional for testing
[ "Sends", "file", "as", "download", "-", "header", "through", "any", "firewall", "to", "the", "browsers", "like", ">", "=", "IE6", ">", "=", "FF3", ".", "6", "Safari", "Chrome", "Opera", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Header.php#L216-L235
226,341
vinkla/laravel-backup
src/Backup.php
Backup.run
public function run(bool $clear = false) { $profile = $this->registry->get($this->getProfile()); $this->executor->backup($profile, $clear); }
php
public function run(bool $clear = false) { $profile = $this->registry->get($this->getProfile()); $this->executor->backup($profile, $clear); }
[ "public", "function", "run", "(", "bool", "$", "clear", "=", "false", ")", "{", "$", "profile", "=", "$", "this", "->", "registry", "->", "get", "(", "$", "this", "->", "getProfile", "(", ")", ")", ";", "$", "this", "->", "executor", "->", "backup", "(", "$", "profile", ",", "$", "clear", ")", ";", "}" ]
Execute the backup. @param bool $clear @return void
[ "Execute", "the", "backup", "." ]
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/Backup.php#L118-L123
226,342
Techworker/ssml
src/Element/Phoneme.php
Phoneme.factory
public static function factory(string $alphabet, string $ph, string $text): Phoneme { $instance = new static(); $instance->alphabet = $alphabet; $instance->ph = $ph; $instance->text = $text; return $instance; }
php
public static function factory(string $alphabet, string $ph, string $text): Phoneme { $instance = new static(); $instance->alphabet = $alphabet; $instance->ph = $ph; $instance->text = $text; return $instance; }
[ "public", "static", "function", "factory", "(", "string", "$", "alphabet", ",", "string", "$", "ph", ",", "string", "$", "text", ")", ":", "Phoneme", "{", "$", "instance", "=", "new", "static", "(", ")", ";", "$", "instance", "->", "alphabet", "=", "$", "alphabet", ";", "$", "instance", "->", "ph", "=", "$", "ph", ";", "$", "instance", "->", "text", "=", "$", "text", ";", "return", "$", "instance", ";", "}" ]
Creates a phoneme element with the given data as attributes. @param string $alphabet @param string $ph @param string $text @return Phoneme
[ "Creates", "a", "phoneme", "element", "with", "the", "given", "data", "as", "attributes", "." ]
cafb979b777480baf7a01b5db2bf7c2cff837805
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Element/Phoneme.php#L54-L62
226,343
sdboyer/gliph
src/Gliph/Algorithm/ConnectedComponent.php
ConnectedComponent.tarjan_scc
public static function tarjan_scc(Digraph $graph, TarjanSCCVisitor $visitor = NULL) { $visitor = $visitor ?: new TarjanSCCVisitor(); $counter = 0; $stack = array(); $indices = new \SplObjectStorage(); $lowlimits = new \SplObjectStorage(); $visit = function($vertex) use (&$visit, &$counter, $graph, &$stack, $indices, $lowlimits, $visitor) { $indices->attach($vertex, $counter); $lowlimits->attach($vertex, $counter); $stack[] = $vertex; $counter++; foreach ($graph->successorsOf($vertex) as $head) { if (!$indices->contains($head)) { $visit($head); $lowlimits[$vertex] = min($lowlimits[$vertex], $lowlimits[$head]); } else if (in_array($head, $stack, TRUE)) { $lowlimits[$vertex] = min($lowlimits[$vertex], $indices[$head]); } } if ($lowlimits[$vertex] === $indices[$vertex]) { $visitor->newComponent(); do { $other = array_pop($stack); $visitor->addToCurrentComponent($other); } while ($other != $vertex); } }; foreach ($graph->vertices() as $v) { if (!$indices->contains($v)) { $visit($v); } } return $visitor; }
php
public static function tarjan_scc(Digraph $graph, TarjanSCCVisitor $visitor = NULL) { $visitor = $visitor ?: new TarjanSCCVisitor(); $counter = 0; $stack = array(); $indices = new \SplObjectStorage(); $lowlimits = new \SplObjectStorage(); $visit = function($vertex) use (&$visit, &$counter, $graph, &$stack, $indices, $lowlimits, $visitor) { $indices->attach($vertex, $counter); $lowlimits->attach($vertex, $counter); $stack[] = $vertex; $counter++; foreach ($graph->successorsOf($vertex) as $head) { if (!$indices->contains($head)) { $visit($head); $lowlimits[$vertex] = min($lowlimits[$vertex], $lowlimits[$head]); } else if (in_array($head, $stack, TRUE)) { $lowlimits[$vertex] = min($lowlimits[$vertex], $indices[$head]); } } if ($lowlimits[$vertex] === $indices[$vertex]) { $visitor->newComponent(); do { $other = array_pop($stack); $visitor->addToCurrentComponent($other); } while ($other != $vertex); } }; foreach ($graph->vertices() as $v) { if (!$indices->contains($v)) { $visit($v); } } return $visitor; }
[ "public", "static", "function", "tarjan_scc", "(", "Digraph", "$", "graph", ",", "TarjanSCCVisitor", "$", "visitor", "=", "NULL", ")", "{", "$", "visitor", "=", "$", "visitor", "?", ":", "new", "TarjanSCCVisitor", "(", ")", ";", "$", "counter", "=", "0", ";", "$", "stack", "=", "array", "(", ")", ";", "$", "indices", "=", "new", "\\", "SplObjectStorage", "(", ")", ";", "$", "lowlimits", "=", "new", "\\", "SplObjectStorage", "(", ")", ";", "$", "visit", "=", "function", "(", "$", "vertex", ")", "use", "(", "&", "$", "visit", ",", "&", "$", "counter", ",", "$", "graph", ",", "&", "$", "stack", ",", "$", "indices", ",", "$", "lowlimits", ",", "$", "visitor", ")", "{", "$", "indices", "->", "attach", "(", "$", "vertex", ",", "$", "counter", ")", ";", "$", "lowlimits", "->", "attach", "(", "$", "vertex", ",", "$", "counter", ")", ";", "$", "stack", "[", "]", "=", "$", "vertex", ";", "$", "counter", "++", ";", "foreach", "(", "$", "graph", "->", "successorsOf", "(", "$", "vertex", ")", "as", "$", "head", ")", "{", "if", "(", "!", "$", "indices", "->", "contains", "(", "$", "head", ")", ")", "{", "$", "visit", "(", "$", "head", ")", ";", "$", "lowlimits", "[", "$", "vertex", "]", "=", "min", "(", "$", "lowlimits", "[", "$", "vertex", "]", ",", "$", "lowlimits", "[", "$", "head", "]", ")", ";", "}", "else", "if", "(", "in_array", "(", "$", "head", ",", "$", "stack", ",", "TRUE", ")", ")", "{", "$", "lowlimits", "[", "$", "vertex", "]", "=", "min", "(", "$", "lowlimits", "[", "$", "vertex", "]", ",", "$", "indices", "[", "$", "head", "]", ")", ";", "}", "}", "if", "(", "$", "lowlimits", "[", "$", "vertex", "]", "===", "$", "indices", "[", "$", "vertex", "]", ")", "{", "$", "visitor", "->", "newComponent", "(", ")", ";", "do", "{", "$", "other", "=", "array_pop", "(", "$", "stack", ")", ";", "$", "visitor", "->", "addToCurrentComponent", "(", "$", "other", ")", ";", "}", "while", "(", "$", "other", "!=", "$", "vertex", ")", ";", "}", "}", ";", "foreach", "(", "$", "graph", "->", "vertices", "(", ")", "as", "$", "v", ")", "{", "if", "(", "!", "$", "indices", "->", "contains", "(", "$", "v", ")", ")", "{", "$", "visit", "(", "$", "v", ")", ";", "}", "}", "return", "$", "visitor", ";", "}" ]
Finds connected components in the provided directed graph. @param Digraph $graph The Digraph to search for connected components. @param TarjanSCCVisitor $visitor The visitor that will collect and store the connected components. One will be created if not provided. @return TarjanSCCVisitor The finalized visitor.
[ "Finds", "connected", "components", "in", "the", "provided", "directed", "graph", "." ]
5ec6314b2b211053f6bae989b95446ccf6e8ded0
https://github.com/sdboyer/gliph/blob/5ec6314b2b211053f6bae989b95446ccf6e8ded0/src/Gliph/Algorithm/ConnectedComponent.php#L25-L64
226,344
CallFire/CallFire-PHP-SDK
src/CallFire/Generator/Soap/SoapFunction.php
SoapFunction.generateParameter
protected function generateParameter($requestTypeName, $requestType) { if ($requestNamespace = $this->getRequestNamespace()) { $requestType = Soap::REQUEST_NAMESPACE_ALIAS.'\\'.$requestType; } $parameter = new SoapParameter; $parameter->generate($requestTypeName, $requestType); return $parameter; }
php
protected function generateParameter($requestTypeName, $requestType) { if ($requestNamespace = $this->getRequestNamespace()) { $requestType = Soap::REQUEST_NAMESPACE_ALIAS.'\\'.$requestType; } $parameter = new SoapParameter; $parameter->generate($requestTypeName, $requestType); return $parameter; }
[ "protected", "function", "generateParameter", "(", "$", "requestTypeName", ",", "$", "requestType", ")", "{", "if", "(", "$", "requestNamespace", "=", "$", "this", "->", "getRequestNamespace", "(", ")", ")", "{", "$", "requestType", "=", "Soap", "::", "REQUEST_NAMESPACE_ALIAS", ".", "'\\\\'", ".", "$", "requestType", ";", "}", "$", "parameter", "=", "new", "SoapParameter", ";", "$", "parameter", "->", "generate", "(", "$", "requestTypeName", ",", "$", "requestType", ")", ";", "return", "$", "parameter", ";", "}" ]
Generate a parameter generator from a SOAP function description's parameter name and type. @param string $requestTypeName @param string $requestType @return SoapParameter
[ "Generate", "a", "parameter", "generator", "from", "a", "SOAP", "function", "description", "s", "parameter", "name", "and", "type", "." ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Generator/Soap/SoapFunction.php#L203-L213
226,345
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Label.php
Label.DeleteLabel
public function DeleteLabel(Request\DeleteLabel $DeleteLabel = null) { $uri = $this->getUri('/label', array()); return $this->delete($uri, $DeleteLabel); }
php
public function DeleteLabel(Request\DeleteLabel $DeleteLabel = null) { $uri = $this->getUri('/label', array()); return $this->delete($uri, $DeleteLabel); }
[ "public", "function", "DeleteLabel", "(", "Request", "\\", "DeleteLabel", "$", "DeleteLabel", "=", "null", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/label'", ",", "array", "(", ")", ")", ";", "return", "$", "this", "->", "delete", "(", "$", "uri", ",", "$", "DeleteLabel", ")", ";", "}" ]
Removes a label from all labeled objects and deletes it Delete label identified by name. All broadcasts and numbers currently containing the label will have the label association removed. @api @param Request\DeleteLabel $DeleteLabel = null
[ "Removes", "a", "label", "from", "all", "labeled", "objects", "and", "deletes", "it" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Label.php#L22-L27
226,346
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Label.php
Label.QueryLabels
public function QueryLabels(Request\QueryLabels $QueryLabels = null) { $uri = $this->getUri('/label', array()); return $this->get($uri, $QueryLabels); }
php
public function QueryLabels(Request\QueryLabels $QueryLabels = null) { $uri = $this->getUri('/label', array()); return $this->get($uri, $QueryLabels); }
[ "public", "function", "QueryLabels", "(", "Request", "\\", "QueryLabels", "$", "QueryLabels", "=", "null", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/label'", ",", "array", "(", ")", ")", ";", "return", "$", "this", "->", "get", "(", "$", "uri", ",", "$", "QueryLabels", ")", ";", "}" ]
Returns all defined labels Return list of all defined label names. The labels may be associated with broadcasts or numbers. @api @param Request\QueryLabels $QueryLabels = null
[ "Returns", "all", "defined", "labels" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Label.php#L38-L43
226,347
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Label.php
Label.LabelBroadcast
public function LabelBroadcast($Id, Request\LabelBroadcast $LabelBroadcast) { $uri = $this->getUri('/label/broadcast/%s', array($Id)); return $this->post($uri, $LabelBroadcast); }
php
public function LabelBroadcast($Id, Request\LabelBroadcast $LabelBroadcast) { $uri = $this->getUri('/label/broadcast/%s', array($Id)); return $this->post($uri, $LabelBroadcast); }
[ "public", "function", "LabelBroadcast", "(", "$", "Id", ",", "Request", "\\", "LabelBroadcast", "$", "LabelBroadcast", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/label/broadcast/%s'", ",", "array", "(", "$", "Id", ")", ")", ";", "return", "$", "this", "->", "post", "(", "$", "uri", ",", "$", "LabelBroadcast", ")", ";", "}" ]
Adds a label to a broadcast, creating the label if it doesn't already exist Label broadcast (Voice, Text, or IVR) by specifying broadcastId and label name. If label name doesn't currently exist on system it will be created and saved. @api @param int $Id Unique ID of resource @param Request\LabelBroadcast $LabelBroadcast
[ "Adds", "a", "label", "to", "a", "broadcast", "creating", "the", "label", "if", "it", "doesn", "t", "already", "exist" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Label.php#L55-L60
226,348
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Label.php
Label.UnlabelBroadcast
public function UnlabelBroadcast($Id, Request\UnlabelBroadcast $UnlabelBroadcast) { $uri = $this->getUri('/label/broadcast/%s', array($Id)); return $this->delete($uri, $UnlabelBroadcast); }
php
public function UnlabelBroadcast($Id, Request\UnlabelBroadcast $UnlabelBroadcast) { $uri = $this->getUri('/label/broadcast/%s', array($Id)); return $this->delete($uri, $UnlabelBroadcast); }
[ "public", "function", "UnlabelBroadcast", "(", "$", "Id", ",", "Request", "\\", "UnlabelBroadcast", "$", "UnlabelBroadcast", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/label/broadcast/%s'", ",", "array", "(", "$", "Id", ")", ")", ";", "return", "$", "this", "->", "delete", "(", "$", "uri", ",", "$", "UnlabelBroadcast", ")", ";", "}" ]
Removes a label from a single broadcast Remove label from broadcast. This doesn't remove label from system, it just removes association between broadcast and label. @api @param int $Id Unique ID of resource @param Request\UnlabelBroadcast $UnlabelBroadcast
[ "Removes", "a", "label", "from", "a", "single", "broadcast" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Label.php#L72-L77
226,349
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Label.php
Label.LabelNumber
public function LabelNumber($Number, Request\LabelNumber $LabelNumber) { $uri = $this->getUri('/label/number/%s', array($Number)); return $this->post($uri, $LabelNumber); }
php
public function LabelNumber($Number, Request\LabelNumber $LabelNumber) { $uri = $this->getUri('/label/number/%s', array($Number)); return $this->post($uri, $LabelNumber); }
[ "public", "function", "LabelNumber", "(", "$", "Number", ",", "Request", "\\", "LabelNumber", "$", "LabelNumber", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/label/number/%s'", ",", "array", "(", "$", "Number", ")", ")", ";", "return", "$", "this", "->", "post", "(", "$", "uri", ",", "$", "LabelNumber", ")", ";", "}" ]
Adds a label to a single number Label number by specifying E.164 11 digit number identifier and label name. If label name doesn't currently exist on system it will be created and saved. @api @param string $Number List of E.164 11 digit numbers space seperated and optional fieldName @param Request\LabelNumber $LabelNumber
[ "Adds", "a", "label", "to", "a", "single", "number" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Label.php#L90-L95
226,350
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Label.php
Label.UnlabelNumber
public function UnlabelNumber($Number, Request\UnlabelNumber $UnlabelNumber) { $uri = $this->getUri('/label/number/%s', array($Number)); return $this->delete($uri, $UnlabelNumber); }
php
public function UnlabelNumber($Number, Request\UnlabelNumber $UnlabelNumber) { $uri = $this->getUri('/label/number/%s', array($Number)); return $this->delete($uri, $UnlabelNumber); }
[ "public", "function", "UnlabelNumber", "(", "$", "Number", ",", "Request", "\\", "UnlabelNumber", "$", "UnlabelNumber", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/label/number/%s'", ",", "array", "(", "$", "Number", ")", ")", ";", "return", "$", "this", "->", "delete", "(", "$", "uri", ",", "$", "UnlabelNumber", ")", ";", "}" ]
Removes a label from a single number Remove label from number. This doesn't remove label from system, it just removes association between number and label. @api @param string $Number List of E.164 11 digit numbers space seperated and optional fieldName @param Request\UnlabelNumber $UnlabelNumber
[ "Removes", "a", "label", "from", "a", "single", "number" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Label.php#L108-L113
226,351
gjerokrsteski/pimf-framework
core/Pimf/Util/Message.php
Message.format
public function format() { if ($this->getMessage() == '' || !$this->getMessage()) { return ''; } if (count($this->bindings) > 0) { foreach ($this->bindings as $token => $value) { $this->message = str_replace($this->delimiter . $token, $value, $this->message); } } return $this->message; }
php
public function format() { if ($this->getMessage() == '' || !$this->getMessage()) { return ''; } if (count($this->bindings) > 0) { foreach ($this->bindings as $token => $value) { $this->message = str_replace($this->delimiter . $token, $value, $this->message); } } return $this->message; }
[ "public", "function", "format", "(", ")", "{", "if", "(", "$", "this", "->", "getMessage", "(", ")", "==", "''", "||", "!", "$", "this", "->", "getMessage", "(", ")", ")", "{", "return", "''", ";", "}", "if", "(", "count", "(", "$", "this", "->", "bindings", ")", ">", "0", ")", "{", "foreach", "(", "$", "this", "->", "bindings", "as", "$", "token", "=>", "$", "value", ")", "{", "$", "this", "->", "message", "=", "str_replace", "(", "$", "this", "->", "delimiter", ".", "$", "token", ",", "$", "value", ",", "$", "this", "->", "message", ")", ";", "}", "}", "return", "$", "this", "->", "message", ";", "}" ]
Retuns formated message. @return string
[ "Retuns", "formated", "message", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Message.php#L126-L139
226,352
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.updateUriQuery
private function updateUriQuery(): void { $sort = []; foreach ($this->order as $field => $direction) { if ($direction === self::ORDER_ASC) { $sort[] = $field; } elseif ($direction === self::ORDER_DESC) { $sort[] = '-' . $field; } } $fields = []; foreach ($this->fields as $type => $fields) { $fields[$type] = implode(',', $fields); } $query = [ 'sort' => implode(',', $sort), 'pagination' => $this->pagination, 'filter' => $this->filter, 'include' => implode(',', $this->includes), 'fields' => $fields ]; $this->uri = $this->uri()->withQuery(http_build_query($query)); }
php
private function updateUriQuery(): void { $sort = []; foreach ($this->order as $field => $direction) { if ($direction === self::ORDER_ASC) { $sort[] = $field; } elseif ($direction === self::ORDER_DESC) { $sort[] = '-' . $field; } } $fields = []; foreach ($this->fields as $type => $fields) { $fields[$type] = implode(',', $fields); } $query = [ 'sort' => implode(',', $sort), 'pagination' => $this->pagination, 'filter' => $this->filter, 'include' => implode(',', $this->includes), 'fields' => $fields ]; $this->uri = $this->uri()->withQuery(http_build_query($query)); }
[ "private", "function", "updateUriQuery", "(", ")", ":", "void", "{", "$", "sort", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "order", "as", "$", "field", "=>", "$", "direction", ")", "{", "if", "(", "$", "direction", "===", "self", "::", "ORDER_ASC", ")", "{", "$", "sort", "[", "]", "=", "$", "field", ";", "}", "elseif", "(", "$", "direction", "===", "self", "::", "ORDER_DESC", ")", "{", "$", "sort", "[", "]", "=", "'-'", ".", "$", "field", ";", "}", "}", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "type", "=>", "$", "fields", ")", "{", "$", "fields", "[", "$", "type", "]", "=", "implode", "(", "','", ",", "$", "fields", ")", ";", "}", "$", "query", "=", "[", "'sort'", "=>", "implode", "(", "','", ",", "$", "sort", ")", ",", "'pagination'", "=>", "$", "this", "->", "pagination", ",", "'filter'", "=>", "$", "this", "->", "filter", ",", "'include'", "=>", "implode", "(", "','", ",", "$", "this", "->", "includes", ")", ",", "'fields'", "=>", "$", "fields", "]", ";", "$", "this", "->", "uri", "=", "$", "this", "->", "uri", "(", ")", "->", "withQuery", "(", "http_build_query", "(", "$", "query", ")", ")", ";", "}" ]
Updates the uri query
[ "Updates", "the", "uri", "query" ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L259-L284
226,353
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.requestField
public function requestField(string $type, string $name): void { $this->fields[$type][] = $name; $this->updateUriQuery(); }
php
public function requestField(string $type, string $name): void { $this->fields[$type][] = $name; $this->updateUriQuery(); }
[ "public", "function", "requestField", "(", "string", "$", "type", ",", "string", "$", "name", ")", ":", "void", "{", "$", "this", "->", "fields", "[", "$", "type", "]", "[", "]", "=", "$", "name", ";", "$", "this", "->", "updateUriQuery", "(", ")", ";", "}" ]
Define a field as requested. This method will manipulate the uri of the request. @param string $type @param string $name
[ "Define", "a", "field", "as", "requested", ".", "This", "method", "will", "manipulate", "the", "uri", "of", "the", "request", "." ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L395-L399
226,354
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.requestInclude
public function requestInclude(string $relationship): void { $this->includes[] = $relationship; $this->currentLevelIncludes[] = explode('.', $relationship)[0]; $this->updateUriQuery(); }
php
public function requestInclude(string $relationship): void { $this->includes[] = $relationship; $this->currentLevelIncludes[] = explode('.', $relationship)[0]; $this->updateUriQuery(); }
[ "public", "function", "requestInclude", "(", "string", "$", "relationship", ")", ":", "void", "{", "$", "this", "->", "includes", "[", "]", "=", "$", "relationship", ";", "$", "this", "->", "currentLevelIncludes", "[", "]", "=", "explode", "(", "'.'", ",", "$", "relationship", ")", "[", "0", "]", ";", "$", "this", "->", "updateUriQuery", "(", ")", ";", "}" ]
Define a relationship as included. This method will manipulate the uri of the request. @param string $relationship
[ "Define", "a", "relationship", "as", "included", ".", "This", "method", "will", "manipulate", "the", "uri", "of", "the", "request", "." ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L419-L424
226,355
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.addFilter
public function addFilter(string $name, $value): void { $this->filter[$name] = $value; $this->updateUriQuery(); }
php
public function addFilter(string $name, $value): void { $this->filter[$name] = $value; $this->updateUriQuery(); }
[ "public", "function", "addFilter", "(", "string", "$", "name", ",", "$", "value", ")", ":", "void", "{", "$", "this", "->", "filter", "[", "$", "name", "]", "=", "$", "value", ";", "$", "this", "->", "updateUriQuery", "(", ")", ";", "}" ]
Define a filter value. This method will manipulate the uri of the request. @param string $name @param array|string|int|float $value @return void
[ "Define", "a", "filter", "value", ".", "This", "method", "will", "manipulate", "the", "uri", "of", "the", "request", "." ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L445-L449
226,356
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.addOrderBy
public function addOrderBy(string $name, string $direction = self::ORDER_ASC): void { $this->order[$name] = $direction; $this->updateUriQuery(); }
php
public function addOrderBy(string $name, string $direction = self::ORDER_ASC): void { $this->order[$name] = $direction; $this->updateUriQuery(); }
[ "public", "function", "addOrderBy", "(", "string", "$", "name", ",", "string", "$", "direction", "=", "self", "::", "ORDER_ASC", ")", ":", "void", "{", "$", "this", "->", "order", "[", "$", "name", "]", "=", "$", "direction", ";", "$", "this", "->", "updateUriQuery", "(", ")", ";", "}" ]
Define a sort parameter. This method will manipulate the uri of the request. @param string $name @param string $direction
[ "Define", "a", "sort", "parameter", ".", "This", "method", "will", "manipulate", "the", "uri", "of", "the", "request", "." ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L479-L483
226,357
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.addPagination
public function addPagination(string $key, $value): void { $this->pagination[$key] = $value; $this->updateUriQuery(); }
php
public function addPagination(string $key, $value): void { $this->pagination[$key] = $value; $this->updateUriQuery(); }
[ "public", "function", "addPagination", "(", "string", "$", "key", ",", "$", "value", ")", ":", "void", "{", "$", "this", "->", "pagination", "[", "$", "key", "]", "=", "$", "value", ";", "$", "this", "->", "updateUriQuery", "(", ")", ";", "}" ]
Define a pagination parameter. This method will manipulate the uri of the request. @param string $key @param array|string|int|float $value
[ "Define", "a", "pagination", "parameter", ".", "This", "method", "will", "manipulate", "the", "uri", "of", "the", "request", "." ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L499-L503
226,358
eosnewmedia/JSON-API-Common
src/Model/Request/Request.php
Request.createSubRequest
public function createSubRequest( string $relationship, ?ResourceInterface $resource = null, bool $keepFilters = false ): RequestInterface { $requestKey = $relationship . ($keepFilters ? '-filtered' : '-not-filtered'); if (!\array_key_exists($requestKey, $this->subRequests)) { $includes = []; foreach ($this->includes as $include) { if (strpos($include, '.') !== false && strpos($include, $relationship . '.') === 0) { $includes[] = explode('.', $include, 2)[1]; } } $queryFields = []; foreach ($this->fields as $type => $fields) { $queryFields[$type] = implode(',', $fields); } $type = $resource ? $resource->type() : $this->type(); $id = $resource ? $resource->id() : $this->id(); $relationshipPart = '/' . $relationship; if (!$this->requestsInclude($relationship)) { $relationshipPart = '/relationships' . $relationshipPart; } $subRequest = new self( $this->method(), $this->uri() ->withPath(($this->fileInPath ? '/' . $this->fileInPath : '') . ($this->apiPrefix ? '/' . $this->apiPrefix : '') . '/' . $type . '/' . $id . $relationshipPart) ->withQuery( http_build_query([ 'fields' => $queryFields, 'filter' => $keepFilters ? $this->filter : [], 'include' => implode(',', $includes) ]) ), null, $this->apiPrefix ); $subRequest->headers = $this->headers; $this->subRequests[$requestKey] = $subRequest; } return $this->subRequests[$requestKey]; }
php
public function createSubRequest( string $relationship, ?ResourceInterface $resource = null, bool $keepFilters = false ): RequestInterface { $requestKey = $relationship . ($keepFilters ? '-filtered' : '-not-filtered'); if (!\array_key_exists($requestKey, $this->subRequests)) { $includes = []; foreach ($this->includes as $include) { if (strpos($include, '.') !== false && strpos($include, $relationship . '.') === 0) { $includes[] = explode('.', $include, 2)[1]; } } $queryFields = []; foreach ($this->fields as $type => $fields) { $queryFields[$type] = implode(',', $fields); } $type = $resource ? $resource->type() : $this->type(); $id = $resource ? $resource->id() : $this->id(); $relationshipPart = '/' . $relationship; if (!$this->requestsInclude($relationship)) { $relationshipPart = '/relationships' . $relationshipPart; } $subRequest = new self( $this->method(), $this->uri() ->withPath(($this->fileInPath ? '/' . $this->fileInPath : '') . ($this->apiPrefix ? '/' . $this->apiPrefix : '') . '/' . $type . '/' . $id . $relationshipPart) ->withQuery( http_build_query([ 'fields' => $queryFields, 'filter' => $keepFilters ? $this->filter : [], 'include' => implode(',', $includes) ]) ), null, $this->apiPrefix ); $subRequest->headers = $this->headers; $this->subRequests[$requestKey] = $subRequest; } return $this->subRequests[$requestKey]; }
[ "public", "function", "createSubRequest", "(", "string", "$", "relationship", ",", "?", "ResourceInterface", "$", "resource", "=", "null", ",", "bool", "$", "keepFilters", "=", "false", ")", ":", "RequestInterface", "{", "$", "requestKey", "=", "$", "relationship", ".", "(", "$", "keepFilters", "?", "'-filtered'", ":", "'-not-filtered'", ")", ";", "if", "(", "!", "\\", "array_key_exists", "(", "$", "requestKey", ",", "$", "this", "->", "subRequests", ")", ")", "{", "$", "includes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "includes", "as", "$", "include", ")", "{", "if", "(", "strpos", "(", "$", "include", ",", "'.'", ")", "!==", "false", "&&", "strpos", "(", "$", "include", ",", "$", "relationship", ".", "'.'", ")", "===", "0", ")", "{", "$", "includes", "[", "]", "=", "explode", "(", "'.'", ",", "$", "include", ",", "2", ")", "[", "1", "]", ";", "}", "}", "$", "queryFields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "type", "=>", "$", "fields", ")", "{", "$", "queryFields", "[", "$", "type", "]", "=", "implode", "(", "','", ",", "$", "fields", ")", ";", "}", "$", "type", "=", "$", "resource", "?", "$", "resource", "->", "type", "(", ")", ":", "$", "this", "->", "type", "(", ")", ";", "$", "id", "=", "$", "resource", "?", "$", "resource", "->", "id", "(", ")", ":", "$", "this", "->", "id", "(", ")", ";", "$", "relationshipPart", "=", "'/'", ".", "$", "relationship", ";", "if", "(", "!", "$", "this", "->", "requestsInclude", "(", "$", "relationship", ")", ")", "{", "$", "relationshipPart", "=", "'/relationships'", ".", "$", "relationshipPart", ";", "}", "$", "subRequest", "=", "new", "self", "(", "$", "this", "->", "method", "(", ")", ",", "$", "this", "->", "uri", "(", ")", "->", "withPath", "(", "(", "$", "this", "->", "fileInPath", "?", "'/'", ".", "$", "this", "->", "fileInPath", ":", "''", ")", ".", "(", "$", "this", "->", "apiPrefix", "?", "'/'", ".", "$", "this", "->", "apiPrefix", ":", "''", ")", ".", "'/'", ".", "$", "type", ".", "'/'", ".", "$", "id", ".", "$", "relationshipPart", ")", "->", "withQuery", "(", "http_build_query", "(", "[", "'fields'", "=>", "$", "queryFields", ",", "'filter'", "=>", "$", "keepFilters", "?", "$", "this", "->", "filter", ":", "[", "]", ",", "'include'", "=>", "implode", "(", "','", ",", "$", "includes", ")", "]", ")", ")", ",", "null", ",", "$", "this", "->", "apiPrefix", ")", ";", "$", "subRequest", "->", "headers", "=", "$", "this", "->", "headers", ";", "$", "this", "->", "subRequests", "[", "$", "requestKey", "]", "=", "$", "subRequest", ";", "}", "return", "$", "this", "->", "subRequests", "[", "$", "requestKey", "]", ";", "}" ]
Creates a request for the given relationship. If called twice, the call will return the already created sub request. A sub request does not contain pagination and sorting from its parent. @param string $relationship @param ResourceInterface|null $resource @param bool $keepFilters @return RequestInterface @throws BadRequestException
[ "Creates", "a", "request", "for", "the", "given", "relationship", ".", "If", "called", "twice", "the", "call", "will", "return", "the", "already", "created", "sub", "request", ".", "A", "sub", "request", "does", "not", "contain", "pagination", "and", "sorting", "from", "its", "parent", "." ]
d868eb4d76bf75518f1bb72a70e5abf78fcae476
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Request/Request.php#L542-L588
226,359
progsmile/request-validator
src/Helpers/PdoTrait.php
PdoTrait.setupPDO
public static function setupPDO($connectionString, $user, $password) { try { self::$pdoInstance = new PDO($connectionString, $user, $password); } catch (PDOException $e) { trigger_error($e->getMessage(), E_USER_ERROR); } }
php
public static function setupPDO($connectionString, $user, $password) { try { self::$pdoInstance = new PDO($connectionString, $user, $password); } catch (PDOException $e) { trigger_error($e->getMessage(), E_USER_ERROR); } }
[ "public", "static", "function", "setupPDO", "(", "$", "connectionString", ",", "$", "user", ",", "$", "password", ")", "{", "try", "{", "self", "::", "$", "pdoInstance", "=", "new", "PDO", "(", "$", "connectionString", ",", "$", "user", ",", "$", "password", ")", ";", "}", "catch", "(", "PDOException", "$", "e", ")", "{", "trigger_error", "(", "$", "e", "->", "getMessage", "(", ")", ",", "E_USER_ERROR", ")", ";", "}", "}" ]
Initialize PDO connection. @param string $connectionString - ex. (mysql:host=localhost;dbname=test) @param string $user - db username @param string $password - db password
[ "Initialize", "PDO", "connection", "." ]
f211abd1a8e7c67030401f8c4896d926da7dafef
https://github.com/progsmile/request-validator/blob/f211abd1a8e7c67030401f8c4896d926da7dafef/src/Helpers/PdoTrait.php#L20-L27
226,360
gjerokrsteski/pimf-framework
core/Pimf/Cache.php
Cache.storage
public static function storage($storage = null) { if ($storage === null) { $storage = Config::get('cache.storage') ?: 'memory'; } if (!isset(static::$storages[$storage])) { static::$storages[$storage] = static::factory($storage); } return static::$storages[$storage]; }
php
public static function storage($storage = null) { if ($storage === null) { $storage = Config::get('cache.storage') ?: 'memory'; } if (!isset(static::$storages[$storage])) { static::$storages[$storage] = static::factory($storage); } return static::$storages[$storage]; }
[ "public", "static", "function", "storage", "(", "$", "storage", "=", "null", ")", "{", "if", "(", "$", "storage", "===", "null", ")", "{", "$", "storage", "=", "Config", "::", "get", "(", "'cache.storage'", ")", "?", ":", "'memory'", ";", "}", "if", "(", "!", "isset", "(", "static", "::", "$", "storages", "[", "$", "storage", "]", ")", ")", "{", "static", "::", "$", "storages", "[", "$", "storage", "]", "=", "static", "::", "factory", "(", "$", "storage", ")", ";", "}", "return", "static", "::", "$", "storages", "[", "$", "storage", "]", ";", "}" ]
Get a cache storage instance. @param string $storage @return CS\Apc|CS\Dba|CS\File|CS\Memcached|CS\Memory|CS\Pdo|CS\Redis|CS\WinCache
[ "Get", "a", "cache", "storage", "instance", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cache.php#L49-L60
226,361
gjerokrsteski/pimf-framework
core/Pimf/Cache.php
Cache.factory
protected static function factory($storage) { $cache = Config::get('cache'); switch ($storage) { case 'apc': return new CS\Apc($cache['key']); case 'file': return new CS\File($cache['storage_path']); case 'pdo': return new CS\Pdo(Pdo\Factory::get($cache['database']), $cache['key']); case 'memcached': return new CS\Memcached(Memcached::connection(), $cache['key']); case 'memory': return new CS\Memory(); case 'redis': return new CS\Redis(Redis::database()); case 'wincache': return new CS\WinCache($cache['key']); case 'dba': return new CS\Dba(Str::ensureTrailing('/', $cache['storage_path']) . $cache['key']); default: throw new \RuntimeException("Cache storage {$storage} is not supported."); } }
php
protected static function factory($storage) { $cache = Config::get('cache'); switch ($storage) { case 'apc': return new CS\Apc($cache['key']); case 'file': return new CS\File($cache['storage_path']); case 'pdo': return new CS\Pdo(Pdo\Factory::get($cache['database']), $cache['key']); case 'memcached': return new CS\Memcached(Memcached::connection(), $cache['key']); case 'memory': return new CS\Memory(); case 'redis': return new CS\Redis(Redis::database()); case 'wincache': return new CS\WinCache($cache['key']); case 'dba': return new CS\Dba(Str::ensureTrailing('/', $cache['storage_path']) . $cache['key']); default: throw new \RuntimeException("Cache storage {$storage} is not supported."); } }
[ "protected", "static", "function", "factory", "(", "$", "storage", ")", "{", "$", "cache", "=", "Config", "::", "get", "(", "'cache'", ")", ";", "switch", "(", "$", "storage", ")", "{", "case", "'apc'", ":", "return", "new", "CS", "\\", "Apc", "(", "$", "cache", "[", "'key'", "]", ")", ";", "case", "'file'", ":", "return", "new", "CS", "\\", "File", "(", "$", "cache", "[", "'storage_path'", "]", ")", ";", "case", "'pdo'", ":", "return", "new", "CS", "\\", "Pdo", "(", "Pdo", "\\", "Factory", "::", "get", "(", "$", "cache", "[", "'database'", "]", ")", ",", "$", "cache", "[", "'key'", "]", ")", ";", "case", "'memcached'", ":", "return", "new", "CS", "\\", "Memcached", "(", "Memcached", "::", "connection", "(", ")", ",", "$", "cache", "[", "'key'", "]", ")", ";", "case", "'memory'", ":", "return", "new", "CS", "\\", "Memory", "(", ")", ";", "case", "'redis'", ":", "return", "new", "CS", "\\", "Redis", "(", "Redis", "::", "database", "(", ")", ")", ";", "case", "'wincache'", ":", "return", "new", "CS", "\\", "WinCache", "(", "$", "cache", "[", "'key'", "]", ")", ";", "case", "'dba'", ":", "return", "new", "CS", "\\", "Dba", "(", "Str", "::", "ensureTrailing", "(", "'/'", ",", "$", "cache", "[", "'storage_path'", "]", ")", ".", "$", "cache", "[", "'key'", "]", ")", ";", "default", ":", "throw", "new", "\\", "RuntimeException", "(", "\"Cache storage {$storage} is not supported.\"", ")", ";", "}", "}" ]
Create a new cache storage instance. @param string $storage @return CS\Apc|CS\Dba|CS\File|CS\Memcached|CS\Memory|CS\Pdo|CS\Redis|CS\WinCache @throws \RuntimeException
[ "Create", "a", "new", "cache", "storage", "instance", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cache.php#L70-L102
226,362
jagilpe/encryption-bundle
Metadata/ClassMetadataFactory.php
ClassMetadataFactory.getClassMetadata
private function getClassMetadata(\ReflectionClass $reflectionClass) { /** @var ClassMetadata $classMetadata */ $classMetadata = $this->getMetadataDriver()->loadMetadataForClass($reflectionClass); if (null === $classMetadata->encryptionMode) { $classMetadata->encryptionMode = $this->settings['default_mode']; } return $classMetadata; }
php
private function getClassMetadata(\ReflectionClass $reflectionClass) { /** @var ClassMetadata $classMetadata */ $classMetadata = $this->getMetadataDriver()->loadMetadataForClass($reflectionClass); if (null === $classMetadata->encryptionMode) { $classMetadata->encryptionMode = $this->settings['default_mode']; } return $classMetadata; }
[ "private", "function", "getClassMetadata", "(", "\\", "ReflectionClass", "$", "reflectionClass", ")", "{", "/** @var ClassMetadata $classMetadata */", "$", "classMetadata", "=", "$", "this", "->", "getMetadataDriver", "(", ")", "->", "loadMetadataForClass", "(", "$", "reflectionClass", ")", ";", "if", "(", "null", "===", "$", "classMetadata", "->", "encryptionMode", ")", "{", "$", "classMetadata", "->", "encryptionMode", "=", "$", "this", "->", "settings", "[", "'default_mode'", "]", ";", "}", "return", "$", "classMetadata", ";", "}" ]
Returns the metadata for a given class @param \ReflectionClass $reflectionClass @return ClassMetadata
[ "Returns", "the", "metadata", "for", "a", "given", "class" ]
1e1ba13a3cc646b36e3407822f2e8339c5671f47
https://github.com/jagilpe/encryption-bundle/blob/1e1ba13a3cc646b36e3407822f2e8339c5671f47/Metadata/ClassMetadataFactory.php#L140-L148
226,363
jagilpe/encryption-bundle
Metadata/ClassMetadataFactory.php
ClassMetadataFactory.getMetadataDirs
private function getMetadataDirs() { if (null === $this->metadataDirs) { $this->metadataDirs = array(); $bundles = $this->kernel->getBundles(); $fs = new Filesystem(); /** * @var string $bundleName * @var BundleInterface $bundle */ foreach ($bundles as $bundleName => $bundle) { $directory = $this->kernel->locateResource("@$bundleName/Resources"); $directory .= '/config/m7_encryption'; if ($fs->exists($directory)) { $nameSpace = $bundle->getNamespace(); $this->metadataDirs[$nameSpace] = $directory; } } } return $this->metadataDirs; }
php
private function getMetadataDirs() { if (null === $this->metadataDirs) { $this->metadataDirs = array(); $bundles = $this->kernel->getBundles(); $fs = new Filesystem(); /** * @var string $bundleName * @var BundleInterface $bundle */ foreach ($bundles as $bundleName => $bundle) { $directory = $this->kernel->locateResource("@$bundleName/Resources"); $directory .= '/config/m7_encryption'; if ($fs->exists($directory)) { $nameSpace = $bundle->getNamespace(); $this->metadataDirs[$nameSpace] = $directory; } } } return $this->metadataDirs; }
[ "private", "function", "getMetadataDirs", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "metadataDirs", ")", "{", "$", "this", "->", "metadataDirs", "=", "array", "(", ")", ";", "$", "bundles", "=", "$", "this", "->", "kernel", "->", "getBundles", "(", ")", ";", "$", "fs", "=", "new", "Filesystem", "(", ")", ";", "/**\n * @var string $bundleName\n * @var BundleInterface $bundle\n */", "foreach", "(", "$", "bundles", "as", "$", "bundleName", "=>", "$", "bundle", ")", "{", "$", "directory", "=", "$", "this", "->", "kernel", "->", "locateResource", "(", "\"@$bundleName/Resources\"", ")", ";", "$", "directory", ".=", "'/config/m7_encryption'", ";", "if", "(", "$", "fs", "->", "exists", "(", "$", "directory", ")", ")", "{", "$", "nameSpace", "=", "$", "bundle", "->", "getNamespace", "(", ")", ";", "$", "this", "->", "metadataDirs", "[", "$", "nameSpace", "]", "=", "$", "directory", ";", "}", "}", "}", "return", "$", "this", "->", "metadataDirs", ";", "}" ]
Returns the directories in which to look for the encryption metadata @return array
[ "Returns", "the", "directories", "in", "which", "to", "look", "for", "the", "encryption", "metadata" ]
1e1ba13a3cc646b36e3407822f2e8339c5671f47
https://github.com/jagilpe/encryption-bundle/blob/1e1ba13a3cc646b36e3407822f2e8339c5671f47/Metadata/ClassMetadataFactory.php#L155-L177
226,364
jagilpe/encryption-bundle
Metadata/ClassMetadataFactory.php
ClassMetadataFactory.getMetadataDriver
private function getMetadataDriver() { if (null === $this->driver) { $metadataDirs = $this->getMetadataDirs(); $annotationDriver = new AnnotationDriver($this->reader); if (!empty($metadataDirs)) { $fileLocator = new FileLocator($metadataDirs); $ymlDriver = new YamlDriver($fileLocator); $this->driver = new DriverChain(array( $ymlDriver, $annotationDriver, )); $ymlDriver->setDriver($this->driver); } else { $this->driver = $annotationDriver; } } return $this->driver; }
php
private function getMetadataDriver() { if (null === $this->driver) { $metadataDirs = $this->getMetadataDirs(); $annotationDriver = new AnnotationDriver($this->reader); if (!empty($metadataDirs)) { $fileLocator = new FileLocator($metadataDirs); $ymlDriver = new YamlDriver($fileLocator); $this->driver = new DriverChain(array( $ymlDriver, $annotationDriver, )); $ymlDriver->setDriver($this->driver); } else { $this->driver = $annotationDriver; } } return $this->driver; }
[ "private", "function", "getMetadataDriver", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "driver", ")", "{", "$", "metadataDirs", "=", "$", "this", "->", "getMetadataDirs", "(", ")", ";", "$", "annotationDriver", "=", "new", "AnnotationDriver", "(", "$", "this", "->", "reader", ")", ";", "if", "(", "!", "empty", "(", "$", "metadataDirs", ")", ")", "{", "$", "fileLocator", "=", "new", "FileLocator", "(", "$", "metadataDirs", ")", ";", "$", "ymlDriver", "=", "new", "YamlDriver", "(", "$", "fileLocator", ")", ";", "$", "this", "->", "driver", "=", "new", "DriverChain", "(", "array", "(", "$", "ymlDriver", ",", "$", "annotationDriver", ",", ")", ")", ";", "$", "ymlDriver", "->", "setDriver", "(", "$", "this", "->", "driver", ")", ";", "}", "else", "{", "$", "this", "->", "driver", "=", "$", "annotationDriver", ";", "}", "}", "return", "$", "this", "->", "driver", ";", "}" ]
Returns the metadata driver @return DriverInterface
[ "Returns", "the", "metadata", "driver" ]
1e1ba13a3cc646b36e3407822f2e8339c5671f47
https://github.com/jagilpe/encryption-bundle/blob/1e1ba13a3cc646b36e3407822f2e8339c5671f47/Metadata/ClassMetadataFactory.php#L184-L206
226,365
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.CreateBroadcast
public function CreateBroadcast(Request\CreateBroadcast $CreateBroadcast = null) { $uri = $this->getUri('/broadcast', array()); return $this->post($uri, $CreateBroadcast); }
php
public function CreateBroadcast(Request\CreateBroadcast $CreateBroadcast = null) { $uri = $this->getUri('/broadcast', array()); return $this->post($uri, $CreateBroadcast); }
[ "public", "function", "CreateBroadcast", "(", "Request", "\\", "CreateBroadcast", "$", "CreateBroadcast", "=", "null", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast'", ",", "array", "(", ")", ")", ";", "return", "$", "this", "->", "post", "(", "$", "uri", ",", "$", "CreateBroadcast", ")", ";", "}" ]
Creates a new Broadcast This operation creates a Broadcast campaign and returns a broadcastId. To see the status of this campaign call GetBroadcast with the returned broadcastId. There are 3 types of Broadcast: TEXT, IVR, or VOICE. Select the appropriate config to match the broadcast type, TextBroadcastConfig, IvrBroadcastConfig, or VoiceBroadcastConfig. Prefer the Text Service operations (ex: SendText) and Call Service operations (ex: SendCall) over this operation when managing simple text and call campaigns since those operations are simpler and more concise. @api @param Request\CreateBroadcast $CreateBroadcast = null
[ "Creates", "a", "new", "Broadcast" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L27-L32
226,366
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.QueryBroadcasts
public function QueryBroadcasts(Request\QueryBroadcasts $QueryBroadcasts = null) { $uri = $this->getUri('/broadcast', array()); return $this->get($uri, $QueryBroadcasts); }
php
public function QueryBroadcasts(Request\QueryBroadcasts $QueryBroadcasts = null) { $uri = $this->getUri('/broadcast', array()); return $this->get($uri, $QueryBroadcasts); }
[ "public", "function", "QueryBroadcasts", "(", "Request", "\\", "QueryBroadcasts", "$", "QueryBroadcasts", "=", "null", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast'", ",", "array", "(", ")", ")", ";", "return", "$", "this", "->", "get", "(", "$", "uri", ",", "$", "QueryBroadcasts", ")", ";", "}" ]
Lists existing Broadcasts Use this operation to see the status of Broadcasts in account. Filter by type of campaign whether currently running. Returns a list of Broadcast info such as campaign name, type, status, ect... @api @param Request\QueryBroadcasts $QueryBroadcasts = null
[ "Lists", "existing", "Broadcasts" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L44-L49
226,367
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.GetBroadcastStats
public function GetBroadcastStats($Id, Request\GetBroadcastStats $GetBroadcastStats) { $uri = $this->getUri('/broadcast/%s/stats', array($Id)); return $this->get($uri, $GetBroadcastStats); }
php
public function GetBroadcastStats($Id, Request\GetBroadcastStats $GetBroadcastStats) { $uri = $this->getUri('/broadcast/%s/stats', array($Id)); return $this->get($uri, $GetBroadcastStats); }
[ "public", "function", "GetBroadcastStats", "(", "$", "Id", ",", "Request", "\\", "GetBroadcastStats", "$", "GetBroadcastStats", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s/stats'", ",", "array", "(", "$", "Id", ")", ")", ";", "return", "$", "this", "->", "get", "(", "$", "uri", ",", "$", "GetBroadcastStats", ")", ";", "}" ]
Gets performance and result statistics for a Broadcast Get broadcast stats by broadcastId or by interval range. Stats include information like billed amount, billed duration, actions count, attempt count, etc... @api @param int $Id Unique ID of resource @param Request\GetBroadcastStats $GetBroadcastStats
[ "Gets", "performance", "and", "result", "statistics", "for", "a", "Broadcast" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L79-L84
226,368
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.ControlBroadcast
public function ControlBroadcast($Id, Request\ControlBroadcast $ControlBroadcast) { $uri = $this->getUri('/broadcast/%s/control', array($Id)); return $this->put($uri, $ControlBroadcast); }
php
public function ControlBroadcast($Id, Request\ControlBroadcast $ControlBroadcast) { $uri = $this->getUri('/broadcast/%s/control', array($Id)); return $this->put($uri, $ControlBroadcast); }
[ "public", "function", "ControlBroadcast", "(", "$", "Id", ",", "Request", "\\", "ControlBroadcast", "$", "ControlBroadcast", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s/control'", ",", "array", "(", "$", "Id", ")", ")", ";", "return", "$", "this", "->", "put", "(", "$", "uri", ",", "$", "ControlBroadcast", ")", ";", "}" ]
Starts, Stops or Archives a Broadcast Apply command START, STOP, or ARCHIVE to Broadcast. Also can change the max active count of Broadcast. @api @param int $Id Unique ID of resource @param Request\ControlBroadcast $ControlBroadcast
[ "Starts", "Stops", "or", "Archives", "a", "Broadcast" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L96-L101
226,369
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.CreateContactBatch
public function CreateContactBatch($BroadcastId, Request\CreateContactBatch $CreateContactBatch) { $uri = $this->getUri('/broadcast/%s/batch', array($BroadcastId)); return $this->post($uri, $CreateContactBatch); }
php
public function CreateContactBatch($BroadcastId, Request\CreateContactBatch $CreateContactBatch) { $uri = $this->getUri('/broadcast/%s/batch', array($BroadcastId)); return $this->post($uri, $CreateContactBatch); }
[ "public", "function", "CreateContactBatch", "(", "$", "BroadcastId", ",", "Request", "\\", "CreateContactBatch", "$", "CreateContactBatch", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s/batch'", ",", "array", "(", "$", "BroadcastId", ")", ")", ";", "return", "$", "this", "->", "post", "(", "$", "uri", ",", "$", "CreateContactBatch", ")", ";", "}" ]
Creates a new ContactBatch Contact Batch is a list of contacts to associate with a broadcast. Use this operation to attach a list of contacts to an existing Campaign. A list of ToNumbers or an existing Contact List ID is required to create and attach the Contact List. Returned is the unique contactListId that can be used in ControlContactBatch to enable or disable this batch. @api @param int $BroadcastId Id of Broadcast @param Request\CreateContactBatch $CreateContactBatch
[ "Creates", "a", "new", "ContactBatch" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L116-L121
226,370
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.QueryContactBatches
public function QueryContactBatches($BroadcastId, Request\QueryContactBatches $QueryContactBatches) { $uri = $this->getUri('/broadcast/%s/batch', array($BroadcastId)); return $this->get($uri, $QueryContactBatches); }
php
public function QueryContactBatches($BroadcastId, Request\QueryContactBatches $QueryContactBatches) { $uri = $this->getUri('/broadcast/%s/batch', array($BroadcastId)); return $this->get($uri, $QueryContactBatches); }
[ "public", "function", "QueryContactBatches", "(", "$", "BroadcastId", ",", "Request", "\\", "QueryContactBatches", "$", "QueryContactBatches", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s/batch'", ",", "array", "(", "$", "BroadcastId", ")", ")", ";", "return", "$", "this", "->", "get", "(", "$", "uri", ",", "$", "QueryContactBatches", ")", ";", "}" ]
Lists a Broadcast's ContactBatch Return list of Contact Batches associated with this Broadcast. The contactBatchIds returned from this campaign can then be used to enable, disable, or delete the individual Batches. @api @param int $BroadcastId Unique ID of Broadcast @param Request\QueryContactBatches $QueryContactBatches
[ "Lists", "a", "Broadcast", "s", "ContactBatch" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L134-L139
226,371
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.ControlContactBatch
public function ControlContactBatch($Id, Request\ControlContactBatch $ControlContactBatch) { $uri = $this->getUri('/broadcast/batch/%s/control', array($Id)); return $this->put($uri, $ControlContactBatch); }
php
public function ControlContactBatch($Id, Request\ControlContactBatch $ControlContactBatch) { $uri = $this->getUri('/broadcast/batch/%s/control', array($Id)); return $this->put($uri, $ControlContactBatch); }
[ "public", "function", "ControlContactBatch", "(", "$", "Id", ",", "Request", "\\", "ControlContactBatch", "$", "ControlContactBatch", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/batch/%s/control'", ",", "array", "(", "$", "Id", ")", ")", ";", "return", "$", "this", "->", "put", "(", "$", "uri", ",", "$", "ControlContactBatch", ")", ";", "}" ]
Enables or Disables a Broadcast's ContactBatch This operation provides the ability to enable or disable on a Broadcast the list of contacts associated with a ContactBatch. @api @param int $Id Unique ID of resource @param Request\ControlContactBatch $ControlContactBatch
[ "Enables", "or", "Disables", "a", "Broadcast", "s", "ContactBatch" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L167-L172
226,372
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.CreateBroadcastSchedule
public function CreateBroadcastSchedule($BroadcastId, Request\CreateBroadcastSchedule $CreateBroadcastSchedule) { $uri = $this->getUri('/broadcast/%s/schedule', array($BroadcastId)); return $this->post($uri, $CreateBroadcastSchedule); }
php
public function CreateBroadcastSchedule($BroadcastId, Request\CreateBroadcastSchedule $CreateBroadcastSchedule) { $uri = $this->getUri('/broadcast/%s/schedule', array($BroadcastId)); return $this->post($uri, $CreateBroadcastSchedule); }
[ "public", "function", "CreateBroadcastSchedule", "(", "$", "BroadcastId", ",", "Request", "\\", "CreateBroadcastSchedule", "$", "CreateBroadcastSchedule", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s/schedule'", ",", "array", "(", "$", "BroadcastId", ")", ")", ";", "return", "$", "this", "->", "post", "(", "$", "uri", ",", "$", "CreateBroadcastSchedule", ")", ";", "}" ]
Creates a new Schedule for a Broadcast Broadcast can be set to run at scheduled times a prescribed by BroadcastSchedule. Can pick start time, stop time, begin date, and day of week. Returns broadcastScheduleId that can be used in GetBroadcastSchedule and DeleteBroadcastSchedule @api @param int $BroadcastId @param Request\CreateBroadcastSchedule $CreateBroadcastSchedule
[ "Creates", "a", "new", "Schedule", "for", "a", "Broadcast" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L186-L191
226,373
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.QueryBroadcastSchedule
public function QueryBroadcastSchedule($BroadcastId, Request\QueryBroadcastSchedule $QueryBroadcastSchedule) { $uri = $this->getUri('/broadcast/%s/schedule', array($BroadcastId)); return $this->get($uri, $QueryBroadcastSchedule); }
php
public function QueryBroadcastSchedule($BroadcastId, Request\QueryBroadcastSchedule $QueryBroadcastSchedule) { $uri = $this->getUri('/broadcast/%s/schedule', array($BroadcastId)); return $this->get($uri, $QueryBroadcastSchedule); }
[ "public", "function", "QueryBroadcastSchedule", "(", "$", "BroadcastId", ",", "Request", "\\", "QueryBroadcastSchedule", "$", "QueryBroadcastSchedule", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s/schedule'", ",", "array", "(", "$", "BroadcastId", ")", ")", ";", "return", "$", "this", "->", "get", "(", "$", "uri", ",", "$", "QueryBroadcastSchedule", ")", ";", "}" ]
Lists existing BroadcastSchedules List information about Broadcast Schedules attached to a Broadcast. @api @param int $BroadcastId Unique ID of Broadcast @param Request\QueryBroadcastSchedule $QueryBroadcastSchedule
[ "Lists", "existing", "BroadcastSchedules" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L202-L207
226,374
CallFire/CallFire-PHP-SDK
src/CallFire/Api/Rest/Client/Broadcast.php
Broadcast.UpdateBroadcast
public function UpdateBroadcast($id, Request\UpdateBroadcast $UpdateBroadcast = null) { $uri = $this->getUri('/broadcast/%s', array($id)); return $this->put($uri, $UpdateBroadcast); }
php
public function UpdateBroadcast($id, Request\UpdateBroadcast $UpdateBroadcast = null) { $uri = $this->getUri('/broadcast/%s', array($id)); return $this->put($uri, $UpdateBroadcast); }
[ "public", "function", "UpdateBroadcast", "(", "$", "id", ",", "Request", "\\", "UpdateBroadcast", "$", "UpdateBroadcast", "=", "null", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", "'/broadcast/%s'", ",", "array", "(", "$", "id", ")", ")", ";", "return", "$", "this", "->", "put", "(", "$", "uri", ",", "$", "UpdateBroadcast", ")", ";", "}" ]
Updates an existing Broadcast's configuration Update existing broadcast's configuration such as time zone restrictions or retry logic. Currently all fields from config are updated so the 'Message' field needs to be populated just like in CreateBroadcast operation. Use unique ID to specify broadcast. Need to provide dummy 'Name' field Broadcast even though the field will not be overwritten. Testing this method using swagger doc REST interface (Try Me! button) does not work correctly. Please use curl or other rest client to test api call. @api @param Request\UpdateBroadcast $UpdateBroadcast = null @param int $id
[ "Updates", "an", "existing", "Broadcast", "s", "configuration" ]
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Broadcast.php#L254-L259
226,375
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.checkUtf8Encoding
public static function checkUtf8Encoding($string) { if (!mb_check_encoding($string, 'UTF-8') || !$string == mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32') ) { return false; } return true; }
php
public static function checkUtf8Encoding($string) { if (!mb_check_encoding($string, 'UTF-8') || !$string == mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32') ) { return false; } return true; }
[ "public", "static", "function", "checkUtf8Encoding", "(", "$", "string", ")", "{", "if", "(", "!", "mb_check_encoding", "(", "$", "string", ",", "'UTF-8'", ")", "||", "!", "$", "string", "==", "mb_convert_encoding", "(", "mb_convert_encoding", "(", "$", "string", ",", "'UTF-32'", ",", "'UTF-8'", ")", ",", "'UTF-8'", ",", "'UTF-32'", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check for invalid UTF8 encoding and invalid byte . @param string $string Your string. @return boolean
[ "Check", "for", "invalid", "UTF8", "encoding", "and", "invalid", "byte", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L38-L47
226,376
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.ensureTrailing
public static function ensureTrailing($needle, $haystack) { $needleLength = strlen($needle); $needlePart = substr($haystack, -1 * $needleLength); if ($needlePart !== $needle) { // append missing trailing character. $haystack .= $needle; } return $haystack; }
php
public static function ensureTrailing($needle, $haystack) { $needleLength = strlen($needle); $needlePart = substr($haystack, -1 * $needleLength); if ($needlePart !== $needle) { // append missing trailing character. $haystack .= $needle; } return $haystack; }
[ "public", "static", "function", "ensureTrailing", "(", "$", "needle", ",", "$", "haystack", ")", "{", "$", "needleLength", "=", "strlen", "(", "$", "needle", ")", ";", "$", "needlePart", "=", "substr", "(", "$", "haystack", ",", "-", "1", "*", "$", "needleLength", ")", ";", "if", "(", "$", "needlePart", "!==", "$", "needle", ")", "{", "// append missing trailing character.", "$", "haystack", ".=", "$", "needle", ";", "}", "return", "$", "haystack", ";", "}" ]
Ensure that a string is ends with a special string. <code> - ensureTrailing('/', 'http://www.example.com') -> 'http://www.example.com/' - ensureTrailing('/', 'http://www.example.com/') -> 'http://www.example.com/' </code> @param string $needle The needle. @param string $haystack The haystack. @return string
[ "Ensure", "that", "a", "string", "is", "ends", "with", "a", "special", "string", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L62-L73
226,377
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.ensureLeading
public static function ensureLeading($needle, $haystack) { $needleLength = strlen($needle); $needlePart = substr($haystack, 0, $needleLength); if ($needlePart !== $needle) { // append missing trailing string $haystack = $needle . $haystack; } return $haystack; }
php
public static function ensureLeading($needle, $haystack) { $needleLength = strlen($needle); $needlePart = substr($haystack, 0, $needleLength); if ($needlePart !== $needle) { // append missing trailing string $haystack = $needle . $haystack; } return $haystack; }
[ "public", "static", "function", "ensureLeading", "(", "$", "needle", ",", "$", "haystack", ")", "{", "$", "needleLength", "=", "strlen", "(", "$", "needle", ")", ";", "$", "needlePart", "=", "substr", "(", "$", "haystack", ",", "0", ",", "$", "needleLength", ")", ";", "if", "(", "$", "needlePart", "!==", "$", "needle", ")", "{", "// append missing trailing string", "$", "haystack", "=", "$", "needle", ".", "$", "haystack", ";", "}", "return", "$", "haystack", ";", "}" ]
Ensure that a string is starts with a special string. <code> - ensureLeading('#', '1#2#3#4#5') -> '#1#2#3#4#5' - ensureLeading('#', '#1#2#3#4#5') -> '#1#2#3#4#5' </code> @param string $needle The needle. @param string $haystack The haystack @return string
[ "Ensure", "that", "a", "string", "is", "starts", "with", "a", "special", "string", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L88-L99
226,378
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.deleteTrailing
public static function deleteTrailing($needle, $haystack) { $pattern = '#(' . self::pregQuote($needle, '#') . ')+$#'; $result = preg_replace($pattern, '', $haystack); return $result; }
php
public static function deleteTrailing($needle, $haystack) { $pattern = '#(' . self::pregQuote($needle, '#') . ')+$#'; $result = preg_replace($pattern, '', $haystack); return $result; }
[ "public", "static", "function", "deleteTrailing", "(", "$", "needle", ",", "$", "haystack", ")", "{", "$", "pattern", "=", "'#('", ".", "self", "::", "pregQuote", "(", "$", "needle", ",", "'#'", ")", ".", "')+$#'", ";", "$", "result", "=", "preg_replace", "(", "$", "pattern", ",", "''", ",", "$", "haystack", ")", ";", "return", "$", "result", ";", "}" ]
Delete trailing characters. <code> - deleteTrailing('|', '|1|2|3|4|5|') -> '|1|2|3|4|5' - deleteTrailing(array('|','5'), '|1|2|3|4|5|555') -> '|1|2|3|4' </code> @param string|array $needle The needle. @param string $haystack The haystack. @return string
[ "Delete", "trailing", "characters", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L114-L120
226,379
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.deleteLeading
public static function deleteLeading($needle, $haystack) { $pattern = '#^(' . self::pregQuote($needle, '#') . ')+#'; $result = preg_replace($pattern, '', $haystack); return $result; }
php
public static function deleteLeading($needle, $haystack) { $pattern = '#^(' . self::pregQuote($needle, '#') . ')+#'; $result = preg_replace($pattern, '', $haystack); return $result; }
[ "public", "static", "function", "deleteLeading", "(", "$", "needle", ",", "$", "haystack", ")", "{", "$", "pattern", "=", "'#^('", ".", "self", "::", "pregQuote", "(", "$", "needle", ",", "'#'", ")", ".", "')+#'", ";", "$", "result", "=", "preg_replace", "(", "$", "pattern", ",", "''", ",", "$", "haystack", ")", ";", "return", "$", "result", ";", "}" ]
Delete leading characters. <code> - deleteTrailing('#', '#1#2#3#4#5') -> '1#2#3#4#5' - deleteTrailing(array('#', '1'), '##11#2#3#4#5') -> '2#3#4#5' </code> @param string|array $needle The needle. @param string $haystack The haystack. @return string
[ "Delete", "leading", "characters", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L135-L141
226,380
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.pregQuote
public static function pregQuote($values, $delimiter = null) { if (!is_array($values)) { return preg_quote($values, $delimiter); } // Case: needle is array foreach ($values as $key => $value) { $values[$key] = preg_quote($value, $delimiter); } return implode('|', $values); }
php
public static function pregQuote($values, $delimiter = null) { if (!is_array($values)) { return preg_quote($values, $delimiter); } // Case: needle is array foreach ($values as $key => $value) { $values[$key] = preg_quote($value, $delimiter); } return implode('|', $values); }
[ "public", "static", "function", "pregQuote", "(", "$", "values", ",", "$", "delimiter", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "values", ")", ")", "{", "return", "preg_quote", "(", "$", "values", ",", "$", "delimiter", ")", ";", "}", "// Case: needle is array", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "values", "[", "$", "key", "]", "=", "preg_quote", "(", "$", "value", ",", "$", "delimiter", ")", ";", "}", "return", "implode", "(", "'|'", ",", "$", "values", ")", ";", "}" ]
Wrapper for preg_quote supporting strings and array of strings. @param mixed $values The values. @param null|string $delimiter (Optional) The delimiter. @return string
[ "Wrapper", "for", "preg_quote", "supporting", "strings", "and", "array", "of", "strings", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L151-L163
226,381
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.contains
public static function contains($haystack, $needle) { foreach ((array)$needle as $n) { if (strpos($haystack, $n) !== false) { return true; } } return false; }
php
public static function contains($haystack, $needle) { foreach ((array)$needle as $n) { if (strpos($haystack, $n) !== false) { return true; } } return false; }
[ "public", "static", "function", "contains", "(", "$", "haystack", ",", "$", "needle", ")", "{", "foreach", "(", "(", "array", ")", "$", "needle", "as", "$", "n", ")", "{", "if", "(", "strpos", "(", "$", "haystack", ",", "$", "n", ")", "!==", "false", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Determine if a given string contains a given sub-string. @param string $haystack @param string|array $needle @return bool
[ "Determine", "if", "a", "given", "string", "contains", "a", "given", "sub", "-", "string", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L211-L220
226,382
gjerokrsteski/pimf-framework
core/Pimf/Util/Character.php
Character.endsWith
public static function endsWith($haystack, $needle) { return $needle == substr($haystack, strlen($haystack) - strlen($needle)); }
php
public static function endsWith($haystack, $needle) { return $needle == substr($haystack, strlen($haystack) - strlen($needle)); }
[ "public", "static", "function", "endsWith", "(", "$", "haystack", ",", "$", "needle", ")", "{", "return", "$", "needle", "==", "substr", "(", "$", "haystack", ",", "strlen", "(", "$", "haystack", ")", "-", "strlen", "(", "$", "needle", ")", ")", ";", "}" ]
Determine if a given string ends with a given value. @param string $haystack @param string|array $needle @return bool
[ "Determine", "if", "a", "given", "string", "ends", "with", "a", "given", "value", "." ]
859aa7c8bb727b556c5e32224842af3cff33f18b
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character.php#L243-L246
226,383
crip-laravel/filesys
src/Services/ThumbService.php
ThumbService.resize
public function resize($pathToImage) { $file = $this->storage->get($pathToImage); $this->sizes->each(function ($size, $key) use ($pathToImage, $file) { $img = app(ImageManager::class)->make($file); $path = $this->createThumbPath($pathToImage, $key); switch ($size[2]) { case 'width': // resize the image to a width of $sizes[ 0 ] and constrain aspect ratio (auto height) $img->resize($size[0], null, function ($constraint) { $constraint->aspectRatio(); }); break; case 'height': // resize the image to a height of $sizes[ 1 ] and constrain aspect ratio (auto width) $img->resize(null, $size[1], function ($constraint) { $constraint->aspectRatio(); }); break; // 'resize' or any other fullbacks to this default: $img->fit($size[0], $size[1]); break; } $this->storage->put($path, $img->stream()->__toString()); }); }
php
public function resize($pathToImage) { $file = $this->storage->get($pathToImage); $this->sizes->each(function ($size, $key) use ($pathToImage, $file) { $img = app(ImageManager::class)->make($file); $path = $this->createThumbPath($pathToImage, $key); switch ($size[2]) { case 'width': // resize the image to a width of $sizes[ 0 ] and constrain aspect ratio (auto height) $img->resize($size[0], null, function ($constraint) { $constraint->aspectRatio(); }); break; case 'height': // resize the image to a height of $sizes[ 1 ] and constrain aspect ratio (auto width) $img->resize(null, $size[1], function ($constraint) { $constraint->aspectRatio(); }); break; // 'resize' or any other fullbacks to this default: $img->fit($size[0], $size[1]); break; } $this->storage->put($path, $img->stream()->__toString()); }); }
[ "public", "function", "resize", "(", "$", "pathToImage", ")", "{", "$", "file", "=", "$", "this", "->", "storage", "->", "get", "(", "$", "pathToImage", ")", ";", "$", "this", "->", "sizes", "->", "each", "(", "function", "(", "$", "size", ",", "$", "key", ")", "use", "(", "$", "pathToImage", ",", "$", "file", ")", "{", "$", "img", "=", "app", "(", "ImageManager", "::", "class", ")", "->", "make", "(", "$", "file", ")", ";", "$", "path", "=", "$", "this", "->", "createThumbPath", "(", "$", "pathToImage", ",", "$", "key", ")", ";", "switch", "(", "$", "size", "[", "2", "]", ")", "{", "case", "'width'", ":", "// resize the image to a width of $sizes[ 0 ] and constrain aspect ratio (auto height)", "$", "img", "->", "resize", "(", "$", "size", "[", "0", "]", ",", "null", ",", "function", "(", "$", "constraint", ")", "{", "$", "constraint", "->", "aspectRatio", "(", ")", ";", "}", ")", ";", "break", ";", "case", "'height'", ":", "// resize the image to a height of $sizes[ 1 ] and constrain aspect ratio (auto width)", "$", "img", "->", "resize", "(", "null", ",", "$", "size", "[", "1", "]", ",", "function", "(", "$", "constraint", ")", "{", "$", "constraint", "->", "aspectRatio", "(", ")", ";", "}", ")", ";", "break", ";", "// 'resize' or any other fullbacks to this", "default", ":", "$", "img", "->", "fit", "(", "$", "size", "[", "0", "]", ",", "$", "size", "[", "1", "]", ")", ";", "break", ";", "}", "$", "this", "->", "storage", "->", "put", "(", "$", "path", ",", "$", "img", "->", "stream", "(", ")", "->", "__toString", "(", ")", ")", ";", "}", ")", ";", "}" ]
Resize image to all configured sizes @param $pathToImage
[ "Resize", "image", "to", "all", "configured", "sizes" ]
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/ThumbService.php#L65-L94
226,384
crip-laravel/filesys
src/Services/ThumbService.php
ThumbService.rename
public function rename($pathToImage, $newName) { $this->sizes->keys()->each(function ($size) use ($pathToImage, $newName) { $existing = $this->createThumbPath($pathToImage, $size); list($path) = $this->getThumbPath($pathToImage, $size); if ($this->storage->exists($existing)) { $this->storage->move($existing, $path . '/' . $newName); } }); }
php
public function rename($pathToImage, $newName) { $this->sizes->keys()->each(function ($size) use ($pathToImage, $newName) { $existing = $this->createThumbPath($pathToImage, $size); list($path) = $this->getThumbPath($pathToImage, $size); if ($this->storage->exists($existing)) { $this->storage->move($existing, $path . '/' . $newName); } }); }
[ "public", "function", "rename", "(", "$", "pathToImage", ",", "$", "newName", ")", "{", "$", "this", "->", "sizes", "->", "keys", "(", ")", "->", "each", "(", "function", "(", "$", "size", ")", "use", "(", "$", "pathToImage", ",", "$", "newName", ")", "{", "$", "existing", "=", "$", "this", "->", "createThumbPath", "(", "$", "pathToImage", ",", "$", "size", ")", ";", "list", "(", "$", "path", ")", "=", "$", "this", "->", "getThumbPath", "(", "$", "pathToImage", ",", "$", "size", ")", ";", "if", "(", "$", "this", "->", "storage", "->", "exists", "(", "$", "existing", ")", ")", "{", "$", "this", "->", "storage", "->", "move", "(", "$", "existing", ",", "$", "path", ".", "'/'", ".", "$", "newName", ")", ";", "}", "}", ")", ";", "}" ]
Rename thumbs for a image. @param string $pathToImage @param string $newName
[ "Rename", "thumbs", "for", "a", "image", "." ]
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/ThumbService.php#L101-L111
226,385
crip-laravel/filesys
src/Services/ThumbService.php
ThumbService.delete
public function delete($pathToImage, $isDir = false) { $this->sizes->keys()->each(function ($size) use ($pathToImage, $isDir) { list($path, $name) = $this->getThumbPath($pathToImage, $size); $file = $path . '/' . $name; if ($this->storage->exists($file)) { if (!$isDir) { $this->storage->delete($file); } else { $this->storage->deleteDirectory($file); } } }); }
php
public function delete($pathToImage, $isDir = false) { $this->sizes->keys()->each(function ($size) use ($pathToImage, $isDir) { list($path, $name) = $this->getThumbPath($pathToImage, $size); $file = $path . '/' . $name; if ($this->storage->exists($file)) { if (!$isDir) { $this->storage->delete($file); } else { $this->storage->deleteDirectory($file); } } }); }
[ "public", "function", "delete", "(", "$", "pathToImage", ",", "$", "isDir", "=", "false", ")", "{", "$", "this", "->", "sizes", "->", "keys", "(", ")", "->", "each", "(", "function", "(", "$", "size", ")", "use", "(", "$", "pathToImage", ",", "$", "isDir", ")", "{", "list", "(", "$", "path", ",", "$", "name", ")", "=", "$", "this", "->", "getThumbPath", "(", "$", "pathToImage", ",", "$", "size", ")", ";", "$", "file", "=", "$", "path", ".", "'/'", ".", "$", "name", ";", "if", "(", "$", "this", "->", "storage", "->", "exists", "(", "$", "file", ")", ")", "{", "if", "(", "!", "$", "isDir", ")", "{", "$", "this", "->", "storage", "->", "delete", "(", "$", "file", ")", ";", "}", "else", "{", "$", "this", "->", "storage", "->", "deleteDirectory", "(", "$", "file", ")", ";", "}", "}", "}", ")", ";", "}" ]
Delete all thumbs of an image. @param string $pathToImage @param bool $isDir
[ "Delete", "all", "thumbs", "of", "an", "image", "." ]
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/ThumbService.php#L118-L131
226,386
crip-laravel/filesys
src/Services/ThumbService.php
ThumbService.createThumbPath
public function createThumbPath($originalFilePath, $thumbSizeIdentifier) { list($path, $file) = $this->getThumbPath($originalFilePath, $thumbSizeIdentifier); // Make sure dir exists for thumb $this->storage->makeDirectory($path, 0777, true, true); return $path . '/' . $file; }
php
public function createThumbPath($originalFilePath, $thumbSizeIdentifier) { list($path, $file) = $this->getThumbPath($originalFilePath, $thumbSizeIdentifier); // Make sure dir exists for thumb $this->storage->makeDirectory($path, 0777, true, true); return $path . '/' . $file; }
[ "public", "function", "createThumbPath", "(", "$", "originalFilePath", ",", "$", "thumbSizeIdentifier", ")", "{", "list", "(", "$", "path", ",", "$", "file", ")", "=", "$", "this", "->", "getThumbPath", "(", "$", "originalFilePath", ",", "$", "thumbSizeIdentifier", ")", ";", "// Make sure dir exists for thumb", "$", "this", "->", "storage", "->", "makeDirectory", "(", "$", "path", ",", "0777", ",", "true", ",", "true", ")", ";", "return", "$", "path", ".", "'/'", ".", "$", "file", ";", "}" ]
Create dir for thumb and return file path with this thumb prefix @param $originalFilePath @param $thumbSizeIdentifier @return string
[ "Create", "dir", "for", "thumb", "and", "return", "file", "path", "with", "this", "thumb", "prefix" ]
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/ThumbService.php#L139-L147
226,387
xinix-technology/bono
src/Bono/Middleware/SessionMiddleware.php
SessionMiddleware.call
public function call() { $defaultOptions = array( 'name' => 'BSESS', 'lifetime' => 0, 'path' => \URL::base('', false), 'domain' => '', 'secure' => false, 'httpOnly' => false, ); if (is_array($this->options)) { $this->options = array_merge($defaultOptions, $this->options); } else { $this->options = $defaultOptions; } $this->app->session = $this; if (!$this->app->config('session.preventSession')) { $this->start(); } $this->next->call(); }
php
public function call() { $defaultOptions = array( 'name' => 'BSESS', 'lifetime' => 0, 'path' => \URL::base('', false), 'domain' => '', 'secure' => false, 'httpOnly' => false, ); if (is_array($this->options)) { $this->options = array_merge($defaultOptions, $this->options); } else { $this->options = $defaultOptions; } $this->app->session = $this; if (!$this->app->config('session.preventSession')) { $this->start(); } $this->next->call(); }
[ "public", "function", "call", "(", ")", "{", "$", "defaultOptions", "=", "array", "(", "'name'", "=>", "'BSESS'", ",", "'lifetime'", "=>", "0", ",", "'path'", "=>", "\\", "URL", "::", "base", "(", "''", ",", "false", ")", ",", "'domain'", "=>", "''", ",", "'secure'", "=>", "false", ",", "'httpOnly'", "=>", "false", ",", ")", ";", "if", "(", "is_array", "(", "$", "this", "->", "options", ")", ")", "{", "$", "this", "->", "options", "=", "array_merge", "(", "$", "defaultOptions", ",", "$", "this", "->", "options", ")", ";", "}", "else", "{", "$", "this", "->", "options", "=", "$", "defaultOptions", ";", "}", "$", "this", "->", "app", "->", "session", "=", "$", "this", ";", "if", "(", "!", "$", "this", "->", "app", "->", "config", "(", "'session.preventSession'", ")", ")", "{", "$", "this", "->", "start", "(", ")", ";", "}", "$", "this", "->", "next", "->", "call", "(", ")", ";", "}" ]
Call method of SessionMiddleware @return void
[ "Call", "method", "of", "SessionMiddleware" ]
86c89f702dee2ab010767236c2c40b50cdc39c6e
https://github.com/xinix-technology/bono/blob/86c89f702dee2ab010767236c2c40b50cdc39c6e/src/Bono/Middleware/SessionMiddleware.php#L60-L83
226,388
Dachande663/PHP-PhantomJS
src/HybridLogic/PhantomJS/Runner.php
Runner.execute
public function execute($script) { // Escape $args = func_get_args(); $cmd = escapeshellcmd("{$this->bin} " . implode(' ', $args)); if($this->debug) $cmd .= ' 2>&1'; // Execute $result = shell_exec($cmd); if($this->debug) return $result; if($result === null) return false; // Return if(substr($result, 0, 1) !== '{') return $result; // not JSON $json = json_decode($result, $as_array = true); if($json === null) return false; return $json; }
php
public function execute($script) { // Escape $args = func_get_args(); $cmd = escapeshellcmd("{$this->bin} " . implode(' ', $args)); if($this->debug) $cmd .= ' 2>&1'; // Execute $result = shell_exec($cmd); if($this->debug) return $result; if($result === null) return false; // Return if(substr($result, 0, 1) !== '{') return $result; // not JSON $json = json_decode($result, $as_array = true); if($json === null) return false; return $json; }
[ "public", "function", "execute", "(", "$", "script", ")", "{", "// Escape", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "cmd", "=", "escapeshellcmd", "(", "\"{$this->bin} \"", ".", "implode", "(", "' '", ",", "$", "args", ")", ")", ";", "if", "(", "$", "this", "->", "debug", ")", "$", "cmd", ".=", "' 2>&1'", ";", "// Execute", "$", "result", "=", "shell_exec", "(", "$", "cmd", ")", ";", "if", "(", "$", "this", "->", "debug", ")", "return", "$", "result", ";", "if", "(", "$", "result", "===", "null", ")", "return", "false", ";", "// Return", "if", "(", "substr", "(", "$", "result", ",", "0", ",", "1", ")", "!==", "'{'", ")", "return", "$", "result", ";", "// not JSON", "$", "json", "=", "json_decode", "(", "$", "result", ",", "$", "as_array", "=", "true", ")", ";", "if", "(", "$", "json", "===", "null", ")", "return", "false", ";", "return", "$", "json", ";", "}" ]
Execute a given JS file This method should be called with the first argument being the JS file you wish to execute. Additional PhantomJS command line arguments can be passed through as function arguments e.g.: $command->execute('/path/to/my/script.js', 'arg1', 'arg2'[, ...]) The script tries to automatically decodde JSON objects if the first character returned is a left curly brace ({). If debug mode is enabled, this method will return the output of the command verbatim along with any errors printed out to the shell. Don't use this mode in production. @param string Script file @param string Arg, ... @return bool/array False of failure, JSON array on success
[ "Execute", "a", "given", "JS", "file" ]
011e507102309cc339544e9e996332915f2d2e1c
https://github.com/Dachande663/PHP-PhantomJS/blob/011e507102309cc339544e9e996332915f2d2e1c/src/HybridLogic/PhantomJS/Runner.php#L65-L83
226,389
phrest/api
src/Response/ResponseArray.php
ResponseArray.getResponseByKey
public function getResponseByKey($key) { return isset($this->responses[$key]) ? $this->responses[$key] : null; }
php
public function getResponseByKey($key) { return isset($this->responses[$key]) ? $this->responses[$key] : null; }
[ "public", "function", "getResponseByKey", "(", "$", "key", ")", "{", "return", "isset", "(", "$", "this", "->", "responses", "[", "$", "key", "]", ")", "?", "$", "this", "->", "responses", "[", "$", "key", "]", ":", "null", ";", "}" ]
Get a response by array key @param $key @return null|Response
[ "Get", "a", "response", "by", "array", "key" ]
271d604f332cbd3ef0dc8593ea0904fee0a42a84
https://github.com/phrest/api/blob/271d604f332cbd3ef0dc8593ea0904fee0a42a84/src/Response/ResponseArray.php#L69-L72
226,390
phrest/api
src/Response/ResponseArray.php
ResponseArray.getCount
public function getCount() { if (isset($this->meta->count)) { return $this->meta->count; } return $this->meta->count = count($this->responses); }
php
public function getCount() { if (isset($this->meta->count)) { return $this->meta->count; } return $this->meta->count = count($this->responses); }
[ "public", "function", "getCount", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "meta", "->", "count", ")", ")", "{", "return", "$", "this", "->", "meta", "->", "count", ";", "}", "return", "$", "this", "->", "meta", "->", "count", "=", "count", "(", "$", "this", "->", "responses", ")", ";", "}" ]
Get the count of responses Count the responses if not already set @return int
[ "Get", "the", "count", "of", "responses", "Count", "the", "responses", "if", "not", "already", "set" ]
271d604f332cbd3ef0dc8593ea0904fee0a42a84
https://github.com/phrest/api/blob/271d604f332cbd3ef0dc8593ea0904fee0a42a84/src/Response/ResponseArray.php#L94-L102
226,391
phrest/api
src/Exceptions/HandledException.php
HandledException.getResponseDescription
protected function getResponseDescription($code) { $codes = array( // Informational 1xx 100 => 'Continue', 101 => 'Switching Protocols', // Success 2xx 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', // Redirection 3xx 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', // 1.1 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', // 306 is deprecated but reserved 307 => 'Temporary Redirect', // Client Error 4xx 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', // Server Error 5xx 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 509 => 'Bandwidth Limit Exceeded' ); $result = (isset($codes[$code])) ? $codes[$code] : 'Unknown Status Code'; return $result; }
php
protected function getResponseDescription($code) { $codes = array( // Informational 1xx 100 => 'Continue', 101 => 'Switching Protocols', // Success 2xx 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', // Redirection 3xx 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', // 1.1 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', // 306 is deprecated but reserved 307 => 'Temporary Redirect', // Client Error 4xx 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', // Server Error 5xx 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 509 => 'Bandwidth Limit Exceeded' ); $result = (isset($codes[$code])) ? $codes[$code] : 'Unknown Status Code'; return $result; }
[ "protected", "function", "getResponseDescription", "(", "$", "code", ")", "{", "$", "codes", "=", "array", "(", "// Informational 1xx", "100", "=>", "'Continue'", ",", "101", "=>", "'Switching Protocols'", ",", "// Success 2xx", "200", "=>", "'OK'", ",", "201", "=>", "'Created'", ",", "202", "=>", "'Accepted'", ",", "203", "=>", "'Non-Authoritative Information'", ",", "204", "=>", "'No Content'", ",", "205", "=>", "'Reset Content'", ",", "206", "=>", "'Partial Content'", ",", "// Redirection 3xx", "300", "=>", "'Multiple Choices'", ",", "301", "=>", "'Moved Permanently'", ",", "302", "=>", "'Found'", ",", "// 1.1", "303", "=>", "'See Other'", ",", "304", "=>", "'Not Modified'", ",", "305", "=>", "'Use Proxy'", ",", "// 306 is deprecated but reserved", "307", "=>", "'Temporary Redirect'", ",", "// Client Error 4xx", "400", "=>", "'Bad Request'", ",", "401", "=>", "'Unauthorized'", ",", "402", "=>", "'Payment Required'", ",", "403", "=>", "'Forbidden'", ",", "404", "=>", "'Not Found'", ",", "405", "=>", "'Method Not Allowed'", ",", "406", "=>", "'Not Acceptable'", ",", "407", "=>", "'Proxy Authentication Required'", ",", "408", "=>", "'Request Timeout'", ",", "409", "=>", "'Conflict'", ",", "410", "=>", "'Gone'", ",", "411", "=>", "'Length Required'", ",", "412", "=>", "'Precondition Failed'", ",", "413", "=>", "'Request Entity Too Large'", ",", "414", "=>", "'Request-URI Too Long'", ",", "415", "=>", "'Unsupported Media Type'", ",", "416", "=>", "'Requested Range Not Satisfiable'", ",", "417", "=>", "'Expectation Failed'", ",", "// Server Error 5xx", "500", "=>", "'Internal Server Error'", ",", "501", "=>", "'Not Implemented'", ",", "502", "=>", "'Bad Gateway'", ",", "503", "=>", "'Service Unavailable'", ",", "504", "=>", "'Gateway Timeout'", ",", "505", "=>", "'HTTP Version Not Supported'", ",", "509", "=>", "'Bandwidth Limit Exceeded'", ")", ";", "$", "result", "=", "(", "isset", "(", "$", "codes", "[", "$", "code", "]", ")", ")", "?", "$", "codes", "[", "$", "code", "]", ":", "'Unknown Status Code'", ";", "return", "$", "result", ";", "}" ]
todo make use of this @param $code @return string
[ "todo", "make", "use", "of", "this" ]
271d604f332cbd3ef0dc8593ea0904fee0a42a84
https://github.com/phrest/api/blob/271d604f332cbd3ef0dc8593ea0904fee0a42a84/src/Exceptions/HandledException.php#L47-L103
226,392
michael-donat/php-vfs
src/VirtualFileSystem/Wrapper/FileHandler.php
FileHandler.write
public function write($data) { $content = $this->file->data(); $content = substr($content, 0, $this->position()); $content .= $data; $this->file->setData($content); $written = strlen($data); $this->offsetPosition($written); $this->file->setModificationTime(time()); $this->file->setChangeTime(time()); return $written; }
php
public function write($data) { $content = $this->file->data(); $content = substr($content, 0, $this->position()); $content .= $data; $this->file->setData($content); $written = strlen($data); $this->offsetPosition($written); $this->file->setModificationTime(time()); $this->file->setChangeTime(time()); return $written; }
[ "public", "function", "write", "(", "$", "data", ")", "{", "$", "content", "=", "$", "this", "->", "file", "->", "data", "(", ")", ";", "$", "content", "=", "substr", "(", "$", "content", ",", "0", ",", "$", "this", "->", "position", "(", ")", ")", ";", "$", "content", ".=", "$", "data", ";", "$", "this", "->", "file", "->", "setData", "(", "$", "content", ")", ";", "$", "written", "=", "strlen", "(", "$", "data", ")", ";", "$", "this", "->", "offsetPosition", "(", "$", "written", ")", ";", "$", "this", "->", "file", "->", "setModificationTime", "(", "time", "(", ")", ")", ";", "$", "this", "->", "file", "->", "setChangeTime", "(", "time", "(", ")", ")", ";", "return", "$", "written", ";", "}" ]
Writes data to file. Will return the number of bytes written. Will advance pointer by number of bytes written. @param string $data @return int
[ "Writes", "data", "to", "file", ".", "Will", "return", "the", "number", "of", "bytes", "written", ".", "Will", "advance", "pointer", "by", "number", "of", "bytes", "written", "." ]
1254b67ca6bdaccd9f305b0e1aea81f790b3fa67
https://github.com/michael-donat/php-vfs/blob/1254b67ca6bdaccd9f305b0e1aea81f790b3fa67/src/VirtualFileSystem/Wrapper/FileHandler.php#L63-L75
226,393
michael-donat/php-vfs
src/VirtualFileSystem/Wrapper/FileHandler.php
FileHandler.position
public function position($position = null) { return is_null($position) ? $this->position : $this->position = $position; }
php
public function position($position = null) { return is_null($position) ? $this->position : $this->position = $position; }
[ "public", "function", "position", "(", "$", "position", "=", "null", ")", "{", "return", "is_null", "(", "$", "position", ")", "?", "$", "this", "->", "position", ":", "$", "this", "->", "position", "=", "$", "position", ";", "}" ]
Returns current pointer position. @param integer|null $position @return int
[ "Returns", "current", "pointer", "position", "." ]
1254b67ca6bdaccd9f305b0e1aea81f790b3fa67
https://github.com/michael-donat/php-vfs/blob/1254b67ca6bdaccd9f305b0e1aea81f790b3fa67/src/VirtualFileSystem/Wrapper/FileHandler.php#L107-L110
226,394
michael-donat/php-vfs
src/VirtualFileSystem/Wrapper/FileHandler.php
FileHandler.truncate
public function truncate($newSize = 0) { $this->position(0); $newData = substr($this->file->data(), 0, $newSize); $newData = false === $newData ? '' : $newData; $this->file->setData($newData); $this->file->setModificationTime(time()); $this->file->setChangeTime(time()); return; }
php
public function truncate($newSize = 0) { $this->position(0); $newData = substr($this->file->data(), 0, $newSize); $newData = false === $newData ? '' : $newData; $this->file->setData($newData); $this->file->setModificationTime(time()); $this->file->setChangeTime(time()); return; }
[ "public", "function", "truncate", "(", "$", "newSize", "=", "0", ")", "{", "$", "this", "->", "position", "(", "0", ")", ";", "$", "newData", "=", "substr", "(", "$", "this", "->", "file", "->", "data", "(", ")", ",", "0", ",", "$", "newSize", ")", ";", "$", "newData", "=", "false", "===", "$", "newData", "?", "''", ":", "$", "newData", ";", "$", "this", "->", "file", "->", "setData", "(", "$", "newData", ")", ";", "$", "this", "->", "file", "->", "setModificationTime", "(", "time", "(", ")", ")", ";", "$", "this", "->", "file", "->", "setChangeTime", "(", "time", "(", ")", ")", ";", "return", ";", "}" ]
Removed all data from file and sets pointer to 0 @param int $newSize @return void
[ "Removed", "all", "data", "from", "file", "and", "sets", "pointer", "to", "0" ]
1254b67ca6bdaccd9f305b0e1aea81f790b3fa67
https://github.com/michael-donat/php-vfs/blob/1254b67ca6bdaccd9f305b0e1aea81f790b3fa67/src/VirtualFileSystem/Wrapper/FileHandler.php#L149-L159
226,395
Solution10/calendar
src/Resolution/WeekResolution.php
WeekResolution.build
public function build() { if ($this->currentDate === null) { return null; } return new Week($this->currentDate, $this->startDay); }
php
public function build() { if ($this->currentDate === null) { return null; } return new Week($this->currentDate, $this->startDay); }
[ "public", "function", "build", "(", ")", "{", "if", "(", "$", "this", "->", "currentDate", "===", "null", ")", "{", "return", "null", ";", "}", "return", "new", "Week", "(", "$", "this", "->", "currentDate", ",", "$", "this", "->", "startDay", ")", ";", "}" ]
Returns the data for this view. Could be anything! @return mixed
[ "Returns", "the", "data", "for", "this", "view", ".", "Could", "be", "anything!" ]
fa0d8e09627693a7b0fe0e6b69cab997bab919e8
https://github.com/Solution10/calendar/blob/fa0d8e09627693a7b0fe0e6b69cab997bab919e8/src/Resolution/WeekResolution.php#L91-L97
226,396
amranidev/ajaxis
src/Attributes/Attributes.php
Attributes.getAttributes
public function getAttributes() { //select all the Attributes from table $this->result = DB::select(DB::raw('show columns from `'.$this->table.'`;')); //delete the first element.(ignore the id section) unset($this->result[0]); //get result return $this->result; }
php
public function getAttributes() { //select all the Attributes from table $this->result = DB::select(DB::raw('show columns from `'.$this->table.'`;')); //delete the first element.(ignore the id section) unset($this->result[0]); //get result return $this->result; }
[ "public", "function", "getAttributes", "(", ")", "{", "//select all the Attributes from table", "$", "this", "->", "result", "=", "DB", "::", "select", "(", "DB", "::", "raw", "(", "'show columns from `'", ".", "$", "this", "->", "table", ".", "'`;'", ")", ")", ";", "//delete the first element.(ignore the id section)", "unset", "(", "$", "this", "->", "result", "[", "0", "]", ")", ";", "//get result", "return", "$", "this", "->", "result", ";", "}" ]
Get attributes from table.
[ "Get", "attributes", "from", "table", "." ]
0de3be2cc63cd953fb8a0efc44b6afc176f57ca4
https://github.com/amranidev/ajaxis/blob/0de3be2cc63cd953fb8a0efc44b6afc176f57ca4/src/Attributes/Attributes.php#L40-L48
226,397
QueenCityCodeFactory/CakeSoap
src/Network/CakeSoap.php
CakeSoap._parseConfig
protected function _parseConfig(array $options = []) { if (!class_exists('SoapClient')) { $this->handleError('Class SoapClient not found, please enable Soap extensions'); } $opts = [ 'http' => [ 'user_agent' => $this->getConfig('userAgent') ] ]; $opts += $options; $context = stream_context_create($opts); $config = [ 'trace' => $this->debug, 'stream_context' => $context, 'cache_wsdl' => WSDL_CACHE_NONE ]; if (!empty($this->getConfig('location'))) { $config['location'] = $this->getConfig('location'); } if (!empty($this->getConfig('uri'))) { $config['uri'] = $this->getConfig('uri'); } if (!empty($this->getConfig('login'))) { $config['login'] = $this->getConfig('login'); $config['password'] = $this->getConfig('password'); $config['authentication'] = $this->getConfig('authentication'); } if (!empty($this->getConfig('soap_version'))) { $config['soap_version'] = $this->getConfig('soap_version'); } return $config; }
php
protected function _parseConfig(array $options = []) { if (!class_exists('SoapClient')) { $this->handleError('Class SoapClient not found, please enable Soap extensions'); } $opts = [ 'http' => [ 'user_agent' => $this->getConfig('userAgent') ] ]; $opts += $options; $context = stream_context_create($opts); $config = [ 'trace' => $this->debug, 'stream_context' => $context, 'cache_wsdl' => WSDL_CACHE_NONE ]; if (!empty($this->getConfig('location'))) { $config['location'] = $this->getConfig('location'); } if (!empty($this->getConfig('uri'))) { $config['uri'] = $this->getConfig('uri'); } if (!empty($this->getConfig('login'))) { $config['login'] = $this->getConfig('login'); $config['password'] = $this->getConfig('password'); $config['authentication'] = $this->getConfig('authentication'); } if (!empty($this->getConfig('soap_version'))) { $config['soap_version'] = $this->getConfig('soap_version'); } return $config; }
[ "protected", "function", "_parseConfig", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "class_exists", "(", "'SoapClient'", ")", ")", "{", "$", "this", "->", "handleError", "(", "'Class SoapClient not found, please enable Soap extensions'", ")", ";", "}", "$", "opts", "=", "[", "'http'", "=>", "[", "'user_agent'", "=>", "$", "this", "->", "getConfig", "(", "'userAgent'", ")", "]", "]", ";", "$", "opts", "+=", "$", "options", ";", "$", "context", "=", "stream_context_create", "(", "$", "opts", ")", ";", "$", "config", "=", "[", "'trace'", "=>", "$", "this", "->", "debug", ",", "'stream_context'", "=>", "$", "context", ",", "'cache_wsdl'", "=>", "WSDL_CACHE_NONE", "]", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "getConfig", "(", "'location'", ")", ")", ")", "{", "$", "config", "[", "'location'", "]", "=", "$", "this", "->", "getConfig", "(", "'location'", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "this", "->", "getConfig", "(", "'uri'", ")", ")", ")", "{", "$", "config", "[", "'uri'", "]", "=", "$", "this", "->", "getConfig", "(", "'uri'", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "this", "->", "getConfig", "(", "'login'", ")", ")", ")", "{", "$", "config", "[", "'login'", "]", "=", "$", "this", "->", "getConfig", "(", "'login'", ")", ";", "$", "config", "[", "'password'", "]", "=", "$", "this", "->", "getConfig", "(", "'password'", ")", ";", "$", "config", "[", "'authentication'", "]", "=", "$", "this", "->", "getConfig", "(", "'authentication'", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "this", "->", "getConfig", "(", "'soap_version'", ")", ")", ")", "{", "$", "config", "[", "'soap_version'", "]", "=", "$", "this", "->", "getConfig", "(", "'soap_version'", ")", ";", "}", "return", "$", "config", ";", "}" ]
Setup Configuration options @param array $options The options @return array Configuration options
[ "Setup", "Configuration", "options" ]
587edc29d9e891fb6027805cd0cb30034dcadff1
https://github.com/QueenCityCodeFactory/CakeSoap/blob/587edc29d9e891fb6027805cd0cb30034dcadff1/src/Network/CakeSoap.php#L111-L147
226,398
QueenCityCodeFactory/CakeSoap
src/Network/CakeSoap.php
CakeSoap.connect
public function connect(array $options = []) { $config = $this->_parseConfig($options); try { $this->client = new SoapClient($this->getConfig('wsdl'), $config); } catch (SoapFault $fault) { $this->handleError($fault->faultstring); } if ($this->client) { $this->connected = true; } return $this->connected; }
php
public function connect(array $options = []) { $config = $this->_parseConfig($options); try { $this->client = new SoapClient($this->getConfig('wsdl'), $config); } catch (SoapFault $fault) { $this->handleError($fault->faultstring); } if ($this->client) { $this->connected = true; } return $this->connected; }
[ "public", "function", "connect", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "config", "=", "$", "this", "->", "_parseConfig", "(", "$", "options", ")", ";", "try", "{", "$", "this", "->", "client", "=", "new", "SoapClient", "(", "$", "this", "->", "getConfig", "(", "'wsdl'", ")", ",", "$", "config", ")", ";", "}", "catch", "(", "SoapFault", "$", "fault", ")", "{", "$", "this", "->", "handleError", "(", "$", "fault", "->", "faultstring", ")", ";", "}", "if", "(", "$", "this", "->", "client", ")", "{", "$", "this", "->", "connected", "=", "true", ";", "}", "return", "$", "this", "->", "connected", ";", "}" ]
Connects to the SOAP server using the WSDL in the configuration @param array $options The options @return bool True on success, false on failure
[ "Connects", "to", "the", "SOAP", "server", "using", "the", "WSDL", "in", "the", "configuration" ]
587edc29d9e891fb6027805cd0cb30034dcadff1
https://github.com/QueenCityCodeFactory/CakeSoap/blob/587edc29d9e891fb6027805cd0cb30034dcadff1/src/Network/CakeSoap.php#L155-L169
226,399
QueenCityCodeFactory/CakeSoap
src/Network/CakeSoap.php
CakeSoap.sendRequest
public function sendRequest($action, $data) { if (!$this->connected) { $this->connect(); } try { $result = $this->client->__soapCall($action, $data); } catch (SoapFault $fault) { $this->handleError($fault->faultstring); } return $result; }
php
public function sendRequest($action, $data) { if (!$this->connected) { $this->connect(); } try { $result = $this->client->__soapCall($action, $data); } catch (SoapFault $fault) { $this->handleError($fault->faultstring); } return $result; }
[ "public", "function", "sendRequest", "(", "$", "action", ",", "$", "data", ")", "{", "if", "(", "!", "$", "this", "->", "connected", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "}", "try", "{", "$", "result", "=", "$", "this", "->", "client", "->", "__soapCall", "(", "$", "action", ",", "$", "data", ")", ";", "}", "catch", "(", "SoapFault", "$", "fault", ")", "{", "$", "this", "->", "handleError", "(", "$", "fault", "->", "faultstring", ")", ";", "}", "return", "$", "result", ";", "}" ]
Query the SOAP server with the given method and parameters @param string $action The WSDL Action @param array $data The data array @return mixed Returns the result on success, false on failure
[ "Query", "the", "SOAP", "server", "with", "the", "given", "method", "and", "parameters" ]
587edc29d9e891fb6027805cd0cb30034dcadff1
https://github.com/QueenCityCodeFactory/CakeSoap/blob/587edc29d9e891fb6027805cd0cb30034dcadff1/src/Network/CakeSoap.php#L201-L213