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
229,500
gridonic/hapi
src/Harvest/Model/Range.php
Range.lastWeek
public static function lastWeek($timeZone = null, $startOfWeek = 0) { $now = null; $before = null; if ( is_null($timeZone) ) { $now = new \DateTime(); $before = new \DateTime(); } else { $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); } $dayOfWeek = (int) $now->format( "w" ); $offset = (($dayOfWeek - $startOfWeek ) + 7 ) % 7; $beginOffset = $offset + 7; $endOffset = $offset + 1; $before->modify( "-$beginOffset day" ); $now->modify( "-$endOffset day" ); $range = new Range( $before, $now ); return $range; }
php
public static function lastWeek($timeZone = null, $startOfWeek = 0) { $now = null; $before = null; if ( is_null($timeZone) ) { $now = new \DateTime(); $before = new \DateTime(); } else { $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); } $dayOfWeek = (int) $now->format( "w" ); $offset = (($dayOfWeek - $startOfWeek ) + 7 ) % 7; $beginOffset = $offset + 7; $endOffset = $offset + 1; $before->modify( "-$beginOffset day" ); $now->modify( "-$endOffset day" ); $range = new Range( $before, $now ); return $range; }
[ "public", "static", "function", "lastWeek", "(", "$", "timeZone", "=", "null", ",", "$", "startOfWeek", "=", "0", ")", "{", "$", "now", "=", "null", ";", "$", "before", "=", "null", ";", "if", "(", "is_null", "(", "$", "timeZone", ")", ")", "{", ...
return Range object set to last week <code> $range = Range::lastWeek( "EST", Range::MONDAY ); </code> @param string $timeZone User Time Zone @param int $startOfWeek Starting day of the week @return Range
[ "return", "Range", "object", "set", "to", "last", "week" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/Model/Range.php#L142-L162
229,501
gridonic/hapi
src/Harvest/Model/Range.php
Range.thisMonth
public static function thisMonth($timeZone = null) { $now = null; $before = null; if ( is_null($timeZone) ) { $now = new \DateTime(); $before = new \DateTime(); } else { $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); } $dayOfMonth = $now->format( "j" ); $offset = $dayOfMonth - 1; $before->modify( "-$offset day" ); $range = new Range( $before, $now ); return $range; }
php
public static function thisMonth($timeZone = null) { $now = null; $before = null; if ( is_null($timeZone) ) { $now = new \DateTime(); $before = new \DateTime(); } else { $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) ); } $dayOfMonth = $now->format( "j" ); $offset = $dayOfMonth - 1; $before->modify( "-$offset day" ); $range = new Range( $before, $now ); return $range; }
[ "public", "static", "function", "thisMonth", "(", "$", "timeZone", "=", "null", ")", "{", "$", "now", "=", "null", ";", "$", "before", "=", "null", ";", "if", "(", "is_null", "(", "$", "timeZone", ")", ")", "{", "$", "now", "=", "new", "\\", "Dat...
return Range object set to this month <code> $range = Range::thisMonth( "EST" ); </code> @param string $timeZone User Time Zone @return Range
[ "return", "Range", "object", "set", "to", "this", "month" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/Model/Range.php#L174-L191
229,502
rpnzl/arrch
src/Arrch/Arrch.php
Arrch.sort
public static function sort(array $data, $key, $order = null) { uasort($data, function ($a, $b) use ($key) { $a_val = Arrch::extractValues($a, $key); $b_val = Arrch::extractValues($b, $key); // Strings if (is_string($a_val) && is_string($b_val)) { return strcasecmp($a_val, $b_val); } else { if ($a_val == $b_val) { return 0; } else { return ($a_val > $b_val) ? 1 : -1; } } }); if (strtoupper($order ?: Arrch::$defaults['sort_order']) == 'DESC') { $data = array_reverse($data, true); } return $data; }
php
public static function sort(array $data, $key, $order = null) { uasort($data, function ($a, $b) use ($key) { $a_val = Arrch::extractValues($a, $key); $b_val = Arrch::extractValues($b, $key); // Strings if (is_string($a_val) && is_string($b_val)) { return strcasecmp($a_val, $b_val); } else { if ($a_val == $b_val) { return 0; } else { return ($a_val > $b_val) ? 1 : -1; } } }); if (strtoupper($order ?: Arrch::$defaults['sort_order']) == 'DESC') { $data = array_reverse($data, true); } return $data; }
[ "public", "static", "function", "sort", "(", "array", "$", "data", ",", "$", "key", ",", "$", "order", "=", "null", ")", "{", "uasort", "(", "$", "data", ",", "function", "(", "$", "a", ",", "$", "b", ")", "use", "(", "$", "key", ")", "{", "$...
Sorts an array of objects by the specified key. @param arr $data The array of objects or associative arrays to sort. @param str $key The object key or key path to use in sort evaluation. @param str $order ASC or DESC. @return arr The result array.
[ "Sorts", "an", "array", "of", "objects", "by", "the", "specified", "key", "." ]
994258bbefb7722243211654c4f78813312cd5ed
https://github.com/rpnzl/arrch/blob/994258bbefb7722243211654c4f78813312cd5ed/src/Arrch/Arrch.php#L84-L107
229,503
rpnzl/arrch
src/Arrch/Arrch.php
Arrch.where
public static function where(array $data, array $conditions = array()) { foreach ($conditions as $condition) { if (!is_array($condition)) { trigger_error('Condition '.var_export($condition, true).' must be an array!', E_USER_ERROR); } else { array_map(function ($item, $key) use (&$data, $condition) { $return = 0; $operator = array_key_exists(2, $condition) ? $condition[1] : '==='; $search_value = array_key_exists(2, $condition) ? $condition[2] : $condition[1]; if (is_array($condition[0])) { // array of keys if (is_array($search_value)) { // array of values foreach ($condition[0] as $prop) { $value = Arrch::extractValues($item, $prop); foreach ($search_value as $query_val) { $return += Arrch::compare(array($value, $operator, $query_val)) ? 1 : 0; } } } else { // single value foreach ($condition[0] as $prop) { $value = Arrch::extractValues($item, $prop); $return += Arrch::compare(array($value, $operator, $search_value)) ? 1 : 0; } } } elseif (is_array($search_value)) { // single key, array of query values $value = Arrch::extractValues($item, $condition[0]); $c = 0; foreach ($search_value as $query_val) { $c += Arrch::compare(array($value, $operator, $query_val)) ? 1 : 0; } // Negate options that don't pass all negative assertions if (in_array($operator, array('!==', '!=', '!~')) && $c < count($search_value)) { $c = 0; } $return += $c; } else { // single key, single value $value = Arrch::extractValues($item, $condition[0]); $return = Arrch::compare(array($value, $operator, $search_value)); } // Unset if (!$return) { unset($data[$key]); } }, $data, array_keys($data)); } } return $data; }
php
public static function where(array $data, array $conditions = array()) { foreach ($conditions as $condition) { if (!is_array($condition)) { trigger_error('Condition '.var_export($condition, true).' must be an array!', E_USER_ERROR); } else { array_map(function ($item, $key) use (&$data, $condition) { $return = 0; $operator = array_key_exists(2, $condition) ? $condition[1] : '==='; $search_value = array_key_exists(2, $condition) ? $condition[2] : $condition[1]; if (is_array($condition[0])) { // array of keys if (is_array($search_value)) { // array of values foreach ($condition[0] as $prop) { $value = Arrch::extractValues($item, $prop); foreach ($search_value as $query_val) { $return += Arrch::compare(array($value, $operator, $query_val)) ? 1 : 0; } } } else { // single value foreach ($condition[0] as $prop) { $value = Arrch::extractValues($item, $prop); $return += Arrch::compare(array($value, $operator, $search_value)) ? 1 : 0; } } } elseif (is_array($search_value)) { // single key, array of query values $value = Arrch::extractValues($item, $condition[0]); $c = 0; foreach ($search_value as $query_val) { $c += Arrch::compare(array($value, $operator, $query_val)) ? 1 : 0; } // Negate options that don't pass all negative assertions if (in_array($operator, array('!==', '!=', '!~')) && $c < count($search_value)) { $c = 0; } $return += $c; } else { // single key, single value $value = Arrch::extractValues($item, $condition[0]); $return = Arrch::compare(array($value, $operator, $search_value)); } // Unset if (!$return) { unset($data[$key]); } }, $data, array_keys($data)); } } return $data; }
[ "public", "static", "function", "where", "(", "array", "$", "data", ",", "array", "$", "conditions", "=", "array", "(", ")", ")", "{", "foreach", "(", "$", "conditions", "as", "$", "condition", ")", "{", "if", "(", "!", "is_array", "(", "$", "conditi...
Evaluates an object based on an array of conditions passed into the function, formatted like so... array('city', 'arlington'); array('city', '!=', 'arlington'); @param arr $data The array of objects or associative arrays to search. @param arr $conditions The conditions to evaluate against. @return arr The result array.
[ "Evaluates", "an", "object", "based", "on", "an", "array", "of", "conditions", "passed", "into", "the", "function", "formatted", "like", "so", "..." ]
994258bbefb7722243211654c4f78813312cd5ed
https://github.com/rpnzl/arrch/blob/994258bbefb7722243211654c4f78813312cd5ed/src/Arrch/Arrch.php#L120-L173
229,504
rpnzl/arrch
src/Arrch/Arrch.php
Arrch.extractValues
public static function extractValues($item, $key) { // Array of results $results = array(); // Cast as array if object $item = is_object($item) ? (array) $item : $item; // Array of keys $keys = strstr($key, static::$key_split) ? explode(static::$key_split, $key) : array($key); $keys = array_filter($keys); // Key count $key_count = count($keys); // key count > 0 if ($key_count > 0) { $curr_key = array_shift($keys); $arrayValues = array_values($item); $child = is_array($item) ? array_shift($arrayValues) : null; // it's an array if (is_array($item)) { // Clean non-ASCII keys foreach ($item as $k => $v) { $sanitized = preg_replace('/[^(\x20-\x7F)]*/','', $k); if ($sanitized !== $k) { $item[$sanitized] = $v; unset($item[$k]); } } // it has the keys if (array_key_exists($curr_key, $item)) { $results = array_merge($results, static::extractValues($item[$curr_key], implode(static::$key_split, $keys))); // else it's child has the key } elseif ((is_array($child) || is_object($child))) { if (array_key_exists($curr_key, $child)) { foreach ($item as $child) { $results = array_merge($results, static::extractValues($child, $key)); } } } } // no key } else { $results[] = $item; } return $results; }
php
public static function extractValues($item, $key) { // Array of results $results = array(); // Cast as array if object $item = is_object($item) ? (array) $item : $item; // Array of keys $keys = strstr($key, static::$key_split) ? explode(static::$key_split, $key) : array($key); $keys = array_filter($keys); // Key count $key_count = count($keys); // key count > 0 if ($key_count > 0) { $curr_key = array_shift($keys); $arrayValues = array_values($item); $child = is_array($item) ? array_shift($arrayValues) : null; // it's an array if (is_array($item)) { // Clean non-ASCII keys foreach ($item as $k => $v) { $sanitized = preg_replace('/[^(\x20-\x7F)]*/','', $k); if ($sanitized !== $k) { $item[$sanitized] = $v; unset($item[$k]); } } // it has the keys if (array_key_exists($curr_key, $item)) { $results = array_merge($results, static::extractValues($item[$curr_key], implode(static::$key_split, $keys))); // else it's child has the key } elseif ((is_array($child) || is_object($child))) { if (array_key_exists($curr_key, $child)) { foreach ($item as $child) { $results = array_merge($results, static::extractValues($child, $key)); } } } } // no key } else { $results[] = $item; } return $results; }
[ "public", "static", "function", "extractValues", "(", "$", "item", ",", "$", "key", ")", "{", "// Array of results", "$", "results", "=", "array", "(", ")", ";", "// Cast as array if object", "$", "item", "=", "is_object", "(", "$", "item", ")", "?", "(", ...
Finds the requested value in a multidimensional array or an object and returns it. @param mixed $item The item containing the value. @param str $key The key or key path to the desired value. @return mixed The found value or null.
[ "Finds", "the", "requested", "value", "in", "a", "multidimensional", "array", "or", "an", "object", "and", "returns", "it", "." ]
994258bbefb7722243211654c4f78813312cd5ed
https://github.com/rpnzl/arrch/blob/994258bbefb7722243211654c4f78813312cd5ed/src/Arrch/Arrch.php#L183-L234
229,505
rpnzl/arrch
src/Arrch/Arrch.php
Arrch.merge
public static function merge() { $args = func_get_args(); $where = array(); $options = array(); foreach ($args as $o) { $options = array_merge($options, $o); if (isset($o['where'])) { if (count($where) === 0) { $where = $o['where']; } else { foreach ($o['where'] as $oc) { $matches = 0; foreach ($where as $wc) { if ($oc == $wc) { $matches += 1; } } if ($matches === 0) { $where[] = $oc; } } } } } $options['where'] = $where; return $options; }
php
public static function merge() { $args = func_get_args(); $where = array(); $options = array(); foreach ($args as $o) { $options = array_merge($options, $o); if (isset($o['where'])) { if (count($where) === 0) { $where = $o['where']; } else { foreach ($o['where'] as $oc) { $matches = 0; foreach ($where as $wc) { if ($oc == $wc) { $matches += 1; } } if ($matches === 0) { $where[] = $oc; } } } } } $options['where'] = $where; return $options; }
[ "public", "static", "function", "merge", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "where", "=", "array", "(", ")", ";", "$", "options", "=", "array", "(", ")", ";", "foreach", "(", "$", "args", "as", "$", "o", ")", ...
Recursive array merge for options arrays to eliminate duplicates in a smart manner using a variable number of array arguments. @param arr Various options arrays. @return arr The merged array.
[ "Recursive", "array", "merge", "for", "options", "arrays", "to", "eliminate", "duplicates", "in", "a", "smart", "manner", "using", "a", "variable", "number", "of", "array", "arguments", "." ]
994258bbefb7722243211654c4f78813312cd5ed
https://github.com/rpnzl/arrch/blob/994258bbefb7722243211654c4f78813312cd5ed/src/Arrch/Arrch.php#L319-L346
229,506
thelia-modules/Paybox
Controller/PaymentController.php
PaymentController.sendPaymentNotification
protected function sendPaymentNotification($orderId, $orderReference, $paymentStatus, $payboxMessage) { $this->getMailer()->sendEmailToShopManagers( Paybox::NOTIFICATION_MESSAGE_NAME, [ 'order_ref' => $orderReference, 'order_id' => $orderId, 'paybox_payment_status' => $paymentStatus, 'paybox_message' => $payboxMessage ] ); }
php
protected function sendPaymentNotification($orderId, $orderReference, $paymentStatus, $payboxMessage) { $this->getMailer()->sendEmailToShopManagers( Paybox::NOTIFICATION_MESSAGE_NAME, [ 'order_ref' => $orderReference, 'order_id' => $orderId, 'paybox_payment_status' => $paymentStatus, 'paybox_message' => $payboxMessage ] ); }
[ "protected", "function", "sendPaymentNotification", "(", "$", "orderId", ",", "$", "orderReference", ",", "$", "paymentStatus", ",", "$", "payboxMessage", ")", "{", "$", "this", "->", "getMailer", "(", ")", "->", "sendEmailToShopManagers", "(", "Paybox", "::", ...
Send the payment notification email to the shop admin @param int $orderId @param string $orderReference @param string $paymentStatus @param string $payboxMessage
[ "Send", "the", "payment", "notification", "email", "to", "the", "shop", "admin" ]
08b9f4478ecbdb234fc373d6540010af34d2d87c
https://github.com/thelia-modules/Paybox/blob/08b9f4478ecbdb234fc373d6540010af34d2d87c/Controller/PaymentController.php#L75-L86
229,507
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Writer/CSV.php
PHPExcel_Writer_CSV._writeLine
private function _writeLine($pFileHandle = null, $pValues = null) { if (is_array($pValues)) { // No leading delimiter $writeDelimiter = false; // Build the line $line = ''; foreach ($pValues as $element) { // Escape enclosures $element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); // Add delimiter if ($writeDelimiter) { $line .= $this->_delimiter; } else { $writeDelimiter = true; } // Add enclosed string $line .= $this->_enclosure . $element . $this->_enclosure; } // Add line ending $line .= $this->_lineEnding; // Write to file fwrite($pFileHandle, $line); } else { throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer."); } }
php
private function _writeLine($pFileHandle = null, $pValues = null) { if (is_array($pValues)) { // No leading delimiter $writeDelimiter = false; // Build the line $line = ''; foreach ($pValues as $element) { // Escape enclosures $element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); // Add delimiter if ($writeDelimiter) { $line .= $this->_delimiter; } else { $writeDelimiter = true; } // Add enclosed string $line .= $this->_enclosure . $element . $this->_enclosure; } // Add line ending $line .= $this->_lineEnding; // Write to file fwrite($pFileHandle, $line); } else { throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer."); } }
[ "private", "function", "_writeLine", "(", "$", "pFileHandle", "=", "null", ",", "$", "pValues", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "pValues", ")", ")", "{", "// No leading delimiter", "$", "writeDelimiter", "=", "false", ";", "// Build...
Write line to CSV file @param mixed $pFileHandle PHP filehandle @param array $pValues Array containing values in a row @throws PHPExcel_Writer_Exception
[ "Write", "line", "to", "CSV", "file" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Writer/CSV.php#L277-L308
229,508
milesj/utility
Console/Command/BaseUpgradeShell.php
BaseUpgradeShell.to
public function to($version) { $this->out(sprintf('<success>Upgrading to %s...</success>', $version)); $schema = sprintf('%s/Config/Schema/Upgrade/%s.sql', CakePlugin::path($this->plugin), $version); if (!file_exists($schema)) { $this->err(sprintf('<error>Upgrade schema %s does not exist</error>', basename($schema))); return false; } // Trigger any migration changes $method = 'to_' . preg_replace('/[^0-9]+/', '', $version); if (method_exists($this, $method)) { call_user_func(array($this, $method)); } // Execute the schema if ($this->executeSchema($schema, false)) { $this->complete[] = $version; $this->out(sprintf('<success>Upgrade to %s complete</success>', $version)); $this->versions(); } return true; }
php
public function to($version) { $this->out(sprintf('<success>Upgrading to %s...</success>', $version)); $schema = sprintf('%s/Config/Schema/Upgrade/%s.sql', CakePlugin::path($this->plugin), $version); if (!file_exists($schema)) { $this->err(sprintf('<error>Upgrade schema %s does not exist</error>', basename($schema))); return false; } // Trigger any migration changes $method = 'to_' . preg_replace('/[^0-9]+/', '', $version); if (method_exists($this, $method)) { call_user_func(array($this, $method)); } // Execute the schema if ($this->executeSchema($schema, false)) { $this->complete[] = $version; $this->out(sprintf('<success>Upgrade to %s complete</success>', $version)); $this->versions(); } return true; }
[ "public", "function", "to", "(", "$", "version", ")", "{", "$", "this", "->", "out", "(", "sprintf", "(", "'<success>Upgrading to %s...</success>'", ",", "$", "version", ")", ")", ";", "$", "schema", "=", "sprintf", "(", "'%s/Config/Schema/Upgrade/%s.sql'", ",...
Upgrade to a specific version and trigger any migration callbacks. @param int $version @return bool
[ "Upgrade", "to", "a", "specific", "version", "and", "trigger", "any", "migration", "callbacks", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Console/Command/BaseUpgradeShell.php#L50-L76
229,509
milesj/utility
Console/Command/BaseUpgradeShell.php
BaseUpgradeShell.versions
public function versions() { $this->hr(1); $versions = array(); if ($this->versions) { foreach ($this->versions as $version => $title) { if (in_array($version, $this->complete)) { $this->out('[x] ' . $title); } else { $this->out(sprintf('[%s] <info>%s</info>', $version, $title)); $versions[] = $version; } } } else { $this->err('<error>No versions found</error>'); return; } $this->out('[E]xit'); $this->out(); $versions[] = 'E'; $answer = strtoupper($this->in('Which version do you want to upgrade to?', $versions)); if ($answer === 'E') { exit(); } $this->to($answer); }
php
public function versions() { $this->hr(1); $versions = array(); if ($this->versions) { foreach ($this->versions as $version => $title) { if (in_array($version, $this->complete)) { $this->out('[x] ' . $title); } else { $this->out(sprintf('[%s] <info>%s</info>', $version, $title)); $versions[] = $version; } } } else { $this->err('<error>No versions found</error>'); return; } $this->out('[E]xit'); $this->out(); $versions[] = 'E'; $answer = strtoupper($this->in('Which version do you want to upgrade to?', $versions)); if ($answer === 'E') { exit(); } $this->to($answer); }
[ "public", "function", "versions", "(", ")", "{", "$", "this", "->", "hr", "(", "1", ")", ";", "$", "versions", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "versions", ")", "{", "foreach", "(", "$", "this", "->", "versions", "as", ...
Output a list of available version to upgrade to.
[ "Output", "a", "list", "of", "available", "version", "to", "upgrade", "to", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Console/Command/BaseUpgradeShell.php#L81-L111
229,510
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readRecordData
private function _readRecordData($data, $pos, $len) { $data = substr($data, $pos, $len); // File not encrypted, or record before encryption start point if ($this->_encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->_encryptionStartPos) { return $data; } $recordData = ''; if ($this->_encryption == self::MS_BIFF_CRYPTO_RC4) { $oldBlock = floor($this->_rc4Pos / self::REKEY_BLOCK); $block = floor($pos / self::REKEY_BLOCK); $endBlock = floor(($pos + $len) / self::REKEY_BLOCK); // Spin an RC4 decryptor to the right spot. If we have a decryptor sitting // at a point earlier in the current block, re-use it as we can save some time. if ($block != $oldBlock || $pos < $this->_rc4Pos || !$this->_rc4Key) { $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); $step = $pos % self::REKEY_BLOCK; } else { $step = $pos - $this->_rc4Pos; } $this->_rc4Key->RC4(str_repeat("\0", $step)); // Decrypt record data (re-keying at the end of every block) while ($block != $endBlock) { $step = self::REKEY_BLOCK - ($pos % self::REKEY_BLOCK); $recordData .= $this->_rc4Key->RC4(substr($data, 0, $step)); $data = substr($data, $step); $pos += $step; $len -= $step; $block++; $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); } $recordData .= $this->_rc4Key->RC4(substr($data, 0, $len)); // Keep track of the position of this decryptor. // We'll try and re-use it later if we can to speed things up $this->_rc4Pos = $pos + $len; } elseif ($this->_encryption == self::MS_BIFF_CRYPTO_XOR) { throw new PHPExcel_Reader_Exception('XOr encryption not supported'); } return $recordData; }
php
private function _readRecordData($data, $pos, $len) { $data = substr($data, $pos, $len); // File not encrypted, or record before encryption start point if ($this->_encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->_encryptionStartPos) { return $data; } $recordData = ''; if ($this->_encryption == self::MS_BIFF_CRYPTO_RC4) { $oldBlock = floor($this->_rc4Pos / self::REKEY_BLOCK); $block = floor($pos / self::REKEY_BLOCK); $endBlock = floor(($pos + $len) / self::REKEY_BLOCK); // Spin an RC4 decryptor to the right spot. If we have a decryptor sitting // at a point earlier in the current block, re-use it as we can save some time. if ($block != $oldBlock || $pos < $this->_rc4Pos || !$this->_rc4Key) { $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); $step = $pos % self::REKEY_BLOCK; } else { $step = $pos - $this->_rc4Pos; } $this->_rc4Key->RC4(str_repeat("\0", $step)); // Decrypt record data (re-keying at the end of every block) while ($block != $endBlock) { $step = self::REKEY_BLOCK - ($pos % self::REKEY_BLOCK); $recordData .= $this->_rc4Key->RC4(substr($data, 0, $step)); $data = substr($data, $step); $pos += $step; $len -= $step; $block++; $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); } $recordData .= $this->_rc4Key->RC4(substr($data, 0, $len)); // Keep track of the position of this decryptor. // We'll try and re-use it later if we can to speed things up $this->_rc4Pos = $pos + $len; } elseif ($this->_encryption == self::MS_BIFF_CRYPTO_XOR) { throw new PHPExcel_Reader_Exception('XOr encryption not supported'); } return $recordData; }
[ "private", "function", "_readRecordData", "(", "$", "data", ",", "$", "pos", ",", "$", "len", ")", "{", "$", "data", "=", "substr", "(", "$", "data", ",", "$", "pos", ",", "$", "len", ")", ";", "// File not encrypted, or record before encryption start point\...
Read record data from stream, decrypting as required @param string $data Data stream to read from @param int $pos Position to start reading from @param int $length Record data length @return string Record data
[ "Read", "record", "data", "from", "stream", "decrypting", "as", "required" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L1105-L1151
229,511
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readHeader
private function _readHeader() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: var // realized that $recordData can be empty even when record exists if ($recordData) { if ($this->_version == self::XLS_BIFF8) { $string = self::_readUnicodeStringLong($recordData); } else { $string = $this->_readByteStringShort($recordData); } $this->_phpSheet->getHeaderFooter()->setOddHeader($string['value']); $this->_phpSheet->getHeaderFooter()->setEvenHeader($string['value']); } } }
php
private function _readHeader() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: var // realized that $recordData can be empty even when record exists if ($recordData) { if ($this->_version == self::XLS_BIFF8) { $string = self::_readUnicodeStringLong($recordData); } else { $string = $this->_readByteStringShort($recordData); } $this->_phpSheet->getHeaderFooter()->setOddHeader($string['value']); $this->_phpSheet->getHeaderFooter()->setEvenHeader($string['value']); } } }
[ "private", "function", "_readHeader", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", "("...
Read HEADER record
[ "Read", "HEADER", "record" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L3107-L3129
229,512
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readHcenter
private function _readHcenter() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally $isHorizontalCentered = (bool) self::_GetInt2d($recordData, 0); $this->_phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); } }
php
private function _readHcenter() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally $isHorizontalCentered = (bool) self::_GetInt2d($recordData, 0); $this->_phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); } }
[ "private", "function", "_readHcenter", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", "(...
Read HCENTER record
[ "Read", "HCENTER", "record" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L3162-L3176
229,513
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readPageSetup
private function _readPageSetup() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: 2; paper size $paperSize = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; scaling factor $scale = self::_GetInt2d($recordData, 2); // offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed $fitToWidth = self::_GetInt2d($recordData, 6); // offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed $fitToHeight = self::_GetInt2d($recordData, 8); // offset: 10; size: 2; option flags // bit: 1; mask: 0x0002; 0=landscape, 1=portrait $isPortrait = (0x0002 & self::_GetInt2d($recordData, 10)) >> 1; // bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init // when this bit is set, do not use flags for those properties $isNotInit = (0x0004 & self::_GetInt2d($recordData, 10)) >> 2; if (!$isNotInit) { $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); switch ($isPortrait) { case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; case 1: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; } $this->_phpSheet->getPageSetup()->setScale($scale, false); $this->_phpSheet->getPageSetup()->setFitToPage((bool) $this->_isFitToPages); $this->_phpSheet->getPageSetup()->setFitToWidth($fitToWidth, false); $this->_phpSheet->getPageSetup()->setFitToHeight($fitToHeight, false); } // offset: 16; size: 8; header margin (IEEE 754 floating-point value) $marginHeader = self::_extractNumber(substr($recordData, 16, 8)); $this->_phpSheet->getPageMargins()->setHeader($marginHeader); // offset: 24; size: 8; footer margin (IEEE 754 floating-point value) $marginFooter = self::_extractNumber(substr($recordData, 24, 8)); $this->_phpSheet->getPageMargins()->setFooter($marginFooter); } }
php
private function _readPageSetup() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: 2; paper size $paperSize = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; scaling factor $scale = self::_GetInt2d($recordData, 2); // offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed $fitToWidth = self::_GetInt2d($recordData, 6); // offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed $fitToHeight = self::_GetInt2d($recordData, 8); // offset: 10; size: 2; option flags // bit: 1; mask: 0x0002; 0=landscape, 1=portrait $isPortrait = (0x0002 & self::_GetInt2d($recordData, 10)) >> 1; // bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init // when this bit is set, do not use flags for those properties $isNotInit = (0x0004 & self::_GetInt2d($recordData, 10)) >> 2; if (!$isNotInit) { $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); switch ($isPortrait) { case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; case 1: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; } $this->_phpSheet->getPageSetup()->setScale($scale, false); $this->_phpSheet->getPageSetup()->setFitToPage((bool) $this->_isFitToPages); $this->_phpSheet->getPageSetup()->setFitToWidth($fitToWidth, false); $this->_phpSheet->getPageSetup()->setFitToHeight($fitToHeight, false); } // offset: 16; size: 8; header margin (IEEE 754 floating-point value) $marginHeader = self::_extractNumber(substr($recordData, 16, 8)); $this->_phpSheet->getPageMargins()->setHeader($marginHeader); // offset: 24; size: 8; footer margin (IEEE 754 floating-point value) $marginFooter = self::_extractNumber(substr($recordData, 24, 8)); $this->_phpSheet->getPageMargins()->setFooter($marginFooter); } }
[ "private", "function", "_readPageSetup", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", ...
Read PAGESETUP record
[ "Read", "PAGESETUP", "record" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L3274-L3325
229,514
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readMulRk
private function _readMulRk() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // offset: 0; size: 2; index to row $row = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; index to first column $colFirst = self::_GetInt2d($recordData, 2); // offset: var; size: 2; index to last column $colLast = self::_GetInt2d($recordData, $length - 2); $columns = $colLast - $colFirst + 1; // offset within record data $offset = 4; for ($i = 0; $i < $columns; ++$i) { $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { // offset: var; size: 2; index to XF record $xfIndex = self::_GetInt2d($recordData, $offset); // offset: var; size: 4; RK value $numValue = self::_GetIEEE754(self::_GetInt4d($recordData, $offset + 2)); $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); if (!$this->_readDataOnly) { // add style $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } // add cell value $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); } $offset += 6; } }
php
private function _readMulRk() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // offset: 0; size: 2; index to row $row = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; index to first column $colFirst = self::_GetInt2d($recordData, 2); // offset: var; size: 2; index to last column $colLast = self::_GetInt2d($recordData, $length - 2); $columns = $colLast - $colFirst + 1; // offset within record data $offset = 4; for ($i = 0; $i < $columns; ++$i) { $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { // offset: var; size: 2; index to XF record $xfIndex = self::_GetInt2d($recordData, $offset); // offset: var; size: 4; RK value $numValue = self::_GetIEEE754(self::_GetInt4d($recordData, $offset + 2)); $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); if (!$this->_readDataOnly) { // add style $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } // add cell value $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); } $offset += 6; } }
[ "private", "function", "_readMulRk", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", "(",...
Read MULRK record This record represents a cell range containing RK value cells. All cells are located in the same row. -- "OpenOffice.org's Documentation of the Microsoft Excel File Format"
[ "Read", "MULRK", "record", "This", "record", "represents", "a", "cell", "range", "containing", "RK", "value", "cells", ".", "All", "cells", "are", "located", "in", "the", "same", "row", "." ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L3693-L3737
229,515
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readBlank
private function _readBlank() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // offset: 0; size: 2; row index $row = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; col index $col = self::_GetInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($col); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { // offset: 4; size: 2; XF index $xfIndex = self::_GetInt2d($recordData, 4); // add style information if (!$this->_readDataOnly) { $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } } }
php
private function _readBlank() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // offset: 0; size: 2; row index $row = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; col index $col = self::_GetInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($col); // Read cell? if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { // offset: 4; size: 2; XF index $xfIndex = self::_GetInt2d($recordData, 4); // add style information if (!$this->_readDataOnly) { $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } } }
[ "private", "function", "_readBlank", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", "(",...
Read BLANK record
[ "Read", "BLANK", "record" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L4136-L4162
229,516
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readSelection
private function _readSelection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: 1; pane identifier $paneId = ord($recordData{0}); // offset: 1; size: 2; index to row of the active cell $r = self::_GetInt2d($recordData, 1); // offset: 3; size: 2; index to column of the active cell $c = self::_GetInt2d($recordData, 3); // offset: 5; size: 2; index into the following cell range list to the // entry that contains the active cell $index = self::_GetInt2d($recordData, 5); // offset: 7; size: var; cell range address list containing all selected cell ranges $data = substr($recordData, 7); $cellRangeAddressList = $this->_readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax $selectedCells = $cellRangeAddressList['cellRangeAddresses'][0]; // first row '1' + last row '16384' indicates that full column is selected (apparently also in BIFF8!) if (preg_match('/^([A-Z]+1\:[A-Z]+)16384$/', $selectedCells)) { $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)16384$/', '${1}1048576', $selectedCells); } // first row '1' + last row '65536' indicates that full column is selected if (preg_match('/^([A-Z]+1\:[A-Z]+)65536$/', $selectedCells)) { $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)65536$/', '${1}1048576', $selectedCells); } // first column 'A' + last column 'IV' indicates that full row is selected if (preg_match('/^(A[0-9]+\:)IV([0-9]+)$/', $selectedCells)) { $selectedCells = preg_replace('/^(A[0-9]+\:)IV([0-9]+)$/', '${1}XFD${2}', $selectedCells); } $this->_phpSheet->setSelectedCells($selectedCells); } }
php
private function _readSelection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if (!$this->_readDataOnly) { // offset: 0; size: 1; pane identifier $paneId = ord($recordData{0}); // offset: 1; size: 2; index to row of the active cell $r = self::_GetInt2d($recordData, 1); // offset: 3; size: 2; index to column of the active cell $c = self::_GetInt2d($recordData, 3); // offset: 5; size: 2; index into the following cell range list to the // entry that contains the active cell $index = self::_GetInt2d($recordData, 5); // offset: 7; size: var; cell range address list containing all selected cell ranges $data = substr($recordData, 7); $cellRangeAddressList = $this->_readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax $selectedCells = $cellRangeAddressList['cellRangeAddresses'][0]; // first row '1' + last row '16384' indicates that full column is selected (apparently also in BIFF8!) if (preg_match('/^([A-Z]+1\:[A-Z]+)16384$/', $selectedCells)) { $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)16384$/', '${1}1048576', $selectedCells); } // first row '1' + last row '65536' indicates that full column is selected if (preg_match('/^([A-Z]+1\:[A-Z]+)65536$/', $selectedCells)) { $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)65536$/', '${1}1048576', $selectedCells); } // first column 'A' + last column 'IV' indicates that full row is selected if (preg_match('/^(A[0-9]+\:)IV([0-9]+)$/', $selectedCells)) { $selectedCells = preg_replace('/^(A[0-9]+\:)IV([0-9]+)$/', '${1}XFD${2}', $selectedCells); } $this->_phpSheet->setSelectedCells($selectedCells); } }
[ "private", "function", "_readSelection", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", ...
Read SELECTION record. There is one such record for each pane in the sheet.
[ "Read", "SELECTION", "record", ".", "There", "is", "one", "such", "record", "for", "each", "pane", "in", "the", "sheet", "." ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L4384-L4429
229,517
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readRangeProtection
private function _readRangeProtection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // local pointer in record data $offset = 0; if (!$this->_readDataOnly) { $offset += 12; // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag $isf = self::_GetInt2d($recordData, 12); if ($isf != 2) { // we only read FEAT records of type 2 return; } $offset += 2; $offset += 5; // offset: 19; size: 2; count of ref ranges this feature is on $cref = self::_GetInt2d($recordData, 19); $offset += 2; $offset += 6; // offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record) $cellRanges = array(); for ($i = 0; $i < $cref; ++$i) { try { $cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); } catch (PHPExcel_Exception $e) { return; } $cellRanges[] = $cellRange; $offset += 8; } // offset: var; size: var; variable length of feature specific data $rgbFeat = substr($recordData, $offset); $offset += 4; // offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit) $wPassword = self::_GetInt4d($recordData, $offset); $offset += 4; // Apply range protection to sheet if ($cellRanges) { $this->_phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true); } } }
php
private function _readRangeProtection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // local pointer in record data $offset = 0; if (!$this->_readDataOnly) { $offset += 12; // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag $isf = self::_GetInt2d($recordData, 12); if ($isf != 2) { // we only read FEAT records of type 2 return; } $offset += 2; $offset += 5; // offset: 19; size: 2; count of ref ranges this feature is on $cref = self::_GetInt2d($recordData, 19); $offset += 2; $offset += 6; // offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record) $cellRanges = array(); for ($i = 0; $i < $cref; ++$i) { try { $cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); } catch (PHPExcel_Exception $e) { return; } $cellRanges[] = $cellRange; $offset += 8; } // offset: var; size: var; variable length of feature specific data $rgbFeat = substr($recordData, $offset); $offset += 4; // offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit) $wPassword = self::_GetInt4d($recordData, $offset); $offset += 4; // Apply range protection to sheet if ($cellRanges) { $this->_phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true); } } }
[ "private", "function", "_readRangeProtection", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordDat...
Read RANGEPROTECTION record Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification, where it is referred to as FEAT record
[ "Read", "RANGEPROTECTION", "record", "Reading", "of", "this", "record", "is", "based", "on", "Microsoft", "Office", "Excel", "97", "-", "2000", "Binary", "File", "Format", "Specification", "where", "it", "is", "referred", "to", "as", "FEAT", "record" ]
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L4974-L5029
229,518
fecshop/yii2-fec
lib/PHPExcel/PHPExcel/Reader/Excel5.php
PHPExcel_Reader_Excel5._readContinue
private function _readContinue() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // check if we are reading drawing data // this is in case a free CONTINUE record occurs in other circumstances we are unaware of if ($this->_drawingData == '') { // move stream pointer to next record $this->_pos += 4 + $length; return; } // check if record data is at least 4 bytes long, otherwise there is no chance this is MSODRAWING data if ($length < 4) { // move stream pointer to next record $this->_pos += 4 + $length; return; } // dirty check to see if CONTINUE record could be a camouflaged MSODRAWING record // look inside CONTINUE record to see if it looks like a part of an Escher stream // we know that Escher stream may be split at least at // 0xF003 MsofbtSpgrContainer // 0xF004 MsofbtSpContainer // 0xF00D MsofbtClientTextbox $validSplitPoints = array(0xF003, 0xF004, 0xF00D); // add identifiers if we find more $splitPoint = self::_GetInt2d($recordData, 2); if (in_array($splitPoint, $validSplitPoints)) { // get spliced record data (and move pointer to next record) $splicedRecordData = $this->_getSplicedRecordData(); $this->_drawingData .= $splicedRecordData['recordData']; return; } // move stream pointer to next record $this->_pos += 4 + $length; }
php
private function _readContinue() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // check if we are reading drawing data // this is in case a free CONTINUE record occurs in other circumstances we are unaware of if ($this->_drawingData == '') { // move stream pointer to next record $this->_pos += 4 + $length; return; } // check if record data is at least 4 bytes long, otherwise there is no chance this is MSODRAWING data if ($length < 4) { // move stream pointer to next record $this->_pos += 4 + $length; return; } // dirty check to see if CONTINUE record could be a camouflaged MSODRAWING record // look inside CONTINUE record to see if it looks like a part of an Escher stream // we know that Escher stream may be split at least at // 0xF003 MsofbtSpgrContainer // 0xF004 MsofbtSpContainer // 0xF00D MsofbtClientTextbox $validSplitPoints = array(0xF003, 0xF004, 0xF00D); // add identifiers if we find more $splitPoint = self::_GetInt2d($recordData, 2); if (in_array($splitPoint, $validSplitPoints)) { // get spliced record data (and move pointer to next record) $splicedRecordData = $this->_getSplicedRecordData(); $this->_drawingData .= $splicedRecordData['recordData']; return; } // move stream pointer to next record $this->_pos += 4 + $length; }
[ "private", "function", "_readContinue", "(", ")", "{", "$", "length", "=", "self", "::", "_GetInt2d", "(", "$", "this", "->", "_data", ",", "$", "this", "->", "_pos", "+", "2", ")", ";", "$", "recordData", "=", "$", "this", "->", "_readRecordData", "...
Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented. In this case, we must treat the CONTINUE record as a MSODRAWING record
[ "Read", "a", "free", "CONTINUE", "record", ".", "Free", "CONTINUE", "record", "may", "be", "a", "camouflaged", "MSODRAWING", "record", "When", "MSODRAWING", "data", "on", "a", "sheet", "exceeds", "8224", "bytes", "CONTINUE", "records", "are", "used", "instead"...
fda0e381f931bc503e493bec90185162109018e6
https://github.com/fecshop/yii2-fec/blob/fda0e381f931bc503e493bec90185162109018e6/lib/PHPExcel/PHPExcel/Reader/Excel5.php#L5118-L5160
229,519
fuelphp/common
src/Html.php
Html.tag
public static function tag($name, $attributes = array(), $content = null) { $tag = '<' . $name; $attributeString = static::arrayToAttributes($attributes); //Add the attribute string if needed if ( !empty($attributeString) ) { $tag .= ' ' . $attributeString; } //Work out how we are going to close the tag if ( is_null($content) ) { //No content for the tag so just close it. $tag .= '/>'; } else { $tag .= '>' . $content . '</' . $name . '>'; } return $tag; }
php
public static function tag($name, $attributes = array(), $content = null) { $tag = '<' . $name; $attributeString = static::arrayToAttributes($attributes); //Add the attribute string if needed if ( !empty($attributeString) ) { $tag .= ' ' . $attributeString; } //Work out how we are going to close the tag if ( is_null($content) ) { //No content for the tag so just close it. $tag .= '/>'; } else { $tag .= '>' . $content . '</' . $name . '>'; } return $tag; }
[ "public", "static", "function", "tag", "(", "$", "name", ",", "$", "attributes", "=", "array", "(", ")", ",", "$", "content", "=", "null", ")", "{", "$", "tag", "=", "'<'", ".", "$", "name", ";", "$", "attributeString", "=", "static", "::", "arrayT...
Returns a HTML tag @param string $name Name of the tag to render. (Eg, img, form, a...) @param array $attributes Any attributes to apply to the tag to render @param null|string $content If not set to null will create a tag of the form "&lt;name&lt;content&lt;/name&lt;". Otherwise will render as a single tag. @return string
[ "Returns", "a", "HTML", "tag" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Html.php#L31-L55
229,520
fuelphp/common
src/Html.php
Html.arrayToAttributes
public static function arrayToAttributes(array $attributes) { //Build a list of single attributes first $attributeList = array(); foreach ( $attributes as $key => $value ) { // If the value is not false add the attribute. This allows attributes to not be shown. if ( $value !== false ) { if ( is_string($key) ) { $attributeList[] = htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"'; } else { $attributeList[] = $value; } } } return implode(' ', $attributeList); }
php
public static function arrayToAttributes(array $attributes) { //Build a list of single attributes first $attributeList = array(); foreach ( $attributes as $key => $value ) { // If the value is not false add the attribute. This allows attributes to not be shown. if ( $value !== false ) { if ( is_string($key) ) { $attributeList[] = htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"'; } else { $attributeList[] = $value; } } } return implode(' ', $attributeList); }
[ "public", "static", "function", "arrayToAttributes", "(", "array", "$", "attributes", ")", "{", "//Build a list of single attributes first", "$", "attributeList", "=", "array", "(", ")", ";", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value...
Produces a string of html tag attributes from an array array('name' => 'test', 'foo' => 'bar') becomes: 'name="test" foo="bar"' @param array $attributes @return string
[ "Produces", "a", "string", "of", "html", "tag", "attributes", "from", "an", "array" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Html.php#L68-L90
229,521
hubzero/orcid-php
src/Http/Curl.php
Curl.setHeader
public function setHeader($header) { $headers = []; if (is_array($header)) { foreach ($header as $key => $value) { $headers[] = $key . ': ' . $value; } } else { $headers[] = $header; } $this->setOpt(CURLOPT_HTTPHEADER, $headers); return $this; }
php
public function setHeader($header) { $headers = []; if (is_array($header)) { foreach ($header as $key => $value) { $headers[] = $key . ': ' . $value; } } else { $headers[] = $header; } $this->setOpt(CURLOPT_HTTPHEADER, $headers); return $this; }
[ "public", "function", "setHeader", "(", "$", "header", ")", "{", "$", "headers", "=", "[", "]", ";", "if", "(", "is_array", "(", "$", "header", ")", ")", "{", "foreach", "(", "$", "header", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "...
Sets a header on the request @param string|array $header the header to set @return $this
[ "Sets", "a", "header", "on", "the", "request" ]
2b9a31bd3932af0e18d4b80029901c8ec84a0861
https://github.com/hubzero/orcid-php/blob/2b9a31bd3932af0e18d4b80029901c8ec84a0861/src/Http/Curl.php#L114-L129
229,522
joomla-framework/datetime
src/DateRange.php
DateRange.from
public static function from(Date $start, $amount) { return self::cast(DateTimeRange::from(new DateTime($start), $amount, new DateInterval('P1D'))); }
php
public static function from(Date $start, $amount) { return self::cast(DateTimeRange::from(new DateTime($start), $amount, new DateInterval('P1D'))); }
[ "public", "static", "function", "from", "(", "Date", "$", "start", ",", "$", "amount", ")", "{", "return", "self", "::", "cast", "(", "DateTimeRange", "::", "from", "(", "new", "DateTime", "(", "$", "start", ")", ",", "$", "amount", ",", "new", "Date...
Creates a DateRange object from the start date for the given amount of days. @param Date $start The start date. @param integer $amount The amount of dates included in a range. @return DateRange @since 2.0.0
[ "Creates", "a", "DateRange", "object", "from", "the", "start", "date", "for", "the", "given", "amount", "of", "days", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateRange.php#L49-L52
229,523
joomla-framework/datetime
src/DateRange.php
DateRange.to
public static function to(Date $end, $amount) { return self::cast(DateTimeRange::to(new DateTime($end), $amount, new DateInterval('P1D'))); }
php
public static function to(Date $end, $amount) { return self::cast(DateTimeRange::to(new DateTime($end), $amount, new DateInterval('P1D'))); }
[ "public", "static", "function", "to", "(", "Date", "$", "end", ",", "$", "amount", ")", "{", "return", "self", "::", "cast", "(", "DateTimeRange", "::", "to", "(", "new", "DateTime", "(", "$", "end", ")", ",", "$", "amount", ",", "new", "DateInterval...
Creates a DateRange object to the end date for the given amount of days. @param Date $end The end date. @param integer $amount The amount of dates included in a range. @return DateRange @since 2.0.0
[ "Creates", "a", "DateRange", "object", "to", "the", "end", "date", "for", "the", "given", "amount", "of", "days", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateRange.php#L64-L67
229,524
joomla-framework/datetime
src/DateRange.php
DateRange.cast
private static function cast(DateTimeRange $range) { $start = new Date($range->start()); $end = new Date($range->end()); return new DateRange($start, $end); }
php
private static function cast(DateTimeRange $range) { $start = new Date($range->start()); $end = new Date($range->end()); return new DateRange($start, $end); }
[ "private", "static", "function", "cast", "(", "DateTimeRange", "$", "range", ")", "{", "$", "start", "=", "new", "Date", "(", "$", "range", "->", "start", "(", ")", ")", ";", "$", "end", "=", "new", "Date", "(", "$", "range", "->", "end", "(", ")...
Casts an DateTimeRange object into DateRange. @param DateTimeRange $range A DateTimeRange object @return DateRange @since 2.0.0
[ "Casts", "an", "DateTimeRange", "object", "into", "DateRange", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateRange.php#L296-L302
229,525
fuelphp/common
src/Table/Row.php
Row.set
public function set($key, $value) { if ( !$value instanceof Cell ) { throw new \InvalidArgumentException('Only Cells can be added to Rows'); } parent::set($key, $value); }
php
public function set($key, $value) { if ( !$value instanceof Cell ) { throw new \InvalidArgumentException('Only Cells can be added to Rows'); } parent::set($key, $value); }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "$", "value", "instanceof", "Cell", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Only Cells can be added to Rows'", ")", ";", "}", "parent", ":...
Overrides the set method from DataContainer to ensure only Cells can be added @throws \InvalidArgumentException
[ "Overrides", "the", "set", "method", "from", "DataContainer", "to", "ensure", "only", "Cells", "can", "be", "added" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Table/Row.php#L39-L47
229,526
milesj/utility
Model/Behavior/SluggableBehavior.php
SluggableBehavior.beforeSave
public function beforeSave(Model $model, $options = array()) { $settings = $this->settings[$model->alias]; if (empty($model->data[$model->alias]) || empty($model->data[$model->alias][$settings['field']]) || !empty($model->data[$model->alias][$settings['slug']])) { return true; } else if ($model->id && !$settings['onUpdate']) { return true; } $slug = $model->data[$model->alias][$settings['field']]; if (method_exists($model, 'beforeSlug')) { $slug = $model->beforeSlug($slug, $this); } $slug = $this->slugify($model, $slug); if (method_exists($model, 'afterSlug')) { $slug = $model->afterSlug($slug, $this); } if (mb_strlen($slug) > ($settings['length'] - 3)) { $slug = mb_substr($slug, 0, ($settings['length'] - 3)); } if ($settings['unique']) { $slug = $this->_makeUnique($model, $slug); } $model->data[$model->alias][$settings['slug']] = $slug; return true; }
php
public function beforeSave(Model $model, $options = array()) { $settings = $this->settings[$model->alias]; if (empty($model->data[$model->alias]) || empty($model->data[$model->alias][$settings['field']]) || !empty($model->data[$model->alias][$settings['slug']])) { return true; } else if ($model->id && !$settings['onUpdate']) { return true; } $slug = $model->data[$model->alias][$settings['field']]; if (method_exists($model, 'beforeSlug')) { $slug = $model->beforeSlug($slug, $this); } $slug = $this->slugify($model, $slug); if (method_exists($model, 'afterSlug')) { $slug = $model->afterSlug($slug, $this); } if (mb_strlen($slug) > ($settings['length'] - 3)) { $slug = mb_substr($slug, 0, ($settings['length'] - 3)); } if ($settings['unique']) { $slug = $this->_makeUnique($model, $slug); } $model->data[$model->alias][$settings['slug']] = $slug; return true; }
[ "public", "function", "beforeSave", "(", "Model", "$", "model", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "settings", "=", "$", "this", "->", "settings", "[", "$", "model", "->", "alias", "]", ";", "if", "(", "empty", "(", "$", ...
Generate a slug based on another field. @param Model $model @param array $options @return bool
[ "Generate", "a", "slug", "based", "on", "another", "field", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Model/Behavior/SluggableBehavior.php#L66-L101
229,527
milesj/utility
Model/Behavior/SluggableBehavior.php
SluggableBehavior.slugExists
public function slugExists(Model $model, $slug) { return (bool) $model->find('count', array( 'conditions' => array($this->settings[$model->alias]['slug'] => $slug), 'recursive' => -1, 'contain' => false )); }
php
public function slugExists(Model $model, $slug) { return (bool) $model->find('count', array( 'conditions' => array($this->settings[$model->alias]['slug'] => $slug), 'recursive' => -1, 'contain' => false )); }
[ "public", "function", "slugExists", "(", "Model", "$", "model", ",", "$", "slug", ")", "{", "return", "(", "bool", ")", "$", "model", "->", "find", "(", "'count'", ",", "array", "(", "'conditions'", "=>", "array", "(", "$", "this", "->", "settings", ...
Helper function to check if a slug exists. @param Model $model @param string $slug @return bool
[ "Helper", "function", "to", "check", "if", "a", "slug", "exists", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Model/Behavior/SluggableBehavior.php#L126-L132
229,528
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.add
public function add($title, $url, array $options = array()) { $this->append($title, $url, $options); return $this; }
php
public function add($title, $url, array $options = array()) { $this->append($title, $url, $options); return $this; }
[ "public", "function", "add", "(", "$", "title", ",", "$", "url", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "append", "(", "$", "title", ",", "$", "url", ",", "$", "options", ")", ";", "return", "$", "thi...
Add a breadcrumb to the list. @param string $title @param string|array $url @param array $options @return BreadcrumbHelper
[ "Add", "a", "breadcrumb", "to", "the", "list", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L39-L43
229,529
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.append
public function append($title, $url, array $options = array()) { $this->_crumbs[] = array( 'title' => strip_tags($title), 'url' => $url, 'options' => $options ); $this->OpenGraph->title($this->pageTitle(null, array('reverse' => true))); $this->OpenGraph->uri($url); return $this; }
php
public function append($title, $url, array $options = array()) { $this->_crumbs[] = array( 'title' => strip_tags($title), 'url' => $url, 'options' => $options ); $this->OpenGraph->title($this->pageTitle(null, array('reverse' => true))); $this->OpenGraph->uri($url); return $this; }
[ "public", "function", "append", "(", "$", "title", ",", "$", "url", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "_crumbs", "[", "]", "=", "array", "(", "'title'", "=>", "strip_tags", "(", "$", "title", ")", ...
Add a breadcrumb to the end of the list. @param string $title @param string|array $url @param array $options @return BreadcrumbHelper
[ "Add", "a", "breadcrumb", "to", "the", "end", "of", "the", "list", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L53-L64
229,530
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.prepend
public function prepend($title, $url, array $options = array()) { array_unshift($this->_crumbs, array( 'title' => strip_tags($title), 'url' => $url, 'options' => $options )); $this->OpenGraph->title($this->pageTitle(null, array('reverse' => true))); $this->OpenGraph->uri($url); return $this; }
php
public function prepend($title, $url, array $options = array()) { array_unshift($this->_crumbs, array( 'title' => strip_tags($title), 'url' => $url, 'options' => $options )); $this->OpenGraph->title($this->pageTitle(null, array('reverse' => true))); $this->OpenGraph->uri($url); return $this; }
[ "public", "function", "prepend", "(", "$", "title", ",", "$", "url", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "array_unshift", "(", "$", "this", "->", "_crumbs", ",", "array", "(", "'title'", "=>", "strip_tags", "(", "$", "titl...
Add a breadcrumb to the beginning of the list. @param string $title @param string|array $url @param array $options @return BreadcrumbHelper
[ "Add", "a", "breadcrumb", "to", "the", "beginning", "of", "the", "list", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L74-L85
229,531
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.get
public function get($key = '') { if (!$key) { return $this->_crumbs; } $crumbs = array(); foreach ($this->_crumbs as $crumb) { $crumbs[] = isset($crumb[$key]) ? $crumb[$key] : null; } return $crumbs; }
php
public function get($key = '') { if (!$key) { return $this->_crumbs; } $crumbs = array(); foreach ($this->_crumbs as $crumb) { $crumbs[] = isset($crumb[$key]) ? $crumb[$key] : null; } return $crumbs; }
[ "public", "function", "get", "(", "$", "key", "=", "''", ")", "{", "if", "(", "!", "$", "key", ")", "{", "return", "$", "this", "->", "_crumbs", ";", "}", "$", "crumbs", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "_crumbs",...
Return the list of breadcrumbs. @param string $key @return array
[ "Return", "the", "list", "of", "breadcrumbs", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L93-L105
229,532
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.first
public function first($key = '') { $crumbs = $this->get($key); if (!$crumbs) { return null; } $first = array_slice($crumbs, 0, 1); return $first[0]; }
php
public function first($key = '') { $crumbs = $this->get($key); if (!$crumbs) { return null; } $first = array_slice($crumbs, 0, 1); return $first[0]; }
[ "public", "function", "first", "(", "$", "key", "=", "''", ")", "{", "$", "crumbs", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "$", "crumbs", ")", "{", "return", "null", ";", "}", "$", "first", "=", "array_slice",...
Return the first crumb in the list. @param string $key @return mixed
[ "Return", "the", "first", "crumb", "in", "the", "list", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L113-L123
229,533
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.last
public function last($key = '') { $crumbs = $this->get($key); if (!$crumbs) { return null; } $last = array_slice($crumbs, -1); return $last[0]; }
php
public function last($key = '') { $crumbs = $this->get($key); if (!$crumbs) { return null; } $last = array_slice($crumbs, -1); return $last[0]; }
[ "public", "function", "last", "(", "$", "key", "=", "''", ")", "{", "$", "crumbs", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "$", "crumbs", ")", "{", "return", "null", ";", "}", "$", "last", "=", "array_slice", ...
Return the last crumb in the list. @param string $key @return mixed
[ "Return", "the", "last", "crumb", "in", "the", "list", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L131-L141
229,534
milesj/utility
View/Helper/BreadcrumbHelper.php
BreadcrumbHelper.pageTitle
public function pageTitle($base = '', array $options = array()) { $options = $options + array( 'reverse' => false, 'depth' => 3, 'separator' => ' - ' ); $crumbs = $this->get('title'); $count = count($crumbs); $title = array(); if ($count) { if ($options['depth'] && $count > $options['depth']) { $title = array_slice($crumbs, -$options['depth']); array_unshift($title, array_shift($crumbs)); } else { $title = $crumbs; } } else if ($pageTitle = $this->_View->get('title_for_layout')) { $title[] = $pageTitle; } if ($options['reverse']) { $title = array_reverse($title); } if ($base) { array_unshift($title, $base); } return implode($options['separator'], array_unique($title)); }
php
public function pageTitle($base = '', array $options = array()) { $options = $options + array( 'reverse' => false, 'depth' => 3, 'separator' => ' - ' ); $crumbs = $this->get('title'); $count = count($crumbs); $title = array(); if ($count) { if ($options['depth'] && $count > $options['depth']) { $title = array_slice($crumbs, -$options['depth']); array_unshift($title, array_shift($crumbs)); } else { $title = $crumbs; } } else if ($pageTitle = $this->_View->get('title_for_layout')) { $title[] = $pageTitle; } if ($options['reverse']) { $title = array_reverse($title); } if ($base) { array_unshift($title, $base); } return implode($options['separator'], array_unique($title)); }
[ "public", "function", "pageTitle", "(", "$", "base", "=", "''", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "=", "$", "options", "+", "array", "(", "'reverse'", "=>", "false", ",", "'depth'", "=>", "3", ",", "'se...
Generate a page title based off the current crumbs. @param string $base @param array $options @return string
[ "Generate", "a", "page", "title", "based", "off", "the", "current", "crumbs", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/View/Helper/BreadcrumbHelper.php#L150-L183
229,535
milesj/utility
Model/Aggregator.php
Aggregator.find
public function find($type = 'first', $query = array()) { $query = $query + array( 'fields' => array(), 'order' => array('date' => 'ASC'), 'limit' => 20, 'feed' => array( 'root' => '', 'cache' => false, 'expires' => '+1 hour' ) ); return parent::find($type, $query); }
php
public function find($type = 'first', $query = array()) { $query = $query + array( 'fields' => array(), 'order' => array('date' => 'ASC'), 'limit' => 20, 'feed' => array( 'root' => '', 'cache' => false, 'expires' => '+1 hour' ) ); return parent::find($type, $query); }
[ "public", "function", "find", "(", "$", "type", "=", "'first'", ",", "$", "query", "=", "array", "(", ")", ")", "{", "$", "query", "=", "$", "query", "+", "array", "(", "'fields'", "=>", "array", "(", ")", ",", "'order'", "=>", "array", "(", "'da...
Overwrite the find method to be specific for feed aggregation. Set the default settings and prepare the URLs. @param string $type @param array $query @return array
[ "Overwrite", "the", "find", "method", "to", "be", "specific", "for", "feed", "aggregation", ".", "Set", "the", "default", "settings", "and", "prepare", "the", "URLs", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Model/Aggregator.php#L37-L50
229,536
milesj/utility
Model/Aggregator.php
Aggregator.afterFind
public function afterFind($results = array(), $primary = false) { if ($results) { foreach ($results as &$result) { if (isset($result['date'])) { if ($time = DateTime::createFromFormat(DateTime::RFC822, $result['date'] . 'C')) { $result['date'] = $time->format('Y-m-d H:i:s'); } } } } return $results; }
php
public function afterFind($results = array(), $primary = false) { if ($results) { foreach ($results as &$result) { if (isset($result['date'])) { if ($time = DateTime::createFromFormat(DateTime::RFC822, $result['date'] . 'C')) { $result['date'] = $time->format('Y-m-d H:i:s'); } } } } return $results; }
[ "public", "function", "afterFind", "(", "$", "results", "=", "array", "(", ")", ",", "$", "primary", "=", "false", ")", "{", "if", "(", "$", "results", ")", "{", "foreach", "(", "$", "results", "as", "&", "$", "result", ")", "{", "if", "(", "isse...
Format the date a certain way. @param array $results @param bool $primary @return array
[ "Format", "the", "date", "a", "certain", "way", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Model/Aggregator.php#L59-L71
229,537
joomla-framework/datetime
src/Strategy/DateTimeStrategy.php
DateTimeStrategy.startOfWeek
public function startOfWeek(\DateTime $datetime) { $diffInDays = intval($datetime->format('N')) - 1; $intervalSpec = sprintf('P%sD', $diffInDays); $datetime->sub(new \DateInterval($intervalSpec)); }
php
public function startOfWeek(\DateTime $datetime) { $diffInDays = intval($datetime->format('N')) - 1; $intervalSpec = sprintf('P%sD', $diffInDays); $datetime->sub(new \DateInterval($intervalSpec)); }
[ "public", "function", "startOfWeek", "(", "\\", "DateTime", "$", "datetime", ")", "{", "$", "diffInDays", "=", "intval", "(", "$", "datetime", "->", "format", "(", "'N'", ")", ")", "-", "1", ";", "$", "intervalSpec", "=", "sprintf", "(", "'P%sD'", ",",...
Sets time for the start of a week. @param \DateTime $datetime The DateTime object. @return void @since 2.0.0
[ "Sets", "time", "for", "the", "start", "of", "a", "week", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/Strategy/DateTimeStrategy.php#L55-L61
229,538
joomla-framework/datetime
src/Strategy/DateTimeStrategy.php
DateTimeStrategy.endOfWeek
public function endOfWeek(\DateTime $datetime) { $diffInDays = 7 - intval($datetime->format('N')); $intervalSpec = sprintf('P%sD', $diffInDays); $datetime->add(new \DateInterval($intervalSpec)); }
php
public function endOfWeek(\DateTime $datetime) { $diffInDays = 7 - intval($datetime->format('N')); $intervalSpec = sprintf('P%sD', $diffInDays); $datetime->add(new \DateInterval($intervalSpec)); }
[ "public", "function", "endOfWeek", "(", "\\", "DateTime", "$", "datetime", ")", "{", "$", "diffInDays", "=", "7", "-", "intval", "(", "$", "datetime", "->", "format", "(", "'N'", ")", ")", ";", "$", "intervalSpec", "=", "sprintf", "(", "'P%sD'", ",", ...
Sets time for the end of a week. @param \DateTime $datetime The DateTime object. @return void @since 2.0.0
[ "Sets", "time", "for", "the", "end", "of", "a", "week", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/Strategy/DateTimeStrategy.php#L72-L78
229,539
joomla-framework/datetime
src/Strategy/DateTimeStrategy.php
DateTimeStrategy.startOfMonth
public function startOfMonth(\DateTime $datetime) { $year = $datetime->format('Y'); $month = $datetime->format('m'); $datetime->setDate($year, $month, 1); }
php
public function startOfMonth(\DateTime $datetime) { $year = $datetime->format('Y'); $month = $datetime->format('m'); $datetime->setDate($year, $month, 1); }
[ "public", "function", "startOfMonth", "(", "\\", "DateTime", "$", "datetime", ")", "{", "$", "year", "=", "$", "datetime", "->", "format", "(", "'Y'", ")", ";", "$", "month", "=", "$", "datetime", "->", "format", "(", "'m'", ")", ";", "$", "datetime"...
Sets time for the start of a month. @param \DateTime $datetime The DateTime object. @return void @since 2.0.0
[ "Sets", "time", "for", "the", "start", "of", "a", "month", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/Strategy/DateTimeStrategy.php#L89-L95
229,540
joomla-framework/datetime
src/Strategy/DateTimeStrategy.php
DateTimeStrategy.endOfMonth
public function endOfMonth(\DateTime $datetime) { $year = $datetime->format('Y'); $month = $datetime->format('m'); $day = $datetime->format('t'); $datetime->setDate($year, $month, $day); }
php
public function endOfMonth(\DateTime $datetime) { $year = $datetime->format('Y'); $month = $datetime->format('m'); $day = $datetime->format('t'); $datetime->setDate($year, $month, $day); }
[ "public", "function", "endOfMonth", "(", "\\", "DateTime", "$", "datetime", ")", "{", "$", "year", "=", "$", "datetime", "->", "format", "(", "'Y'", ")", ";", "$", "month", "=", "$", "datetime", "->", "format", "(", "'m'", ")", ";", "$", "day", "="...
Sets time for the end of a month. @param \DateTime $datetime The DateTime object. @return void @since 2.0.0
[ "Sets", "time", "for", "the", "end", "of", "a", "month", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/Strategy/DateTimeStrategy.php#L106-L113
229,541
joomla-framework/datetime
src/DateTime.php
DateTime.createFromFormat
public static function createFromFormat($format, $time, \DateTimeZone $timezone = null) { $datetime = is_null($timezone) ? \DateTime::createFromFormat($format, $time) : \DateTime::createFromFormat($format, $time, $timezone); return new static($datetime); }
php
public static function createFromFormat($format, $time, \DateTimeZone $timezone = null) { $datetime = is_null($timezone) ? \DateTime::createFromFormat($format, $time) : \DateTime::createFromFormat($format, $time, $timezone); return new static($datetime); }
[ "public", "static", "function", "createFromFormat", "(", "$", "format", ",", "$", "time", ",", "\\", "DateTimeZone", "$", "timezone", "=", "null", ")", "{", "$", "datetime", "=", "is_null", "(", "$", "timezone", ")", "?", "\\", "DateTime", "::", "createF...
Creates a DateTime object from the given format. @param string $format Format accepted by date(). @param string $time String representing the time. @param \DateTimeZone $timezone The timezone. @return DateTime @since 2.0.0
[ "Creates", "a", "DateTime", "object", "from", "the", "given", "format", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L135-L140
229,542
joomla-framework/datetime
src/DateTime.php
DateTime.create
public static function create($year, $month = '01', $day = '01', $hour = '00', $minute = '00', $second = '00', \DateTimeZone $timezone = null) { $time = sprintf('%04s-%02s-%02s %02s:%02s:%02s', $year, $month, $day, $hour, $minute, $second); return static::createFromFormat('Y-m-d H:i:s', $time, $timezone); }
php
public static function create($year, $month = '01', $day = '01', $hour = '00', $minute = '00', $second = '00', \DateTimeZone $timezone = null) { $time = sprintf('%04s-%02s-%02s %02s:%02s:%02s', $year, $month, $day, $hour, $minute, $second); return static::createFromFormat('Y-m-d H:i:s', $time, $timezone); }
[ "public", "static", "function", "create", "(", "$", "year", ",", "$", "month", "=", "'01'", ",", "$", "day", "=", "'01'", ",", "$", "hour", "=", "'00'", ",", "$", "minute", "=", "'00'", ",", "$", "second", "=", "'00'", ",", "\\", "DateTimeZone", ...
Creates a DateTime object. @param integer $year The year. @param integer $month The month. @param integer $day The day of the month. @param integer $hour The hour. @param integer $minute The minute. @param integer $second The second. @param \DateTimeZone $timezone The timezone. @return DateTime @since 2.0.0
[ "Creates", "a", "DateTime", "object", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L157-L162
229,543
joomla-framework/datetime
src/DateTime.php
DateTime.createFromDate
public static function createFromDate($year, $month = '01', $day = '01', \DateTimeZone $timezone = null) { return static::create($year, $month, $day, '00', '00', '00', $timezone); }
php
public static function createFromDate($year, $month = '01', $day = '01', \DateTimeZone $timezone = null) { return static::create($year, $month, $day, '00', '00', '00', $timezone); }
[ "public", "static", "function", "createFromDate", "(", "$", "year", ",", "$", "month", "=", "'01'", ",", "$", "day", "=", "'01'", ",", "\\", "DateTimeZone", "$", "timezone", "=", "null", ")", "{", "return", "static", "::", "create", "(", "$", "year", ...
Creates a DateTime object with time of the midnight. @param integer $year The year. @param integer $month The month. @param integer $day The day of the month. @param \DateTimeZone $timezone The timezone. @return DateTime @since 2.0.0
[ "Creates", "a", "DateTime", "object", "with", "time", "of", "the", "midnight", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L176-L179
229,544
joomla-framework/datetime
src/DateTime.php
DateTime.createFromTime
public static function createFromTime($hour = '00', $minute = '00', $second = '00', \DateTimeZone $timezone = null) { return static::create(date('Y'), date('m'), date('d'), $hour, $minute, $second, $timezone); }
php
public static function createFromTime($hour = '00', $minute = '00', $second = '00', \DateTimeZone $timezone = null) { return static::create(date('Y'), date('m'), date('d'), $hour, $minute, $second, $timezone); }
[ "public", "static", "function", "createFromTime", "(", "$", "hour", "=", "'00'", ",", "$", "minute", "=", "'00'", ",", "$", "second", "=", "'00'", ",", "\\", "DateTimeZone", "$", "timezone", "=", "null", ")", "{", "return", "static", "::", "create", "(...
Creates a DateTime object with date of today. @param integer $hour The hour. @param integer $minute The minute. @param integer $second The second. @param \DateTimeZone $timezone The timezone. @return DateTime @since 2.0.0
[ "Creates", "a", "DateTime", "object", "with", "date", "of", "today", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L193-L196
229,545
joomla-framework/datetime
src/DateTime.php
DateTime.add
public function add(DateInterval $interval) { return $this->modify( function (\DateTime $datetime) use ($interval) { $datetime->add($interval->getDateInterval()); } ); }
php
public function add(DateInterval $interval) { return $this->modify( function (\DateTime $datetime) use ($interval) { $datetime->add($interval->getDateInterval()); } ); }
[ "public", "function", "add", "(", "DateInterval", "$", "interval", ")", "{", "return", "$", "this", "->", "modify", "(", "function", "(", "\\", "DateTime", "$", "datetime", ")", "use", "(", "$", "interval", ")", "{", "$", "datetime", "->", "add", "(", ...
Returns a new DateTime object by adding an interval to the current one. @param DateInterval $interval The interval to be added. @return DateTime @since 2.0.0
[ "Returns", "a", "new", "DateTime", "object", "by", "adding", "an", "interval", "to", "the", "current", "one", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L324-L332
229,546
joomla-framework/datetime
src/DateTime.php
DateTime.sub
public function sub(DateInterval $interval) { return $this->modify( function (\DateTime $datetime) use ($interval) { $datetime->sub($interval->getDateInterval()); } ); }
php
public function sub(DateInterval $interval) { return $this->modify( function (\DateTime $datetime) use ($interval) { $datetime->sub($interval->getDateInterval()); } ); }
[ "public", "function", "sub", "(", "DateInterval", "$", "interval", ")", "{", "return", "$", "this", "->", "modify", "(", "function", "(", "\\", "DateTime", "$", "datetime", ")", "use", "(", "$", "interval", ")", "{", "$", "datetime", "->", "sub", "(", ...
Returns a new DateTime object by subtracting an interval from the current one. @param DateInterval $interval The interval to be subtracted. @return DateTime @since 2.0.0
[ "Returns", "a", "new", "DateTime", "object", "by", "subtracting", "an", "interval", "from", "the", "current", "one", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L343-L351
229,547
joomla-framework/datetime
src/DateTime.php
DateTime.getStrategy
protected function getStrategy() { if (is_null($this->strategy)) { $this->strategy = new Strategy\DateTimeStrategy; } return $this->strategy; }
php
protected function getStrategy() { if (is_null($this->strategy)) { $this->strategy = new Strategy\DateTimeStrategy; } return $this->strategy; }
[ "protected", "function", "getStrategy", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "strategy", ")", ")", "{", "$", "this", "->", "strategy", "=", "new", "Strategy", "\\", "DateTimeStrategy", ";", "}", "return", "$", "this", "->", "str...
Gets the Strategy implementation. @return Strategy\StrategyInterface @since 2.0.0
[ "Gets", "the", "Strategy", "implementation", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L931-L939
229,548
joomla-framework/datetime
src/DateTime.php
DateTime.calc
private function calc($value, $format) { $value = intval($value); $spec = sprintf($format, abs($value)); return $value > 0 ? $this->add(new DateInterval($spec)) : $this->sub(new DateInterval($spec)); }
php
private function calc($value, $format) { $value = intval($value); $spec = sprintf($format, abs($value)); return $value > 0 ? $this->add(new DateInterval($spec)) : $this->sub(new DateInterval($spec)); }
[ "private", "function", "calc", "(", "$", "value", ",", "$", "format", ")", "{", "$", "value", "=", "intval", "(", "$", "value", ")", ";", "$", "spec", "=", "sprintf", "(", "$", "format", ",", "abs", "(", "$", "value", ")", ")", ";", "return", "...
Creates a DateTime by adding or subtacting interval. @param integer $value The value for the format. @param string $format The interval_spec for sprintf(), eg. 'P%sD'. @return DateTime @since 2.0.0
[ "Creates", "a", "DateTime", "by", "adding", "or", "subtacting", "interval", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L951-L957
229,549
joomla-framework/datetime
src/DateTime.php
DateTime.fixMonth
private function fixMonth(DateTime $result) { if ($result->format('d') != $this->format('d')) { $result = $result->subMonths(1); $result->datetime->setDate($result->format('Y'), $result->format('m'), $result->format('t')); } return $result; }
php
private function fixMonth(DateTime $result) { if ($result->format('d') != $this->format('d')) { $result = $result->subMonths(1); $result->datetime->setDate($result->format('Y'), $result->format('m'), $result->format('t')); } return $result; }
[ "private", "function", "fixMonth", "(", "DateTime", "$", "result", ")", "{", "if", "(", "$", "result", "->", "format", "(", "'d'", ")", "!=", "$", "this", "->", "format", "(", "'d'", ")", ")", "{", "$", "result", "=", "$", "result", "->", "subMonth...
If a day has changed, sets the date on the last day of the previous month. @param DateTime $result A result of months or years addition @return DateTime @since 2.0.0
[ "If", "a", "day", "has", "changed", "sets", "the", "date", "on", "the", "last", "day", "of", "the", "previous", "month", "." ]
732fb60f054fa6aceaef93ff9a12d939d2a4797c
https://github.com/joomla-framework/datetime/blob/732fb60f054fa6aceaef93ff9a12d939d2a4797c/src/DateTime.php#L985-L994
229,550
milesj/utility
Console/Command/CacheKillShell.php
CacheKillShell.core
public function core() { $key = isset($this->params['key']) ? $this->params['key'] : null; $config = isset($this->params['config']) ? $this->params['config'] : 'default'; if ($key) { $this->out(sprintf('Clearing %s in %s...', $key, $config)); Cache::delete($key, $config); } else { $this->out(sprintf('Clearing all in %s...', $config)); Cache::clear(false, $config); } $this->out('<info>Cache cleared!</info>'); }
php
public function core() { $key = isset($this->params['key']) ? $this->params['key'] : null; $config = isset($this->params['config']) ? $this->params['config'] : 'default'; if ($key) { $this->out(sprintf('Clearing %s in %s...', $key, $config)); Cache::delete($key, $config); } else { $this->out(sprintf('Clearing all in %s...', $config)); Cache::clear(false, $config); } $this->out('<info>Cache cleared!</info>'); }
[ "public", "function", "core", "(", ")", "{", "$", "key", "=", "isset", "(", "$", "this", "->", "params", "[", "'key'", "]", ")", "?", "$", "this", "->", "params", "[", "'key'", "]", ":", "null", ";", "$", "config", "=", "isset", "(", "$", "this...
Delete CakePHP cache.
[ "Delete", "CakePHP", "cache", "." ]
146318ff0a882917defab7f4918b0d198eb5a3c0
https://github.com/milesj/utility/blob/146318ff0a882917defab7f4918b0d198eb5a3c0/Console/Command/CacheKillShell.php#L44-L58
229,551
fuelphp/common
src/CookieJar.php
CookieJar.setParent
public function setParent(CookieJar $parent = null) { $this->parent = $parent; if ($this->parent) { $this->enableParent(); $this->parent->setChild($this); } else { $this->disableParent(); } return $this; }
php
public function setParent(CookieJar $parent = null) { $this->parent = $parent; if ($this->parent) { $this->enableParent(); $this->parent->setChild($this); } else { $this->disableParent(); } return $this; }
[ "public", "function", "setParent", "(", "CookieJar", "$", "parent", "=", "null", ")", "{", "$", "this", "->", "parent", "=", "$", "parent", ";", "if", "(", "$", "this", "->", "parent", ")", "{", "$", "this", "->", "enableParent", "(", ")", ";", "$"...
Set the parent of this cookie jar, to support inheritance @param CookieJar $parent the parent cookie jar object @return $this @since 2.0.0
[ "Set", "the", "parent", "of", "this", "cookie", "jar", "to", "support", "inheritance" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L99-L114
229,552
fuelphp/common
src/CookieJar.php
CookieJar.has
public function has($key) { if ( ! isset($this->jar[$key]) or $this->jar[$key]->isDeleted()) { if ( ! $this->parentEnabled or ! $this->parent->has($key)) { return false; } } return true; }
php
public function has($key) { if ( ! isset($this->jar[$key]) or $this->jar[$key]->isDeleted()) { if ( ! $this->parentEnabled or ! $this->parent->has($key)) { return false; } } return true; }
[ "public", "function", "has", "(", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "jar", "[", "$", "key", "]", ")", "or", "$", "this", "->", "jar", "[", "$", "key", "]", "->", "isDeleted", "(", ")", ")", "{", "if", "(...
Check if we have this cookie in the jar @param string $key @return bool @since 2.0.0
[ "Check", "if", "we", "have", "this", "cookie", "in", "the", "jar" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L163-L174
229,553
fuelphp/common
src/CookieJar.php
CookieJar.delete
public function delete($key) { if (isset($this->jar[$key]) and ! $this->jar[$key]->isDeleted()) { return $this->jar[$key]->delete(); } elseif ($this->has($key)) { return $this->parent->delete($key); } return false; }
php
public function delete($key) { if (isset($this->jar[$key]) and ! $this->jar[$key]->isDeleted()) { return $this->jar[$key]->delete(); } elseif ($this->has($key)) { return $this->parent->delete($key); } return false; }
[ "public", "function", "delete", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "jar", "[", "$", "key", "]", ")", "and", "!", "$", "this", "->", "jar", "[", "$", "key", "]", "->", "isDeleted", "(", ")", ")", "{", "retur...
Remove a cookie from the cookie jar @param string $key key to delete @return boolean delete success boolean @since 2.0.0
[ "Remove", "a", "cookie", "from", "the", "cookie", "jar" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L183-L195
229,554
fuelphp/common
src/CookieJar.php
CookieJar.get
public function get($key, $default = null) { if (isset($this->jar[$key]) and ! $this->jar[$key]->isDeleted()) { return $this->jar[$key]->getValue(); } elseif ($this->has($key)) { return $this->parent->get($key, $default); } return $default; }
php
public function get($key, $default = null) { if (isset($this->jar[$key]) and ! $this->jar[$key]->isDeleted()) { return $this->jar[$key]->getValue(); } elseif ($this->has($key)) { return $this->parent->get($key, $default); } return $default; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "jar", "[", "$", "key", "]", ")", "and", "!", "$", "this", "->", "jar", "[", "$", "key", "]", "->", "isDelet...
Get a cookie's value from the cookie jar @param string $key @param mixed $default @return mixed @since 2.0.0
[ "Get", "a", "cookie", "s", "value", "from", "the", "cookie", "jar" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L205-L217
229,555
fuelphp/common
src/CookieJar.php
CookieJar.send
public function send() { $result = true; // process the cookies in this jar foreach ($this->jar as $cookie) { if ( ! $cookie->send()) { $result = false; } } // and the cookies in this jar's children foreach ($this->children as $cookie) { if ( ! $cookie->send()) { $result = false; } } return $result; }
php
public function send() { $result = true; // process the cookies in this jar foreach ($this->jar as $cookie) { if ( ! $cookie->send()) { $result = false; } } // and the cookies in this jar's children foreach ($this->children as $cookie) { if ( ! $cookie->send()) { $result = false; } } return $result; }
[ "public", "function", "send", "(", ")", "{", "$", "result", "=", "true", ";", "// process the cookies in this jar", "foreach", "(", "$", "this", "->", "jar", "as", "$", "cookie", ")", "{", "if", "(", "!", "$", "cookie", "->", "send", "(", ")", ")", "...
Send all cookies to the client @return bool @since 2.0.0
[ "Send", "all", "cookies", "to", "the", "client" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L268-L291
229,556
fuelphp/common
src/CookieJar.php
CookieJar.getJar
protected function getJar() { if ($this->parentEnabled) { return array_merge($this->parent->getJar(), $this->jar); } else { return $this->jar; } }
php
protected function getJar() { if ($this->parentEnabled) { return array_merge($this->parent->getJar(), $this->jar); } else { return $this->jar; } }
[ "protected", "function", "getJar", "(", ")", "{", "if", "(", "$", "this", "->", "parentEnabled", ")", "{", "return", "array_merge", "(", "$", "this", "->", "parent", "->", "getJar", "(", ")", ",", "$", "this", "->", "jar", ")", ";", "}", "else", "{...
Allows the ArrayIterator to fetch parent data @since 2.0.0
[ "Allows", "the", "ArrayIterator", "to", "fetch", "parent", "data" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L326-L336
229,557
fuelphp/common
src/CookieJar.php
CookieJar.setChild
public function setChild(CookieJar $child) { if ( ! in_array($child, $this->children)) { $this->children[] = $child; } }
php
public function setChild(CookieJar $child) { if ( ! in_array($child, $this->children)) { $this->children[] = $child; } }
[ "public", "function", "setChild", "(", "CookieJar", "$", "child", ")", "{", "if", "(", "!", "in_array", "(", "$", "child", ",", "$", "this", "->", "children", ")", ")", "{", "$", "this", "->", "children", "[", "]", "=", "$", "child", ";", "}", "}...
Register a child of this cookie jar, to support inheritance @param CookieJar $child the child cookie jar object @since 2.0.0
[ "Register", "a", "child", "of", "this", "cookie", "jar", "to", "support", "inheritance" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L345-L351
229,558
fuelphp/common
src/CookieJar.php
CookieJar.offsetGet
public function offsetGet($key) { if (isset($this->jar[$key]) and ! $this->jar[$key]->isDeleted()) { return $this->jar[$key]; } elseif ($this->has($key)) { return $this->parent[$key]; } else { throw new \OutOfBoundsException('Access to undefined cookie: '.$key); } }
php
public function offsetGet($key) { if (isset($this->jar[$key]) and ! $this->jar[$key]->isDeleted()) { return $this->jar[$key]; } elseif ($this->has($key)) { return $this->parent[$key]; } else { throw new \OutOfBoundsException('Access to undefined cookie: '.$key); } }
[ "public", "function", "offsetGet", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "jar", "[", "$", "key", "]", ")", "and", "!", "$", "this", "->", "jar", "[", "$", "key", "]", "->", "isDeleted", "(", ")", ")", "{", "re...
Allow fetching values as an array @param string $key @return mixed @throws OutOfBoundsException @since 2.0.0
[ "Allow", "fetching", "values", "as", "an", "array" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L376-L390
229,559
fuelphp/common
src/CookieJar.php
CookieJar.offsetUnset
public function offsetUnset($key) { if (isset($this->jar[$key])) { $this->jar[$key]->delete(); } elseif ($this->parentEnabled) { $this->parent->delete($key); } }
php
public function offsetUnset($key) { if (isset($this->jar[$key])) { $this->jar[$key]->delete(); } elseif ($this->parentEnabled) { $this->parent->delete($key); } }
[ "public", "function", "offsetUnset", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "jar", "[", "$", "key", "]", ")", ")", "{", "$", "this", "->", "jar", "[", "$", "key", "]", "->", "delete", "(", ")", ";", "}", "elsei...
Allow unsetting values like an array @param string $key @since 2.0.0
[ "Allow", "unsetting", "values", "like", "an", "array" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/CookieJar.php#L413-L423
229,560
gridonic/hapi
src/Harvest/Model/Result.php
Result.get
public function get($property) { switch ($property) { case 'code': return $this->_code; break; case 'data': return $this->_data; break; case 'headers': return $this->_headers; break; default: if ( $this->_headers != null && array_key_exists($property, $this->_headers) ) { return $this->_headers[$property]; } else { throw new HarvestException(sprintf('Unknown property %s::%s', get_class($this), $property)); } break; } }
php
public function get($property) { switch ($property) { case 'code': return $this->_code; break; case 'data': return $this->_data; break; case 'headers': return $this->_headers; break; default: if ( $this->_headers != null && array_key_exists($property, $this->_headers) ) { return $this->_headers[$property]; } else { throw new HarvestException(sprintf('Unknown property %s::%s', get_class($this), $property)); } break; } }
[ "public", "function", "get", "(", "$", "property", ")", "{", "switch", "(", "$", "property", ")", "{", "case", "'code'", ":", "return", "$", "this", "->", "_code", ";", "break", ";", "case", "'data'", ":", "return", "$", "this", "->", "_data", ";", ...
Return the specified property @param mixed $property The property to return @return mixed @throws HarvestException
[ "Return", "the", "specified", "property" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/Model/Result.php#L89-L109
229,561
gridonic/hapi
src/Harvest/Model/Result.php
Result.set
public function set($property, $value) { switch ($property) { case 'code': $this->_code = $value; break; case 'data': $this->_data = $value; break; case 'headers': $this->_headers = $value; break; default: throw new HarvestException(sprintf('Unknown property %s::%s', get_class($this), $property)); break; } }
php
public function set($property, $value) { switch ($property) { case 'code': $this->_code = $value; break; case 'data': $this->_data = $value; break; case 'headers': $this->_headers = $value; break; default: throw new HarvestException(sprintf('Unknown property %s::%s', get_class($this), $property)); break; } }
[ "public", "function", "set", "(", "$", "property", ",", "$", "value", ")", "{", "switch", "(", "$", "property", ")", "{", "case", "'code'", ":", "$", "this", "->", "_code", "=", "$", "value", ";", "break", ";", "case", "'data'", ":", "$", "this", ...
sets the specified property @param mixed $property The property to set @param mixed $value value of property @throws HarvestException
[ "sets", "the", "specified", "property" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/Model/Result.php#L131-L147
229,562
odan/database
src/Database/Quoter.php
Quoter.quoteArray
public function quoteArray(array $array): array { if (empty($array)) { return []; } foreach ($array as $key => $value) { if ($value instanceof RawExp) { $array[$key] = $value->getValue(); continue; } $array[$key] = $this->quoteValue($value); } return $array; }
php
public function quoteArray(array $array): array { if (empty($array)) { return []; } foreach ($array as $key => $value) { if ($value instanceof RawExp) { $array[$key] = $value->getValue(); continue; } $array[$key] = $this->quoteValue($value); } return $array; }
[ "public", "function", "quoteArray", "(", "array", "$", "array", ")", ":", "array", "{", "if", "(", "empty", "(", "$", "array", ")", ")", "{", "return", "[", "]", ";", "}", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", ...
Quote array values. @param array $array @return array
[ "Quote", "array", "values", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L36-L51
229,563
odan/database
src/Database/Quoter.php
Quoter.quoteValue
public function quoteValue($value): string { if ($value === null) { return 'NULL'; } $result = $this->pdo->quote($value); if ($result === false) { throw new RuntimeException('The database driver does not support quoting in this way.'); } return $result; }
php
public function quoteValue($value): string { if ($value === null) { return 'NULL'; } $result = $this->pdo->quote($value); if ($result === false) { throw new RuntimeException('The database driver does not support quoting in this way.'); } return $result; }
[ "public", "function", "quoteValue", "(", "$", "value", ")", ":", "string", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "'NULL'", ";", "}", "$", "result", "=", "$", "this", "->", "pdo", "->", "quote", "(", "$", "value", ")", "...
Quotes a value for use in a query. @param mixed $value @throws RuntimeException @return string a quoted string
[ "Quotes", "a", "value", "for", "use", "in", "a", "query", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L62-L75
229,564
odan/database
src/Database/Quoter.php
Quoter.quoteNames
public function quoteNames(array $identifiers): array { foreach ($identifiers as $key => $identifier) { if ($identifier instanceof RawExp) { $identifiers[$key] = $identifier->getValue(); continue; } $identifiers[$key] = $this->quoteName($identifier); } return $identifiers; }
php
public function quoteNames(array $identifiers): array { foreach ($identifiers as $key => $identifier) { if ($identifier instanceof RawExp) { $identifiers[$key] = $identifier->getValue(); continue; } $identifiers[$key] = $this->quoteName($identifier); } return $identifiers; }
[ "public", "function", "quoteNames", "(", "array", "$", "identifiers", ")", ":", "array", "{", "foreach", "(", "$", "identifiers", "as", "$", "key", "=>", "$", "identifier", ")", "{", "if", "(", "$", "identifier", "instanceof", "RawExp", ")", "{", "$", ...
Quote array of names. @param array $identifiers @return array
[ "Quote", "array", "of", "names", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L84-L95
229,565
odan/database
src/Database/Quoter.php
Quoter.quoteNameWithSeparator
protected function quoteNameWithSeparator(string $spec, string $sep, int $pos): string { $len = strlen($sep); $part1 = $this->quoteName(substr($spec, 0, $pos)); $part2 = $this->quoteIdentifier(substr($spec, $pos + $len)); return "{$part1}{$sep}{$part2}"; }
php
protected function quoteNameWithSeparator(string $spec, string $sep, int $pos): string { $len = strlen($sep); $part1 = $this->quoteName(substr($spec, 0, $pos)); $part2 = $this->quoteIdentifier(substr($spec, $pos + $len)); return "{$part1}{$sep}{$part2}"; }
[ "protected", "function", "quoteNameWithSeparator", "(", "string", "$", "spec", ",", "string", "$", "sep", ",", "int", "$", "pos", ")", ":", "string", "{", "$", "len", "=", "strlen", "(", "$", "sep", ")", ";", "$", "part1", "=", "$", "this", "->", "...
Quotes an identifier that has a separator. @param string $spec the identifier name to quote @param string $sep the separator, typically a dot or space @param int $pos the position of the separator @return string the quoted identifier name
[ "Quotes", "an", "identifier", "that", "has", "a", "separator", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L129-L136
229,566
odan/database
src/Database/Quoter.php
Quoter.quoteSetValues
public function quoteSetValues(array $row): string { $values = []; foreach ($row as $key => $value) { if ($value instanceof RawExp) { $values[] = $this->quoteName($key) . '=' . $value->getValue(); continue; } $values[] = $this->quoteName($key) . '=' . $this->quoteValue($value); } return implode(', ', $values); }
php
public function quoteSetValues(array $row): string { $values = []; foreach ($row as $key => $value) { if ($value instanceof RawExp) { $values[] = $this->quoteName($key) . '=' . $value->getValue(); continue; } $values[] = $this->quoteName($key) . '=' . $this->quoteValue($value); } return implode(', ', $values); }
[ "public", "function", "quoteSetValues", "(", "array", "$", "row", ")", ":", "string", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "row", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "RawExp...
Quote Set values. @param array $row A row @return string Sql string
[ "Quote", "Set", "values", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L170-L182
229,567
odan/database
src/Database/Quoter.php
Quoter.quoteBulkValues
public function quoteBulkValues(array $row): string { $values = []; foreach ($row as $key => $value) { $values[] = $this->quoteValue($value); } return implode(',', $values); }
php
public function quoteBulkValues(array $row): string { $values = []; foreach ($row as $key => $value) { $values[] = $this->quoteValue($value); } return implode(',', $values); }
[ "public", "function", "quoteBulkValues", "(", "array", "$", "row", ")", ":", "string", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "row", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "values", "[", "]", "=", "$", "this", ...
Quote bulk values. @param array $row A row @return string Sql string
[ "Quote", "bulk", "values", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L191-L199
229,568
odan/database
src/Database/Quoter.php
Quoter.quoteFields
public function quoteFields(array $row): string { $fields = []; foreach (array_keys($row) as $field) { $fields[] = $this->quoteName($field); } return implode(', ', $fields); }
php
public function quoteFields(array $row): string { $fields = []; foreach (array_keys($row) as $field) { $fields[] = $this->quoteName($field); } return implode(', ', $fields); }
[ "public", "function", "quoteFields", "(", "array", "$", "row", ")", ":", "string", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "array_keys", "(", "$", "row", ")", "as", "$", "field", ")", "{", "$", "fields", "[", "]", "=", "$", "this"...
Quote fields values. @param array $row A row @return string Sql string
[ "Quote", "fields", "values", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Quoter.php#L208-L216
229,569
chadicus/marvel-api-client
src/DataContainer.php
DataContainer.deriveResourceFilter
private static function deriveResourceFilter($results) { $default = function () { return []; }; if (!is_array($results) || !isset($results[0]['resourceURI'])) { return $default; } $pattern = '^' . preg_quote(Client::BASE_URL) . '(?P<resource>[a-z]*)/\d+$'; $matches = []; preg_match("#{$pattern}#", $results[0]['resourceURI'], $matches); return Util\Arrays::get($matches, 'resource', $default); }
php
private static function deriveResourceFilter($results) { $default = function () { return []; }; if (!is_array($results) || !isset($results[0]['resourceURI'])) { return $default; } $pattern = '^' . preg_quote(Client::BASE_URL) . '(?P<resource>[a-z]*)/\d+$'; $matches = []; preg_match("#{$pattern}#", $results[0]['resourceURI'], $matches); return Util\Arrays::get($matches, 'resource', $default); }
[ "private", "static", "function", "deriveResourceFilter", "(", "$", "results", ")", "{", "$", "default", "=", "function", "(", ")", "{", "return", "[", "]", ";", "}", ";", "if", "(", "!", "is_array", "(", "$", "results", ")", "||", "!", "isset", "(", ...
Helper method to derive the filter to use for the given resource array @param mixed $results The results array from the API. @return callable The filter to use
[ "Helper", "method", "to", "derive", "the", "filter", "to", "use", "for", "the", "given", "resource", "array" ]
a27729f070c0a3f14b2d2df3a3961590e2d59cb2
https://github.com/chadicus/marvel-api-client/blob/a27729f070c0a3f14b2d2df3a3961590e2d59cb2/src/DataContainer.php#L79-L93
229,570
Codegyre/RoboCI
src/Command/CI.php
CI.ciRun
public function ciRun($environment, $args = '') { $runner = new Runner($environment); $runner->buildImage(); $runner->runServices(); $res = $runner->getContainerRunner() ->exec($runner->getRunCommand()) ->args($args) ->run(); $runner->stopServices(); !$res->getExitCode() ? $this->yell('BUILD SUCCESSFUL') : $this->say("<error> BUILD FAILED </error>"); $data = $res->getData(); $this->say("To enter this container, save it with <info>docker commit {$data['cid']} travis_build_failed<info>"); $this->say('Then you can run it: <info>docker run -i -t travis_build_failed bash</info>'); }
php
public function ciRun($environment, $args = '') { $runner = new Runner($environment); $runner->buildImage(); $runner->runServices(); $res = $runner->getContainerRunner() ->exec($runner->getRunCommand()) ->args($args) ->run(); $runner->stopServices(); !$res->getExitCode() ? $this->yell('BUILD SUCCESSFUL') : $this->say("<error> BUILD FAILED </error>"); $data = $res->getData(); $this->say("To enter this container, save it with <info>docker commit {$data['cid']} travis_build_failed<info>"); $this->say('Then you can run it: <info>docker run -i -t travis_build_failed bash</info>'); }
[ "public", "function", "ciRun", "(", "$", "environment", ",", "$", "args", "=", "''", ")", "{", "$", "runner", "=", "new", "Runner", "(", "$", "environment", ")", ";", "$", "runner", "->", "buildImage", "(", ")", ";", "$", "runner", "->", "runServices...
Executes build for specified RoboCI environment @param $environment @param string $args additional arguments @return int
[ "Executes", "build", "for", "specified", "RoboCI", "environment" ]
886f340d7d8ca808607da9a41d2e6ba18075bdf1
https://github.com/Codegyre/RoboCI/blob/886f340d7d8ca808607da9a41d2e6ba18075bdf1/src/Command/CI.php#L25-L44
229,571
Codegyre/RoboCI
src/Command/CI.php
CI.ciShell
public function ciShell($environment, $args = '') { $runner = new Runner($environment); $res = $runner->buildImage(); if (!$res->wasSuccessful()) return 1; $runner->runServices(); $links = array_keys($runner->getServices()); $links = implode(' ', array_map(function($l) {return "--link $l";}, $links )); $command = (new DockerRun(Config::$runImage)) ->option('-t') ->option('-i') ->name('robo_shell_'.uniqid()) ->arg($links) ->arg($args) ->exec('bash') ->getCommand(); $this->yell("To enter shell run `$command`\n"); }
php
public function ciShell($environment, $args = '') { $runner = new Runner($environment); $res = $runner->buildImage(); if (!$res->wasSuccessful()) return 1; $runner->runServices(); $links = array_keys($runner->getServices()); $links = implode(' ', array_map(function($l) {return "--link $l";}, $links )); $command = (new DockerRun(Config::$runImage)) ->option('-t') ->option('-i') ->name('robo_shell_'.uniqid()) ->arg($links) ->arg($args) ->exec('bash') ->getCommand(); $this->yell("To enter shell run `$command`\n"); }
[ "public", "function", "ciShell", "(", "$", "environment", ",", "$", "args", "=", "''", ")", "{", "$", "runner", "=", "new", "Runner", "(", "$", "environment", ")", ";", "$", "res", "=", "$", "runner", "->", "buildImage", "(", ")", ";", "if", "(", ...
Runs interactive bash shell in RoboCI environment @param $environment @param string $args
[ "Runs", "interactive", "bash", "shell", "in", "RoboCI", "environment" ]
886f340d7d8ca808607da9a41d2e6ba18075bdf1
https://github.com/Codegyre/RoboCI/blob/886f340d7d8ca808607da9a41d2e6ba18075bdf1/src/Command/CI.php#L51-L72
229,572
odan/database
src/Database/Connection.php
Connection.queryValues
public function queryValues(string $sql, string $key): array { $result = []; $statement = $this->query($sql); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $result[] = $row[$key]; } return $result; }
php
public function queryValues(string $sql, string $key): array { $result = []; $statement = $this->query($sql); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $result[] = $row[$key]; } return $result; }
[ "public", "function", "queryValues", "(", "string", "$", "sql", ",", "string", "$", "key", ")", ":", "array", "{", "$", "result", "=", "[", "]", ";", "$", "statement", "=", "$", "this", "->", "query", "(", "$", "sql", ")", ";", "while", "(", "$",...
Retrieving a list of column values. sample: $lists = $db->queryValues('SELECT id FROM table;', 'id'); @param string $sql @param string $key @return array
[ "Retrieving", "a", "list", "of", "column", "values", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Connection.php#L71-L80
229,573
odan/database
src/Database/Connection.php
Connection.queryValue
public function queryValue(string $sql, string $column, $default = null) { $result = $default; if ($row = $this->query($sql)->fetch(PDO::FETCH_ASSOC)) { $result = $row[$column]; } return $result; }
php
public function queryValue(string $sql, string $column, $default = null) { $result = $default; if ($row = $this->query($sql)->fetch(PDO::FETCH_ASSOC)) { $result = $row[$column]; } return $result; }
[ "public", "function", "queryValue", "(", "string", "$", "sql", ",", "string", "$", "column", ",", "$", "default", "=", "null", ")", "{", "$", "result", "=", "$", "default", ";", "if", "(", "$", "row", "=", "$", "this", "->", "query", "(", "$", "s...
Retrieve only the given column of the first result row. @param string $sql @param string $column @param mixed $default @return mixed|null
[ "Retrieve", "only", "the", "given", "column", "of", "the", "first", "result", "row", "." ]
e514fb45ab72718a77b34ed2c44906f5159e8278
https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Connection.php#L91-L99
229,574
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getActiveClients
public function getActiveClients() { $result = $this->getClients(); if ( $result->isSuccess() ) { $clients = array(); foreach ($result->data as $client) { if ($client->active == "true") { $clients[$client->id] = $client; } } $result->data = $clients; } return $result; }
php
public function getActiveClients() { $result = $this->getClients(); if ( $result->isSuccess() ) { $clients = array(); foreach ($result->data as $client) { if ($client->active == "true") { $clients[$client->id] = $client; } } $result->data = $clients; } return $result; }
[ "public", "function", "getActiveClients", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getClients", "(", ")", ";", "if", "(", "$", "result", "->", "isSuccess", "(", ")", ")", "{", "$", "clients", "=", "array", "(", ")", ";", "foreach", "(...
get all active clients <code> $api = new HarvestReports(); $result = $api->getActiveClients(); if ( $result->isSuccess() ) { $clients = $result->data; } </code> @return Result
[ "get", "all", "active", "clients" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L94-L108
229,575
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getInactiveProjects
public function getInactiveProjects() { $result = $this->getProjects(); if ( $result->isSuccess() ) { $projects = array(); foreach ($result->data as $project) { if ($project->active == "false") { $projects[$project->id] = $project; } } $result->data = $projects; } return $result; }
php
public function getInactiveProjects() { $result = $this->getProjects(); if ( $result->isSuccess() ) { $projects = array(); foreach ($result->data as $project) { if ($project->active == "false") { $projects[$project->id] = $project; } } $result->data = $projects; } return $result; }
[ "public", "function", "getInactiveProjects", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getProjects", "(", ")", ";", "if", "(", "$", "result", "->", "isSuccess", "(", ")", ")", "{", "$", "projects", "=", "array", "(", ")", ";", "foreach",...
get all inactive projects <code> $api = new HarvestReports(); $result = $api->getInactiveProjects(); if ( $result->isSuccess() ) { $projects = $result->data; } </code> @return Result
[ "get", "all", "inactive", "projects" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L184-L198
229,576
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getClientActiveProjects
public function getClientActiveProjects($client_id) { $result = $this->getClientProjects( $client_id ); if ( $result->isSuccess() ) { $projects = array(); foreach ($result->data as $project) { if ($project->active == "true") { $projects[$project->id] = $project; } } $result->data = $projects; } return $result; }
php
public function getClientActiveProjects($client_id) { $result = $this->getClientProjects( $client_id ); if ( $result->isSuccess() ) { $projects = array(); foreach ($result->data as $project) { if ($project->active == "true") { $projects[$project->id] = $project; } } $result->data = $projects; } return $result; }
[ "public", "function", "getClientActiveProjects", "(", "$", "client_id", ")", "{", "$", "result", "=", "$", "this", "->", "getClientProjects", "(", "$", "client_id", ")", ";", "if", "(", "$", "result", "->", "isSuccess", "(", ")", ")", "{", "$", "projects...
get all active projects <code> $api = new HarvestReports(); $result = $api->getClientActiveProjects( 12345 ); if ( $result->isSuccess() ) { $projects = $result->data; } </code> @param int $client_id Client Identifier @return Result
[ "get", "all", "active", "projects" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L215-L229
229,577
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getActiveUsers
public function getActiveUsers() { $result = $this->getUsers(); if ( $result->isSuccess() ) { $data = array(); foreach ($result->data as $obj) { /** @var \Harvest\Model\User $obj */ if ( $obj->get("is-active") == "true" ) { $data[$obj->id] = $obj; } } $result->data = $data; } return $result; }
php
public function getActiveUsers() { $result = $this->getUsers(); if ( $result->isSuccess() ) { $data = array(); foreach ($result->data as $obj) { /** @var \Harvest\Model\User $obj */ if ( $obj->get("is-active") == "true" ) { $data[$obj->id] = $obj; } } $result->data = $data; } return $result; }
[ "public", "function", "getActiveUsers", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getUsers", "(", ")", ";", "if", "(", "$", "result", "->", "isSuccess", "(", ")", ")", "{", "$", "data", "=", "array", "(", ")", ";", "foreach", "(", "$...
get all active users <code> $api = new HarvestReports(); $result = $api->getActiveUsers(); if ( $result->isSuccess() ) { $users = $result->data; } </code> @return Result
[ "get", "all", "active", "users" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L276-L291
229,578
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getActiveTimers
public function getActiveTimers() { $result = $this->getActiveUsers( ); if ( $result->isSuccess() ) { $data = array(); foreach ($result->data as $user) { $subResult = $this->getUserEntries( $user->id, Range::today( $this->_timeZone ) ); if ( $subResult->isSuccess() ) { foreach ($subResult->data as $entry) { if ($entry->timer_started_at != null || $entry->timer_started_at != "") { $data[$user->id] = $entry; break; } } } } $result->data = $data; } return $result; }
php
public function getActiveTimers() { $result = $this->getActiveUsers( ); if ( $result->isSuccess() ) { $data = array(); foreach ($result->data as $user) { $subResult = $this->getUserEntries( $user->id, Range::today( $this->_timeZone ) ); if ( $subResult->isSuccess() ) { foreach ($subResult->data as $entry) { if ($entry->timer_started_at != null || $entry->timer_started_at != "") { $data[$user->id] = $entry; break; } } } } $result->data = $data; } return $result; }
[ "public", "function", "getActiveTimers", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getActiveUsers", "(", ")", ";", "if", "(", "$", "result", "->", "isSuccess", "(", ")", ")", "{", "$", "data", "=", "array", "(", ")", ";", "foreach", "(...
get all active time entries <code> $api = new HarvestReports(); $result = $api->getActiveTimers( ); if ( $result->isSuccess() ) { $entries = $result->data; } </code> @return Result
[ "get", "all", "active", "time", "entries" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L524-L544
229,579
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getUsersActiveTimer
public function getUsersActiveTimer($user_id) { $result = $this->getUserEntries( $user_id, Range::today( $this->_timeZone ) ); if ( $result->isSuccess() ) { $data = null; foreach ($result->data as $entry) { if ($entry->timer_started_at != null || $entry->timer_started_at != "") { $data = $entry; break; } } $result->data = $data; } return $result; }
php
public function getUsersActiveTimer($user_id) { $result = $this->getUserEntries( $user_id, Range::today( $this->_timeZone ) ); if ( $result->isSuccess() ) { $data = null; foreach ($result->data as $entry) { if ($entry->timer_started_at != null || $entry->timer_started_at != "") { $data = $entry; break; } } $result->data = $data; } return $result; }
[ "public", "function", "getUsersActiveTimer", "(", "$", "user_id", ")", "{", "$", "result", "=", "$", "this", "->", "getUserEntries", "(", "$", "user_id", ",", "Range", "::", "today", "(", "$", "this", "->", "_timeZone", ")", ")", ";", "if", "(", "$", ...
get a user's active time entry <code> $api = new HarvestReports(); $result = $api->getUsersActiveTimer( 12345 ); if ( $result->isSuccess() ) { $activeTimer = $result->data; } </code> @param $user_id @return Result
[ "get", "a", "user", "s", "active", "time", "entry" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L561-L576
229,580
gridonic/hapi
src/Harvest/HarvestReports.php
HarvestReports.getProjectTasks
public function getProjectTasks($project_id) { $result = $this->getProjectTaskAssignments($project_id); if ($result->isSuccess()) { $tasks = array(); foreach ($result->data as $taskAssignment) { $taskResult = $this->getTask($taskAssignment->task_id); if ($taskResult->isSuccess()) { $tasks[$taskResult->data->id] = $taskResult->data; } } $result->data = $tasks; } return $result; }
php
public function getProjectTasks($project_id) { $result = $this->getProjectTaskAssignments($project_id); if ($result->isSuccess()) { $tasks = array(); foreach ($result->data as $taskAssignment) { $taskResult = $this->getTask($taskAssignment->task_id); if ($taskResult->isSuccess()) { $tasks[$taskResult->data->id] = $taskResult->data; } } $result->data = $tasks; } return $result; }
[ "public", "function", "getProjectTasks", "(", "$", "project_id", ")", "{", "$", "result", "=", "$", "this", "->", "getProjectTaskAssignments", "(", "$", "project_id", ")", ";", "if", "(", "$", "result", "->", "isSuccess", "(", ")", ")", "{", "$", "tasks"...
get all tasks assigned to a project <code> $api = new HarvestReports(); $result = $api->getProjectTasks( 12345 ); if ( $result->isSuccess() ) { $tasks = $result->data; } </code> @param $project_id @return Result
[ "get", "all", "tasks", "assigned", "to", "a", "project" ]
018c05b548428aa3e8d1040e0e2b1ec75b85adfe
https://github.com/gridonic/hapi/blob/018c05b548428aa3e8d1040e0e2b1ec75b85adfe/src/Harvest/HarvestReports.php#L593-L608
229,581
fuelphp/common
src/Arr.php
Arr.delete
public static function delete(&$array, $key) { if (is_null($key)) { return false; } if (is_array($key)) { $return = array(); foreach ($key as $k) { $return[$k] = static::delete($array, $k); } return $return; } $key_parts = explode('.', $key); if (! is_array($array) or ! array_key_exists($key_parts[0], $array)) { return false; } $this_key = array_shift($key_parts); if (! empty($key_parts)) { $key = implode('.', $key_parts); return static::delete($array[$this_key], $key); } else { unset($array[$this_key]); } return true; }
php
public static function delete(&$array, $key) { if (is_null($key)) { return false; } if (is_array($key)) { $return = array(); foreach ($key as $k) { $return[$k] = static::delete($array, $k); } return $return; } $key_parts = explode('.', $key); if (! is_array($array) or ! array_key_exists($key_parts[0], $array)) { return false; } $this_key = array_shift($key_parts); if (! empty($key_parts)) { $key = implode('.', $key_parts); return static::delete($array[$this_key], $key); } else { unset($array[$this_key]); } return true; }
[ "public", "static", "function", "delete", "(", "&", "$", "array", ",", "$", "key", ")", "{", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "return", "false", ";", "}", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "$", "return"...
Unsets dot-notated key from an array @param array $array The search array @param mixed $key The dot-notated key or array of keys @return mixed @since 2.0
[ "Unsets", "dot", "-", "notated", "key", "from", "an", "array" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L198-L235
229,582
fuelphp/common
src/Arr.php
Arr.assocToKeyval
public static function assocToKeyval($assoc, $key_field, $val_field) { if (! is_array($assoc) and ! $assoc instanceof \Iterator) { throw new \InvalidArgumentException('The first parameter must be an array.'); } $output = array(); foreach ($assoc as $row) { if (isset($row[$key_field]) and isset($row[$val_field])) { $output[$row[$key_field]] = $row[$val_field]; } } return $output; }
php
public static function assocToKeyval($assoc, $key_field, $val_field) { if (! is_array($assoc) and ! $assoc instanceof \Iterator) { throw new \InvalidArgumentException('The first parameter must be an array.'); } $output = array(); foreach ($assoc as $row) { if (isset($row[$key_field]) and isset($row[$val_field])) { $output[$row[$key_field]] = $row[$val_field]; } } return $output; }
[ "public", "static", "function", "assocToKeyval", "(", "$", "assoc", ",", "$", "key_field", ",", "$", "val_field", ")", "{", "if", "(", "!", "is_array", "(", "$", "assoc", ")", "and", "!", "$", "assoc", "instanceof", "\\", "Iterator", ")", "{", "throw",...
Converts a multi-dimensional associative array into an array of key => values with the provided field names @param array $assoc the array to convert @param string $key_field the field name of the key field @param string $val_field the field name of the value field @return array @throws \InvalidArgumentException @since 2.0
[ "Converts", "a", "multi", "-", "dimensional", "associative", "array", "into", "an", "array", "of", "key", "=", ">", "values", "with", "the", "provided", "field", "names" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L248-L265
229,583
fuelphp/common
src/Arr.php
Arr.toAssoc
public static function toAssoc($arr) { if (($count = count($arr)) % 2 > 0) { throw new \BadMethodCallException('Number of values in to_assoc must be even.'); } $keys = $vals = array(); for ($i = 0; $i < $count - 1; $i += 2) { $keys[] = array_shift($arr); $vals[] = array_shift($arr); } return array_combine($keys, $vals); }
php
public static function toAssoc($arr) { if (($count = count($arr)) % 2 > 0) { throw new \BadMethodCallException('Number of values in to_assoc must be even.'); } $keys = $vals = array(); for ($i = 0; $i < $count - 1; $i += 2) { $keys[] = array_shift($arr); $vals[] = array_shift($arr); } return array_combine($keys, $vals); }
[ "public", "static", "function", "toAssoc", "(", "$", "arr", ")", "{", "if", "(", "(", "$", "count", "=", "count", "(", "$", "arr", ")", ")", "%", "2", ">", "0", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "'Number of values in to_ass...
Converts the given 1 dimensional non-associative array to an associative array. The array given must have an even number of elements or null will be returned. Arr::to_assoc(array('foo','bar')); @param string $arr the array to change @return array|null the new array or null @throws \BadMethodCallException @since 2.0
[ "Converts", "the", "given", "1", "dimensional", "non", "-", "associative", "array", "to", "an", "associative", "array", "." ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L281-L295
229,584
fuelphp/common
src/Arr.php
Arr.prepend
public static function prepend(&$arr, $key, $value = null) { $arr = (is_array($key) ? $key : array($key => $value)) + $arr; }
php
public static function prepend(&$arr, $key, $value = null) { $arr = (is_array($key) ? $key : array($key => $value)) + $arr; }
[ "public", "static", "function", "prepend", "(", "&", "$", "arr", ",", "$", "key", ",", "$", "value", "=", "null", ")", "{", "$", "arr", "=", "(", "is_array", "(", "$", "key", ")", "?", "$", "key", ":", "array", "(", "$", "key", "=>", "$", "va...
Prepends a value with an asociative key to an array. Will overwrite if the value exists. @param array &$arr the array to prepend to @param string|array $key the key or array of keys and values @param mixed $value the value to prepend @since 2.0
[ "Prepends", "a", "value", "with", "an", "asociative", "key", "to", "an", "array", ".", "Will", "overwrite", "if", "the", "value", "exists", "." ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L982-L985
229,585
fuelphp/common
src/Arr.php
Arr.unique
public static function unique($arr) { // filter out all duplicate values return array_filter( $arr, function ($item) { // contrary to popular belief, this is not as static as you think... static $vars = array(); if (in_array($item, $vars, true)) { // duplicate return false; } else { // record we've had this value $vars[] = $item; // unique return true; } } ); }
php
public static function unique($arr) { // filter out all duplicate values return array_filter( $arr, function ($item) { // contrary to popular belief, this is not as static as you think... static $vars = array(); if (in_array($item, $vars, true)) { // duplicate return false; } else { // record we've had this value $vars[] = $item; // unique return true; } } ); }
[ "public", "static", "function", "unique", "(", "$", "arr", ")", "{", "// filter out all duplicate values", "return", "array_filter", "(", "$", "arr", ",", "function", "(", "$", "item", ")", "{", "// contrary to popular belief, this is not as static as you think...", "st...
Returns only unique values in an array. It does not sort. First value is used. @param array $arr the array to dedup @return array array with only de-duped values @since 2.0
[ "Returns", "only", "unique", "values", "in", "an", "array", ".", "It", "does", "not", "sort", ".", "First", "value", "is", "used", "." ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L1099-L1124
229,586
fuelphp/common
src/Arr.php
Arr.nextByKey
public static function nextByKey($array, $key, $getValue = false, $strict = false) { if (! is_array($array) and ! $array instanceof \ArrayAccess) { throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.'); } // get the keys of the array $keys = array_keys($array); // and do a lookup of the key passed if (($index = array_search($key, $keys, $strict)) === false) { // key does not exist return false; } // check if we have a previous key elseif (! isset($keys[$index + 1])) { // there is none return null; } // return the value or the key of the array entry the previous key points to return $getValue ? $array[$keys[$index + 1]] : $keys[$index + 1]; }
php
public static function nextByKey($array, $key, $getValue = false, $strict = false) { if (! is_array($array) and ! $array instanceof \ArrayAccess) { throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.'); } // get the keys of the array $keys = array_keys($array); // and do a lookup of the key passed if (($index = array_search($key, $keys, $strict)) === false) { // key does not exist return false; } // check if we have a previous key elseif (! isset($keys[$index + 1])) { // there is none return null; } // return the value or the key of the array entry the previous key points to return $getValue ? $array[$keys[$index + 1]] : $keys[$index + 1]; }
[ "public", "static", "function", "nextByKey", "(", "$", "array", ",", "$", "key", ",", "$", "getValue", "=", "false", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "!", "is_array", "(", "$", "array", ")", "and", "!", "$", "array", "instance...
Get the next value or key from an array using the current array key @param array $array the array containing the values @param string $key key of the current entry to use as reference @param bool $getValue if true, return the next value instead of the next key @param bool $strict if true, do a strict key comparison @return mixed the value in the array, null if there is no next value, or false if the key doesn't exist @throws \InvalidArgumentException @since 2.0
[ "Get", "the", "next", "value", "or", "key", "from", "an", "array", "using", "the", "current", "array", "key" ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L1222-L1248
229,587
fuelphp/common
src/Arr.php
Arr.subset
public static function subset(array $array, array $keys, $default = null) { $result = array(); foreach ($keys as $key) { static::set($result, $key, static::get($array, $key, $default)); } return $result; }
php
public static function subset(array $array, array $keys, $default = null) { $result = array(); foreach ($keys as $key) { static::set($result, $key, static::get($array, $key, $default)); } return $result; }
[ "public", "static", "function", "subset", "(", "array", "$", "array", ",", "array", "$", "keys", ",", "$", "default", "=", "null", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "sta...
Return the subset of the array defined by the supplied keys. Returns $default for missing keys, as with Arr::get() @param array $array the array containing the values @param array $keys list of keys (or indices) to return @param mixed $default value of missing keys; default null @return array An array containing the same set of keys provided. @since 2.0
[ "Return", "the", "subset", "of", "the", "array", "defined", "by", "the", "supplied", "keys", "." ]
ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40
https://github.com/fuelphp/common/blob/ddb6b9ced050f1ae7b22326d9c8c32b0dabdbf40/src/Arr.php#L1344-L1354
229,588
rougin/spark-plug
src/SparkPlug.php
SparkPlug.instance
public function instance() { $this->paths(); $this->environment($this->constants['ENVIRONMENT']); $this->constants(); $this->common(); $this->config(); require 'helpers.php'; $instance = \CI_Controller::get_instance(); empty($instance) && $instance = new \CI_Controller; return $instance; }
php
public function instance() { $this->paths(); $this->environment($this->constants['ENVIRONMENT']); $this->constants(); $this->common(); $this->config(); require 'helpers.php'; $instance = \CI_Controller::get_instance(); empty($instance) && $instance = new \CI_Controller; return $instance; }
[ "public", "function", "instance", "(", ")", "{", "$", "this", "->", "paths", "(", ")", ";", "$", "this", "->", "environment", "(", "$", "this", "->", "constants", "[", "'ENVIRONMENT'", "]", ")", ";", "$", "this", "->", "constants", "(", ")", ";", "...
Returns the Codeigniter singleton. @return \CI_Controller
[ "Returns", "the", "Codeigniter", "singleton", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L75-L94
229,589
rougin/spark-plug
src/SparkPlug.php
SparkPlug.set
public function set($key, $value) { $this->constants[$key] = $value; $same = $key === 'APPPATH'; $path = $this->constants[$key] . '/views/'; $same && $this->constants['VIEWPATH'] = $path; return $this; }
php
public function set($key, $value) { $this->constants[$key] = $value; $same = $key === 'APPPATH'; $path = $this->constants[$key] . '/views/'; $same && $this->constants['VIEWPATH'] = $path; return $this; }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "constants", "[", "$", "key", "]", "=", "$", "value", ";", "$", "same", "=", "$", "key", "===", "'APPPATH'", ";", "$", "path", "=", "$", "this", "->",...
Sets the constant with a value. @param string $key @param string $value
[ "Sets", "the", "constant", "with", "a", "value", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L102-L113
229,590
rougin/spark-plug
src/SparkPlug.php
SparkPlug.basepath
protected function basepath() { $directory = new \RecursiveDirectoryIterator(getcwd()); $iterator = new \RecursiveIteratorIterator($directory); foreach ($iterator as $item) { $core = 'core' . DIRECTORY_SEPARATOR . 'CodeIgniter.php'; $exists = strpos($item->getPathname(), $core) !== false; $path = str_replace($core, '', $item->getPathname()); $exists && ! defined('BASEPATH') && define('BASEPATH', $path); } }
php
protected function basepath() { $directory = new \RecursiveDirectoryIterator(getcwd()); $iterator = new \RecursiveIteratorIterator($directory); foreach ($iterator as $item) { $core = 'core' . DIRECTORY_SEPARATOR . 'CodeIgniter.php'; $exists = strpos($item->getPathname(), $core) !== false; $path = str_replace($core, '', $item->getPathname()); $exists && ! defined('BASEPATH') && define('BASEPATH', $path); } }
[ "protected", "function", "basepath", "(", ")", "{", "$", "directory", "=", "new", "\\", "RecursiveDirectoryIterator", "(", "getcwd", "(", ")", ")", ";", "$", "iterator", "=", "new", "\\", "RecursiveIteratorIterator", "(", "$", "directory", ")", ";", "foreach...
Sets the base path. @return void
[ "Sets", "the", "base", "path", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L120-L135
229,591
rougin/spark-plug
src/SparkPlug.php
SparkPlug.charset
protected function charset() { ini_set('default_charset', $charset = strtoupper(config_item('charset'))); defined('MB_ENABLED') || define('MB_ENABLED', extension_loaded('mbstring')); $encoding = 'mbstring.internal_encoding'; ! is_php('5.6') && ! ini_get($encoding) && ini_set($encoding, $charset); $this->iconv(); }
php
protected function charset() { ini_set('default_charset', $charset = strtoupper(config_item('charset'))); defined('MB_ENABLED') || define('MB_ENABLED', extension_loaded('mbstring')); $encoding = 'mbstring.internal_encoding'; ! is_php('5.6') && ! ini_get($encoding) && ini_set($encoding, $charset); $this->iconv(); }
[ "protected", "function", "charset", "(", ")", "{", "ini_set", "(", "'default_charset'", ",", "$", "charset", "=", "strtoupper", "(", "config_item", "(", "'charset'", ")", ")", ")", ";", "defined", "(", "'MB_ENABLED'", ")", "||", "define", "(", "'MB_ENABLED'"...
Sets up important charset-related stuff. @return void
[ "Sets", "up", "important", "charset", "-", "related", "stuff", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L142-L153
229,592
rougin/spark-plug
src/SparkPlug.php
SparkPlug.config
protected function config() { $this->globals['CFG'] =& load_class('Config', 'core'); $this->globals['UNI'] =& load_class('Utf8', 'core'); $this->globals['SEC'] =& load_class('Security', 'core'); $this->core(); }
php
protected function config() { $this->globals['CFG'] =& load_class('Config', 'core'); $this->globals['UNI'] =& load_class('Utf8', 'core'); $this->globals['SEC'] =& load_class('Security', 'core'); $this->core(); }
[ "protected", "function", "config", "(", ")", "{", "$", "this", "->", "globals", "[", "'CFG'", "]", "=", "&", "load_class", "(", "'Config'", ",", "'core'", ")", ";", "$", "this", "->", "globals", "[", "'UNI'", "]", "=", "&", "load_class", "(", "'Utf8'...
Sets global configurations. @return void
[ "Sets", "global", "configurations", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L176-L185
229,593
rougin/spark-plug
src/SparkPlug.php
SparkPlug.constants
protected function constants() { $config = APPPATH . 'config/'; $constants = $config . ENVIRONMENT . '/constants.php'; $filename = $config . 'constants.php'; file_exists($constants) && $filename = $constants; defined('FILE_READ_MODE') || require $filename; }
php
protected function constants() { $config = APPPATH . 'config/'; $constants = $config . ENVIRONMENT . '/constants.php'; $filename = $config . 'constants.php'; file_exists($constants) && $filename = $constants; defined('FILE_READ_MODE') || require $filename; }
[ "protected", "function", "constants", "(", ")", "{", "$", "config", "=", "APPPATH", ".", "'config/'", ";", "$", "constants", "=", "$", "config", ".", "ENVIRONMENT", ".", "'/constants.php'", ";", "$", "filename", "=", "$", "config", ".", "'constants.php'", ...
Loads the framework constants. @return void
[ "Loads", "the", "framework", "constants", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L192-L203
229,594
rougin/spark-plug
src/SparkPlug.php
SparkPlug.environment
protected function environment($value = 'development') { isset($this->server['CI_ENV']) && $value = $this->server['CI_ENV']; defined('ENVIRONMENT') || define('ENVIRONMENT', $value); }
php
protected function environment($value = 'development') { isset($this->server['CI_ENV']) && $value = $this->server['CI_ENV']; defined('ENVIRONMENT') || define('ENVIRONMENT', $value); }
[ "protected", "function", "environment", "(", "$", "value", "=", "'development'", ")", "{", "isset", "(", "$", "this", "->", "server", "[", "'CI_ENV'", "]", ")", "&&", "$", "value", "=", "$", "this", "->", "server", "[", "'CI_ENV'", "]", ";", "defined",...
Sets up the current environment. @return void
[ "Sets", "up", "the", "current", "environment", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L228-L233
229,595
rougin/spark-plug
src/SparkPlug.php
SparkPlug.paths
protected function paths() { $paths = array('APPPATH' => $this->constants['APPPATH']); $paths['VENDOR'] = $this->constants['VENDOR']; $paths['VIEWPATH'] = $this->constants['VIEWPATH']; foreach ((array) $paths as $key => $value) { $defined = defined($key); $defined || define($key, $value); } defined('BASEPATH') || $this->basepath(); }
php
protected function paths() { $paths = array('APPPATH' => $this->constants['APPPATH']); $paths['VENDOR'] = $this->constants['VENDOR']; $paths['VIEWPATH'] = $this->constants['VIEWPATH']; foreach ((array) $paths as $key => $value) { $defined = defined($key); $defined || define($key, $value); } defined('BASEPATH') || $this->basepath(); }
[ "protected", "function", "paths", "(", ")", "{", "$", "paths", "=", "array", "(", "'APPPATH'", "=>", "$", "this", "->", "constants", "[", "'APPPATH'", "]", ")", ";", "$", "paths", "[", "'VENDOR'", "]", "=", "$", "this", "->", "constants", "[", "'VEND...
Sets up the APPPATH, VENDOR, and BASEPATH constants. @return void
[ "Sets", "up", "the", "APPPATH", "VENDOR", "and", "BASEPATH", "constants", "." ]
a9189c80ddcbafb3b21ea3b491b664c8e860c584
https://github.com/rougin/spark-plug/blob/a9189c80ddcbafb3b21ea3b491b664c8e860c584/src/SparkPlug.php#L253-L268
229,596
alex-phillips/clouddrive-php
src/CloudDrive/Node.php
Node.download
public function download($dest, $callback = null) { if ($this->isFolder()) { return $this->downloadFolder($dest, $callback); } return $this->downloadFile($dest, $callback); }
php
public function download($dest, $callback = null) { if ($this->isFolder()) { return $this->downloadFolder($dest, $callback); } return $this->downloadFile($dest, $callback); }
[ "public", "function", "download", "(", "$", "dest", ",", "$", "callback", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isFolder", "(", ")", ")", "{", "return", "$", "this", "->", "downloadFolder", "(", "$", "dest", ",", "$", "callback", ")...
Download contents of `Node` to local save path. If only the local directory is given, the file will be saved as its remote name. @param resource|string $dest @param callable $callback @return array @throws \Exception
[ "Download", "contents", "of", "Node", "to", "local", "save", "path", ".", "If", "only", "the", "local", "directory", "is", "given", "the", "file", "will", "be", "saved", "as", "its", "remote", "name", "." ]
f369d0567c55ee1c7650246ce6938815fbddc5bf
https://github.com/alex-phillips/clouddrive-php/blob/f369d0567c55ee1c7650246ce6938815fbddc5bf/src/CloudDrive/Node.php#L93-L100
229,597
alex-phillips/clouddrive-php
src/CloudDrive/Node.php
Node.downloadFile
protected function downloadFile($dest, $callback = null) { $retval = [ 'success' => false, 'data' => [], ]; if (is_resource($dest)) { $handle = $dest; $metadata = stream_get_meta_data($handle); $dest = $metadata["uri"]; } else { $dest = rtrim($dest, '/'); if (file_exists($dest)) { if (is_dir($dest)) { $dest = rtrim($dest, '/') . "/{$this['name']}"; } else { $retval['data']['message'] = "File already exists at '$dest'."; if (is_callable($callback)) { call_user_func($callback, $retval, $dest); } return $retval; } } $handle = @fopen($dest, 'a'); if (!$handle) { throw new \Exception("Unable to open file at '$dest'. Make sure the directory path exists."); } } $response = self::$httpClient->get( self::$account->getContentUrl() . "nodes/{$this['id']}/content", [ 'headers' => [ 'Authorization' => 'Bearer ' . self::$account->getToken()['access_token'], ], 'stream' => true, 'exceptions' => false, ] ); $retval['data'] = json_decode((string)$response->getBody(), true); if ($response->getStatusCode() !== 200) { if (is_callable($callback)) { call_user_func($callback, $retval, $dest); } return $retval; } $retval['success'] = true; $body = $response->getBody(); while (!$body->eof()) { fwrite($handle, $body->read(1024)); } fclose($handle); if (is_callable($callback)) { call_user_func($callback, $retval, $dest); } return $retval; }
php
protected function downloadFile($dest, $callback = null) { $retval = [ 'success' => false, 'data' => [], ]; if (is_resource($dest)) { $handle = $dest; $metadata = stream_get_meta_data($handle); $dest = $metadata["uri"]; } else { $dest = rtrim($dest, '/'); if (file_exists($dest)) { if (is_dir($dest)) { $dest = rtrim($dest, '/') . "/{$this['name']}"; } else { $retval['data']['message'] = "File already exists at '$dest'."; if (is_callable($callback)) { call_user_func($callback, $retval, $dest); } return $retval; } } $handle = @fopen($dest, 'a'); if (!$handle) { throw new \Exception("Unable to open file at '$dest'. Make sure the directory path exists."); } } $response = self::$httpClient->get( self::$account->getContentUrl() . "nodes/{$this['id']}/content", [ 'headers' => [ 'Authorization' => 'Bearer ' . self::$account->getToken()['access_token'], ], 'stream' => true, 'exceptions' => false, ] ); $retval['data'] = json_decode((string)$response->getBody(), true); if ($response->getStatusCode() !== 200) { if (is_callable($callback)) { call_user_func($callback, $retval, $dest); } return $retval; } $retval['success'] = true; $body = $response->getBody(); while (!$body->eof()) { fwrite($handle, $body->read(1024)); } fclose($handle); if (is_callable($callback)) { call_user_func($callback, $retval, $dest); } return $retval; }
[ "protected", "function", "downloadFile", "(", "$", "dest", ",", "$", "callback", "=", "null", ")", "{", "$", "retval", "=", "[", "'success'", "=>", "false", ",", "'data'", "=>", "[", "]", ",", "]", ";", "if", "(", "is_resource", "(", "$", "dest", "...
Save a FILE node to the specified local destination. @param resource|string $dest @param callable $callback @return array @throws \Exception
[ "Save", "a", "FILE", "node", "to", "the", "specified", "local", "destination", "." ]
f369d0567c55ee1c7650246ce6938815fbddc5bf
https://github.com/alex-phillips/clouddrive-php/blob/f369d0567c55ee1c7650246ce6938815fbddc5bf/src/CloudDrive/Node.php#L111-L180
229,598
alex-phillips/clouddrive-php
src/CloudDrive/Node.php
Node.downloadFolder
protected function downloadFolder($dest, $callback = null) { $retval = [ 'success' => false, 'data' => [], ]; if (!is_string($dest)) { throw new \Exception("Must pass in local path to download directory to."); } $nodes = $this->getChildren(); $dest = rtrim($dest) . "/{$this['name']}"; if (!file_exists($dest)) { mkdir($dest); } foreach ($nodes as $node) { if ($node->isFile()) { $node->download("{$dest}/{$node['name']}", $callback); } else if ($node->isFolder()) { $node->download($dest, $callback); } } $retval['success'] = true; return $retval; }
php
protected function downloadFolder($dest, $callback = null) { $retval = [ 'success' => false, 'data' => [], ]; if (!is_string($dest)) { throw new \Exception("Must pass in local path to download directory to."); } $nodes = $this->getChildren(); $dest = rtrim($dest) . "/{$this['name']}"; if (!file_exists($dest)) { mkdir($dest); } foreach ($nodes as $node) { if ($node->isFile()) { $node->download("{$dest}/{$node['name']}", $callback); } else if ($node->isFolder()) { $node->download($dest, $callback); } } $retval['success'] = true; return $retval; }
[ "protected", "function", "downloadFolder", "(", "$", "dest", ",", "$", "callback", "=", "null", ")", "{", "$", "retval", "=", "[", "'success'", "=>", "false", ",", "'data'", "=>", "[", "]", ",", "]", ";", "if", "(", "!", "is_string", "(", "$", "des...
Recursively download all children of a FOLDER node to the specified local destination. @param string $dest @param callable $callback @return array @throws \Exception
[ "Recursively", "download", "all", "children", "of", "a", "FOLDER", "node", "to", "the", "specified", "local", "destination", "." ]
f369d0567c55ee1c7650246ce6938815fbddc5bf
https://github.com/alex-phillips/clouddrive-php/blob/f369d0567c55ee1c7650246ce6938815fbddc5bf/src/CloudDrive/Node.php#L192-L221
229,599
alex-phillips/clouddrive-php
src/CloudDrive/Node.php
Node.getMetadata
public function getMetadata($tempLink = false) { $retval = [ 'success' => false, 'data' => [], ]; $query = []; if ($tempLink) { $query['tempLink'] = true; } $response = self::$httpClient->get( self::$account->getMetadataUrl() . "nodes/{$this['id']}", [ 'headers' => [ 'Authorization' => 'Bearer ' . self::$account->getToken()['access_token'], ], 'query' => [ 'tempLink' => $tempLink ? 'true' : 'false', ], 'exceptions' => false, ] ); $retval['data'] = json_decode((string)$response->getBody(), true); if ($response->getStatusCode() === 200) { $retval['success'] = true; } return $retval; }
php
public function getMetadata($tempLink = false) { $retval = [ 'success' => false, 'data' => [], ]; $query = []; if ($tempLink) { $query['tempLink'] = true; } $response = self::$httpClient->get( self::$account->getMetadataUrl() . "nodes/{$this['id']}", [ 'headers' => [ 'Authorization' => 'Bearer ' . self::$account->getToken()['access_token'], ], 'query' => [ 'tempLink' => $tempLink ? 'true' : 'false', ], 'exceptions' => false, ] ); $retval['data'] = json_decode((string)$response->getBody(), true); if ($response->getStatusCode() === 200) { $retval['success'] = true; } return $retval; }
[ "public", "function", "getMetadata", "(", "$", "tempLink", "=", "false", ")", "{", "$", "retval", "=", "[", "'success'", "=>", "false", ",", "'data'", "=>", "[", "]", ",", "]", ";", "$", "query", "=", "[", "]", ";", "if", "(", "$", "tempLink", ")...
Retrieve the node's metadata directly from the API. @param bool|false $tempLink @return array
[ "Retrieve", "the", "node", "s", "metadata", "directly", "from", "the", "API", "." ]
f369d0567c55ee1c7650246ce6938815fbddc5bf
https://github.com/alex-phillips/clouddrive-php/blob/f369d0567c55ee1c7650246ce6938815fbddc5bf/src/CloudDrive/Node.php#L262-L295