Skip to content

Instantly share code, notes, and snippets.

@nikic

nikic/switches Secret

Created April 28, 2020 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikic/fc225f02ea76c02e669a598cfc471b83 to your computer and use it in GitHub Desktop.
Save nikic/fc225f02ea76c02e669a598cfc471b83 to your computer and use it in GitHub Desktop.
Switch 2595 at /home/nikic/package-analysis/sources/zendframework/zendframework1/library/Zend/Validate/Isbn.php:164
switch ($this->_detectFormat()) {
case self::ISBN10:
// sum
$isbn10 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 9; $i++) {
$sum += (10 - $i) * $isbn10{$i};
}
// checksum
$checksum = 11 - ($sum % 11);
if ($checksum == 11) {
$checksum = '0';
} elseif ($checksum == 10) {
$checksum = 'X';
}
break;
case self::ISBN13:
// sum
$isbn13 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 12; $i++) {
if ($i % 2 == 0) {
$sum += $isbn13{$i};
} else {
$sum += 3 * $isbn13{$i};
}
}
// checksum
$checksum = 10 - ($sum % 10);
if ($checksum == 10) {
$checksum = '0';
}
break;
default:
$this->_error(self::NO_ISBN);
return false;
}
Switch 8337 at /home/nikic/package-analysis/sources/typo3/cms-frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php:510
switch ($this->conf['special']) {
case 'userfunction':
$menuItems = $this->prepareMenuItemsForUserSpecificMenu($value, $alternativeSortingField);
break;
case 'language':
$menuItems = $this->prepareMenuItemsForLanguageMenu($value);
break;
case 'directory':
$menuItems = $this->prepareMenuItemsForDirectoryMenu($value, $alternativeSortingField);
break;
case 'list':
$menuItems = $this->prepareMenuItemsForListMenu($value);
break;
case 'updated':
$menuItems = $this->prepareMenuItemsForUpdatedMenu(
$value,
$this->mconf['alternativeSortingField'] ?: false
);
break;
case 'keywords':
$menuItems = $this->prepareMenuItemsForKeywordsMenu(
$value,
$this->mconf['alternativeSortingField'] ?: false
);
break;
case 'categories':
/** @var CategoryMenuUtility $categoryMenuUtility */
$categoryMenuUtility = GeneralUtility::makeInstance(CategoryMenuUtility::class);
$menuItems = $categoryMenuUtility->collectPages($value, $this->conf['special.'], $this);
break;
case 'rootline':
$menuItems = $this->prepareMenuItemsForRootlineMenu();
break;
case 'browse':
$menuItems = $this->prepareMenuItemsForBrowseMenu($value, $alternativeSortingField, $additionalWhere);
break;
}
Switch 2115 at /home/nikic/package-analysis/sources/zendframework/zendframework1/library/Zend/Gdata/Calendar/Extension/Color.php:85
switch ($attribute->localName) {
case 'value':
$this->_value = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
Switch 7109 at /home/nikic/package-analysis/sources/mpdf/mpdf/src/Color/ColorConverter.php:223
switch ($mode) {
case 'rgb':
return [static::MODE_RGB, $cores[0], $cores[1], $cores[2]];
case 'rgba':
return [static::MODE_RGBA, $cores[0], $cores[1], $cores[2], $cores[3] * 100];
case 'cmyk':
case 'device-cmyk':
return [static::MODE_CMYK, $cores[0], $cores[1], $cores[2], $cores[3]];
case 'cmyka':
case 'device-cmyka':
return [static::MODE_CMYKA, $cores[0], $cores[1], $cores[2], $cores[3], $cores[4] * 100];
case 'hsl':
$conv = $this->colorModeConverter->hsl2rgb($cores[0] / 360, $cores[1], $cores[2]);
return [static::MODE_RGB, $conv[0], $conv[1], $conv[2]];
case 'hsla':
$conv = $this->colorModeConverter->hsl2rgb($cores[0] / 360, $cores[1], $cores[2]);
return [static::MODE_RGBA, $conv[0], $conv[1], $conv[2], $cores[3] * 100];
case 'spot':
$name = strtoupper(trim($cores[0]));
if (!isset($this->mpdf->spotColors[$name])) {
if (isset($cores[5])) {
$this->mpdf->AddSpotColor($cores[0], $cores[2], $cores[3], $cores[4], $cores[5]);
} else {
throw new \Mpdf\MpdfException(sprintf('Undefined spot color "%s"', $name));
}
}
return [static::MODE_SPOT, $this->mpdf->spotColors[$name]['i'], $cores[1]];
}
Switch 6564 at /home/nikic/package-analysis/sources/square/connect/lib/Api/CustomersApi.php:352
switch ($e->getCode()) {
case 200:
$data = \SquareConnect\ObjectSerializer::deserialize($e->getResponseBody(), '\SquareConnect\Model\DeleteCustomerResponse', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
Switch 7786 at /home/nikic/package-analysis/sources/codedungeon/phpunit-result-printer/src/PrinterTrait.php:406
switch (strtoupper($buffer)) {
case '.':
$color = 'fg-green';
$buffer = $this->simpleOutput ? '.' : $this->markers['pass']; // mb_convert_encoding("\x27\x13", 'UTF-8', 'UTF-16BE');
$buffer .= (!$this->debug) ? '' : ' Passed';
break;
case 'S':
$color = 'fg-yellow,bold';
$buffer = $this->simpleOutput ? 'S' : $this->markers['skipped']; // mb_convert_encoding("\x27\xA6", 'UTF-8', 'UTF-16BE');
$buffer .= !$this->debug ? '' : ' Skipped';
break;
case 'I':
$color = 'fg-blue,bold';
$buffer = $this->simpleOutput ? 'I' : $this->markers['incomplete']; // 'ℹ';
$buffer .= !$this->debug ? '' : ' Incomplete';
break;
case 'F':
$color = 'fg-red,bold';
$buffer = $this->simpleOutput ? 'F' : $this->markers['fail']; // mb_convert_encoding("\x27\x16", 'UTF-8', 'UTF-16BE');
$buffer .= (!$this->debug) ? '' : ' Fail';
break;
case 'E':
$color = 'fg-red,bold';
$buffer = $this->simpleOutput ? 'E' : $this->markers['error']; // '⚈';
$buffer .= !$this->debug ? '' : ' Error';
break;
case 'R':
$color = 'fg-magenta,bold';
$buffer = $this->simpleOutput ? 'R' : $this->markers['risky']; // '⚙';
$buffer .= !$this->debug ? '' : ' Risky';
break;
}
Switch 2609 at /home/nikic/package-analysis/sources/zendframework/zend-cache/src/Storage/Adapter/MemcacheResourceManager.php:365
switch ($key) {
case 'persistent':
$value = (bool) $value;
break;
case 'weight':
case 'timeout':
case 'retry_interval':
$value = (int) $value;
break;
}
Switch 7450 at /home/nikic/package-analysis/sources/james-heinrich/getid3/demos/demo.mp3header.php:1223
switch ($ThisFileInfo['video']['dataformat']) {
case 'bmp':
case 'gif':
case 'jpeg':
case 'jpg':
case 'png':
case 'tiff':
$FrameRate = 1;
$PlaytimeSeconds = 1;
$BitrateCompressed = $ThisFileInfo['filesize'] * 8;
break;
default:
if (!empty($ThisFileInfo['video']['frame_rate'])) {
$FrameRate = $ThisFileInfo['video']['frame_rate'];
} else {
return false;
}
if (!empty($ThisFileInfo['playtime_seconds'])) {
$PlaytimeSeconds = $ThisFileInfo['playtime_seconds'];
} else {
return false;
}
if (!empty($ThisFileInfo['video']['bitrate'])) {
$BitrateCompressed = $ThisFileInfo['video']['bitrate'];
} else {
return false;
}
break;
}
Switch 5338 at /home/nikic/package-analysis/sources/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php:1778
switch ($v_key) {
case PCLZIP_ATT_FILE_NAME:
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
if ($p_filedescr['filename'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
break;
case PCLZIP_ATT_FILE_NEW_SHORT_NAME:
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
if ($p_filedescr['new_short_name'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
break;
case PCLZIP_ATT_FILE_NEW_FULL_NAME:
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
if ($p_filedescr['new_full_name'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
break;
// ----- Look for options that takes a string
case PCLZIP_ATT_FILE_COMMENT:
if (!is_string($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
$p_filedescr['comment'] = $v_value;
break;
case PCLZIP_ATT_FILE_MTIME:
if (!is_integer($v_value)) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
return PclZip::errorCode();
}
$p_filedescr['mtime'] = $v_value;
break;
case PCLZIP_ATT_FILE_CONTENT:
$p_filedescr['content'] = $v_value;
break;
default:
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '".$v_key."'");
// ----- Return
return PclZip::errorCode();
}
Switch 567 at /home/nikic/package-analysis/sources/johnpbloch/wordpress-core/wp-includes/pomo/po.php:409
switch ( $context ) {
case 'msgid':
$entry->singular .= $unpoified;
break;
case 'msgctxt':
$entry->context .= $unpoified;
break;
case 'msgid_plural':
$entry->plural .= $unpoified;
break;
case 'msgstr':
$entry->translations[0] .= $unpoified;
break;
case 'msgstr_plural':
$entry->translations[ $msgstr_index ] .= $unpoified;
break;
default:
return false;
}
Switch 3376 at /home/nikic/package-analysis/sources/roots/wordpress/wp-includes/ID3/module.tag.id3v2.php:634
switch ($parsedFrame['frame_name']) {
case 'WCOM':
$warning .= ' (this is known to happen with files tagged by RioPort)';
break;
default:
break;
}
Switch 2850 at /home/nikic/package-analysis/sources/pear/mail_mime/Mail/mimePart.php:184
switch ($key) {
case 'encoding':
$this->encoding = $value;
$headers['Content-Transfer-Encoding'] = $value;
break;
case 'cid':
$headers['Content-ID'] = '<' . $value . '>';
break;
case 'location':
$headers['Content-Location'] = $value;
break;
case 'body_file':
$this->body_file = $value;
break;
case 'preamble':
$this->preamble = $value;
break;
// for backward compatibility
case 'dfilename':
$params['filename'] = $value;
break;
}
Switch 2635 at /home/nikic/package-analysis/sources/zendframework/zend-mime/src/Mime.php:328
switch ($encoding) {
case self::ENCODING_BASE64:
return static::encodeBase64($str, self::LINELENGTH, $EOL);
case self::ENCODING_QUOTEDPRINTABLE:
return static::encodeQuotedPrintable($str, self::LINELENGTH, $EOL);
default:
/**
* @todo 7Bit and 8Bit is currently handled the same way.
*/
return $str;
}
Switch 61 at /home/nikic/package-analysis/sources/wimg/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php:163
switch ($tokens[$stackPtr]['type']) {
case 'T_FUNCTION':
case 'T_CLOSURE':
$params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
if (empty($params)) {
// No parameters.
return;
}
$funcToken = $tokens[$stackPtr];
if (isset($funcToken['parenthesis_owner'], $funcToken['parenthesis_opener'], $funcToken['parenthesis_closer']) === false
|| $funcToken['parenthesis_owner'] !== $stackPtr
|| isset($tokens[$funcToken['parenthesis_opener']], $tokens[$funcToken['parenthesis_closer']]) === false
) {
// Hmm.. something is going wrong as these should all be available & valid.
return;
}
$opener = $funcToken['parenthesis_opener'];
$closer = $funcToken['parenthesis_closer'];
// Which nesting level is the one we are interested in ?
$nestedParenthesisCount = 1;
if (isset($tokens[$opener]['nested_parenthesis'])) {
$nestedParenthesisCount += \count($tokens[$opener]['nested_parenthesis']);
}
foreach ($params as $param) {
if (isset($param['default']) === false) {
continue;
}
$end = $param['token'];
while (($end = $phpcsFile->findNext(array(\T_COMMA, \T_CLOSE_PARENTHESIS), ($end + 1), ($closer + 1))) !== false) {
$maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $nestedParenthesisCount);
if ($maybeSkipTo !== true) {
$end = $maybeSkipTo;
continue;
}
// Ignore closing parenthesis/bracket if not 'ours'.
if ($tokens[$end]['code'] === \T_CLOSE_PARENTHESIS && $end !== $closer) {
continue;
}
// Ok, we've found the end of the param default value declaration.
break;
}
if ($this->isValidAssignment($phpcsFile, $param['token'], $end) === false) {
$this->throwError($phpcsFile, $param['token'], 'default', $param['content']);
}
}
/*
* No need for the sniff to be triggered by the T_VARIABLEs in the function
* definition as we've already examined them above, so let's skip over them.
*/
return $closer;
case 'T_VARIABLE':
case 'T_STATIC':
case 'T_CONST':
$type = 'const';
// Filter out non-property declarations.
if ($tokens[$stackPtr]['code'] === \T_VARIABLE) {
if ($this->isClassProperty($phpcsFile, $stackPtr) === false) {
return;
}
$type = 'property';
// Move back one token to have the same starting point as the others.
$stackPtr = ($stackPtr - 1);
}
// Filter out late static binding and class properties.
if ($tokens[$stackPtr]['code'] === \T_STATIC) {
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
if ($next === false || $tokens[$next]['code'] !== \T_VARIABLE) {
// Late static binding.
return;
}
if ($this->isClassProperty($phpcsFile, $next) === true) {
// Class properties are examined based on the T_VARIABLE token.
return;
}
unset($next);
$type = 'staticvar';
}
$endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1));
if ($endOfStatement === false) {
// No semi-colon - live coding.
return;
}
$targetNestingLevel = 0;
if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
$targetNestingLevel = \count($tokens[$stackPtr]['nested_parenthesis']);
}
// Examine each variable/constant in multi-declarations.
$start = $stackPtr;
$end = $stackPtr;
while (($end = $phpcsFile->findNext(array(\T_COMMA, \T_SEMICOLON, \T_OPEN_SHORT_ARRAY, \T_CLOSE_TAG), ($end + 1), ($endOfStatement + 1))) !== false) {
$maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $targetNestingLevel);
if ($maybeSkipTo !== true) {
$end = $maybeSkipTo;
continue;
}
$start = $phpcsFile->findNext(Tokens::$emptyTokens, ($start + 1), $end, true);
if ($start === false
|| ($tokens[$stackPtr]['code'] === \T_CONST && $tokens[$start]['code'] !== \T_STRING)
|| ($tokens[$stackPtr]['code'] !== \T_CONST && $tokens[$start]['code'] !== \T_VARIABLE)
) {
// Shouldn't be possible.
continue;
}
if ($this->isValidAssignment($phpcsFile, $start, $end) === false) {
// Create the "found" snippet.
$content = '';
$tokenCount = ($end - $start);
if ($tokenCount < 20) {
// Prevent large arrays from being added to the error message.
$content = $phpcsFile->getTokensAsString($start, ($tokenCount + 1));
}
$this->throwError($phpcsFile, $start, $type, $content);
}
$start = $end;
}
// Skip to the end of the statement to prevent duplicate messages for multi-declarations.
return $endOfStatement;
}
Switch 6562 at /home/nikic/package-analysis/sources/square/connect/lib/Api/CustomersApi.php:150
switch ($e->getCode()) {
case 200:
$data = \SquareConnect\ObjectSerializer::deserialize($e->getResponseBody(), '\SquareConnect\Model\CreateCustomerResponse', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
Switch 2354 at /home/nikic/package-analysis/sources/zendframework/zendframework1/library/Zend/Form/Decorator/Label.php:338
switch ($placementOpt) {
case self::APPEND:
case self::PREPEND:
case self::IMPLICIT:
case self::IMPLICIT_PREPEND:
case self::IMPLICIT_APPEND:
$placement = $this->_placement = $placementOpt;
break;
case false:
$placement = $this->_placement = null;
break;
default:
break;
}
Switch 522 at /home/nikic/package-analysis/sources/johnpbloch/wordpress-core/wp-admin/includes/ajax-actions.php:3849
switch ( $context ) {
case 'site-icon':
require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';
$wp_site_icon = new WP_Site_Icon();
// Skip creating a new attachment if the attachment is a Site Icon.
if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) {
// Delete the temporary cropped file, we don't need it.
wp_delete_file( $cropped );
// Additional sizes in wp_prepare_attachment_for_js().
add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );
break;
}
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
$object = $wp_site_icon->create_attachment_object( $cropped, $attachment_id );
unset( $object['ID'] );
// Update the attachment.
add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) );
$attachment_id = $wp_site_icon->insert_attachment( $object, $cropped );
remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) );
// Additional sizes in wp_prepare_attachment_for_js().
add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );
break;
default:
/**
* Fires before a cropped image is saved.
*
* Allows to add filters to modify the way a cropped image is saved.
*
* @since 4.3.0
*
* @param string $context The Customizer control requesting the cropped image.
* @param int $attachment_id The attachment ID of the original image.
* @param string $cropped Path to the cropped image file.
*/
do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
$parent_url = wp_get_attachment_url( $attachment_id );
$url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
$size = @getimagesize( $cropped );
$image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
$object = array(
'post_title' => wp_basename( $cropped ),
'post_content' => $url,
'post_mime_type' => $image_type,
'guid' => $url,
'context' => $context,
);
$attachment_id = wp_insert_attachment( $object, $cropped );
$metadata = wp_generate_attachment_metadata( $attachment_id, $cropped );
/**
* Filters the cropped image attachment metadata.
*
* @since 4.3.0
*
* @see wp_generate_attachment_metadata()
*
* @param array $metadata Attachment metadata.
*/
$metadata = apply_filters( 'wp_ajax_cropped_attachment_metadata', $metadata );
wp_update_attachment_metadata( $attachment_id, $metadata );
/**
* Filters the attachment ID for a cropped image.
*
* @since 4.3.0
*
* @param int $attachment_id The attachment ID of the cropped image.
* @param string $context The Customizer control requesting the cropped image.
*/
$attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context );
}
Switch 4972 at /home/nikic/package-analysis/sources/phayes/geophp/lib/adapters/WKB.class.php:69
switch ($base_info['type']) {
case 1:
return $this->getPoint($mem);
case 2:
return $this->getLinstring($mem);
case 3:
return $this->getPolygon($mem);
case 4:
return $this->getMulti($mem,'point');
case 5:
return $this->getMulti($mem,'line');
case 6:
return $this->getMulti($mem,'polygon');
case 7:
return $this->getMulti($mem,'geometry');
}
Switch 8179 at /home/nikic/package-analysis/sources/typo3/cms-core/Classes/TypoScript/ExtendedTemplateService.php:993
switch ($typeDat['type']) {
case 'int':
case 'int+':
$additionalAttributes = '';
if ($typeDat['paramstr']) {
$hint = ' Range: ' . $typeDat['paramstr'];
} elseif ($typeDat['type'] === 'int+') {
$hint = ' Range: 0 - ';
$typeDat['min'] = 0;
} else {
$hint = ' (Integer)';
}
if (isset($typeDat['min'])) {
$additionalAttributes .= ' min="' . (int)$typeDat['min'] . '" ';
}
if (isset($typeDat['max'])) {
$additionalAttributes .= ' max="' . (int)$typeDat['max'] . '" ';
}
$p_field =
'<input class="form-control" id="' . $idName . '" type="number"'
. ' name="' . $fN . '" value="' . $fV . '" onChange="uFormUrl(' . $aname . ')"' . $additionalAttributes . ' />';
break;
case 'color':
$p_field = '
<input class="form-control formengine-colorpickerelement t3js-color-picker" type="text" id="input-' . $idName . '" rel="' . $idName .
'" name="' . $fN . '" value="' . $fV . '" onChange="uFormUrl(' . $aname . ')" />';
if (empty($this->inlineJavaScript[$typeDat['type']])) {
$this->inlineJavaScript[$typeDat['type']] = 'require([\'TYPO3/CMS/Backend/ColorPicker\'], function(ColorPicker){ColorPicker.initialize()});';
}
break;
case 'wrap':
$wArr = explode('|', $fV);
$p_field = '<div class="input-group">
<input class="form-control form-control-adapt" type="text" id="' . $idName . '" name="' . $fN . '" value="' . $wArr[0] . '" onChange="uFormUrl(' . $aname . ')" />
<span class="input-group-addon input-group-icon">|</span>
<input class="form-control form-control-adapt" type="text" name="W' . $fN . '" value="' . $wArr[1] . '" onChange="uFormUrl(' . $aname . ')" />
</div>';
break;
case 'offset':
$wArr = explode(',', $fV);
$labels = GeneralUtility::trimExplode(',', $typeDat['paramstr']);
$p_field = '<span class="input-group-addon input-group-icon">' . ($labels[0] ?: 'x') . '</span><input type="text" class="form-control form-control-adapt" name="' . $fN . '" value="' . $wArr[0] . '" onChange="uFormUrl(' . $aname . ')" />';
$p_field .= '<span class="input-group-addon input-group-icon">' . ($labels[1] ?: 'y') . '</span><input type="text" name="W' . $fN . '" value="' . $wArr[1] . '" class="form-control form-control-adapt" onChange="uFormUrl(' . $aname . ')" />';
$labelsCount = count($labels);
for ($aa = 2; $aa < $labelsCount; $aa++) {
if ($labels[$aa]) {
$p_field .= '<span class="input-group-addon input-group-icon">' . $labels[$aa] . '</span><input type="text" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" class="form-control form-control-adapt" onChange="uFormUrl(' . $aname . ')" />';
} else {
$p_field .= '<input type="hidden" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" />';
}
}
$p_field = '<div class="input-group">' . $p_field . '</div>';
break;
case 'options':
if (is_array($typeDat['params'])) {
$p_field = '';
foreach ($typeDat['params'] as $val) {
$vParts = explode('=', $val, 2);
$label = $vParts[0];
$val = $vParts[1] ?? $vParts[0];
// option tag:
$sel = '';
if ($val === $params['value']) {
$sel = ' selected';
}
$p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $this->getLanguageService()->sL($label) . '</option>';
}
$p_field = '<select class="form-control" id="' . $idName . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
}
break;
case 'boolean':
$sel = $fV ? 'checked' : '';
$p_field =
'<input type="hidden" name="' . $fN . '" value="0" />'
. '<label class="btn btn-default btn-checkbox">'
. '<input id="' . $idName . '" type="checkbox" name="' . $fN . '" value="' . ($typeDat['paramstr'] ?: 1) . '" ' . $sel . ' onClick="uFormUrl(' . $aname . ')" />'
. '<span class="t3-icon fa"></span>'
. '</label>';
break;
case 'comment':
$sel = $fV ? 'checked' : '';
$p_field =
'<input type="hidden" name="' . $fN . '" value="#" />'
. '<label class="btn btn-default btn-checkbox">'
. '<input id="' . $idName . '" type="checkbox" name="' . $fN . '" value="" ' . $sel . ' onClick="uFormUrl(' . $aname . ')" />'
. '<span class="t3-icon fa"></span>'
. '</label>';
break;
case 'file':
// extensionlist
$extList = $typeDat['paramstr'];
if ($extList === 'IMAGE_EXT') {
$extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
}
$p_field = '<option value="">(' . $extList . ')</option>';
if (trim($params['value'])) {
$val = $params['value'];
$p_field .= '<option value=""></option>';
$p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>';
}
$p_field = '<select class="form-select" id="' . $idName . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
break;
case 'user':
$userFunction = $typeDat['paramstr'];
$userFunctionParams = ['fieldName' => $fN, 'fieldValue' => $fV];
$p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this);
break;
default:
$p_field = '<input class="form-control" id="' . $idName . '" type="text" name="' . $fN . '" value="' . $fV . '"'
. ' onChange="uFormUrl(' . $aname . ')" />';
}
Switch 6080 at /home/nikic/package-analysis/sources/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion70.php:195
switch ($tokenType = $this->tokenizer->peek()) {
case Tokens::T_ARRAY:
$type = $this->parseArrayType();
break;
case Tokens::T_SELF:
$type = $this->parseSelfType();
break;
case Tokens::T_PARENT:
$type = $this->parseParentType();
break;
default:
$type = $this->parseTypeHint();
break;
}
Switch 5997 at /home/nikic/package-analysis/sources/liuggio/fastest/adapters/Environment/FastestEnvironment.php:23
switch (true) {
// Check request query
case isset($_GET[$testDbEnvVarName]):
$envVarValue = $_GET[$testDbEnvVarName];
break;
// Check cookie
case isset($_COOKIE[$testDbEnvVarName]):
$envVarValue = $_COOKIE[$testDbEnvVarName];
break;
// Check HTTP header
case isset($_SERVER[$httpHeaderName]):
$envVarValue = $_SERVER[$httpHeaderName];
break;
// Not found
default:
return;
}
Switch 6758 at /home/nikic/package-analysis/sources/linfo/linfo/src/Linfo/OS/Linux.php:1332
switch ($status_matches[$i][2]) {
case 'D': // blocked on disk IO
case 'S':
$state = 'Up (Sleeping)';
break;
case 'Z':
$state = 'Zombie';
break;
// running
case 'R':
$state = 'Up (Running)';
break;
// stopped
case 'T':
$state = 'Up (Stopped)';
break;
}
Switch 6718 at /home/nikic/package-analysis/sources/simplepie/simplepie/idn/idna_convert.class.php:244
switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
case 'utf8':
return $return;
break;
case 'ucs4_string':
return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));
break;
case 'ucs4_array':
return $this->_utf8_to_ucs4($return);
break;
default:
$this->_error('Unsupported output format');
return false;
}
Switch 1451 at /home/nikic/package-analysis/sources/drupal/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php:431
switch ($name) {
case 'test_route_1':
return (new GeneratedUrl())->setGeneratedUrl('/test-route-1');
case 'test_route_3':
return (new GeneratedUrl())->setGeneratedUrl('/test-route-3');
case 'test_route_4':
if ($parameters['object'] == '1') {
return (new GeneratedUrl())->setGeneratedUrl('/test-route-4/1');
}
}
Switch 9152 at /home/nikic/package-analysis/sources/codeception/codeception/src/Codeception/Lib/ParamsLoader.php:89
switch ($type) {
case 'bool':
case 'boolean':
case 'int':
case 'integer':
case 'float':
case 'double':
$a[$key] = settype($value, $type);
break;
case 'constant':
$a[$key] = constant($value);
break;
case 'collection':
$a[$key] = $paramsToArray($param);
break;
default:
$a[$key] = (string) $param;
}
Switch 4192 at /home/nikic/package-analysis/sources/maatwebsite/excel/src/Maatwebsite/Excel/Readers/HtmlReader.php:336
switch ($child->nodeName)
{
// Meta tags
case 'meta' :
// Loop through the attributes
foreach ($attributeArray as $attributeName => $attributeValue)
{
// Switch the names
switch ($attributeName)
{
// Set input encoding
case 'charset':
$_inputEncoding = $attributeValue;
break;
}
}
// Continue processing dom element
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
break;
// Set sheet title
case 'title' :
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
$sheet->setTitle($cellContent);
$cellContent = '';
break;
// Text
case 'span' :
case 'div' :
case 'font' :
case 'i' :
case 'em' :
case 'strong':
case 'b' :
// Add space after empty cells
if ( $cellContent > '' )
$cellContent .= ' ';
// Continue processing
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
// Add space after empty cells
if ( $cellContent > '' )
$cellContent .= ' ';
// Set the styling
if ( isset($this->_formats[$child->nodeName]) )
{
$sheet->getStyle($column . $row)
->applyFromArray($this->_formats[$child->nodeName]);
}
break;
// Horizontal rules
case 'hr' :
// Flush the cell
$this->flushCell($sheet, $column, $row, $cellContent);
// count
++$row;
// Set the styling
if ( isset($this->_formats[$child->nodeName]) )
{
$sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]);
}
// If not, enter cell content
else
{
$cellContent = '----------';
$this->flushCell($sheet, $column, $row, $cellContent);
}
++$row;
// Linebreaks
case 'br' :
// Add linebreak
if ( $this->_tableLevel > 0 )
{
$cellContent .= "\n";
}
// Otherwise flush our existing content and move the row cursor on
else
{
$this->flushCell($sheet, $column, $row, $cellContent);
++$row;
}
break;
// Hyperlinks
case 'a' :
foreach ($attributeArray as $attributeName => $attributeValue)
{
switch ($attributeName)
{
case 'href':
// Set the url
$sheet->getCell($column . $row)
->getHyperlink()
->setUrl($attributeValue);
// Set styling
if ( isset($this->_formats[$child->nodeName]) )
{
$sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]);
}
break;
}
}
// Add empty space
$cellContent .= ' ';
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
break;
// Headings/paragraphs and lists
case 'h1' :
case 'h2' :
case 'h3' :
case 'h4' :
case 'h5' :
case 'h6' :
case 'ol' :
case 'ul' :
case 'p' :
if ( $this->_tableLevel > 0 )
{
$cellContent .= "\n";
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
$this->flushCell($sheet, $column, $row, $cellContent);
// Set style
if ( isset($this->_formats[$child->nodeName]) )
{
$sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]);
}
}
else
{
if ( $cellContent > '' )
{
$this->flushCell($sheet, $column, $row, $cellContent);
$row += 2;
}
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
$this->flushCell($sheet, $column, $row, $cellContent);
// Set style
if ( isset($this->_formats[$child->nodeName]) )
{
$sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]);
}
$row += 2;
$column = 'A';
}
break;
// List istem
case 'li' :
if ( $this->_tableLevel > 0 )
{
// If we're inside a table, replace with a \n
$cellContent .= "\n";
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
}
else
{
if ( $cellContent > '' )
{
$this->flushCell($sheet, $column, $row, $cellContent);
}
++$row;
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
$this->flushCell($sheet, $column, $row, $cellContent);
$column = 'A';
}
break;
// Tables
case 'table' :
// Flush the cells
$this->flushCell($sheet, $column, $row, $cellContent);
// Set the start column
$column = $this->_setTableStartColumn($column);
if ( $this->_tableLevel > 1 )
--$row;
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
// Release the table start column
$column = $this->_releaseTableStartColumn();
if ( $this->_tableLevel > 1 )
{
++$column;
}
else
{
++$row;
}
break;
// Heading and body
case 'thead' :
case 'tbody' :
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
break;
case 'img':
$this->insertImageBySrc($sheet, $column, $row, $child);
break;
// Table rows
case 'tr' :
// Get start column
$column = $this->_getTableStartColumn();
// Set empty cell content
$cellContent = '';
// Continue processing
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
++$row;
// reset the span height
$this->spanHeight = 1;
break;
// Table heading
case 'th' :
// Continue processing
$this->_processHeadings($child, $sheet, $row, $column, $cellContent);
// If we have a colspan, count the right amount of columns, else just 1
for ($w = 0; $w < $this->spanWidth; $w++)
{
++$column;
}
// reset the span width after the process
$this->spanWidth = 1;
break;
// Table cell
case 'td' :
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
$this->flushCell($sheet, $column, $row, $cellContent);
// If we have a colspan, count the right amount of columns, else just 1
for ($w = 0; $w < $this->spanWidth; $w++)
{
++$column;
}
// reset the span width after the process
$this->spanWidth = 1;
break;
// Html Body
case 'body' :
$row = 1;
$column = 'A';
$content = '';
$this->_tableLevel = 0;
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
break;
// Default
default:
$this->_processDomElement($child, $sheet, $row, $column, $cellContent, $format);
}
Switch 4099 at /home/nikic/package-analysis/sources/hoa/ustring/Bin/Tocode.php:68
switch ($c) {
case 'b':
$base = intval($v);
break;
case '__ambiguous':
$this->resolveOptionAmbiguity($v);
break;
case 'h':
case '?':
default:
return $this->usage();
}
Switch 6773 at /home/nikic/package-analysis/sources/linfo/linfo/src/Linfo/OS/FreeBSD.php:600
switch ($bat_status) {
case 0:
$status = 'High';
break;
case 1:
$status = 'Low';
break;
case 2:
$status = 'Critical';
break;
case 3:
$status = 'Charging';
break;
default:
$status = 'Unknown';
break;
}
Switch 2727 at /home/nikic/package-analysis/sources/zendframework/zendpdf/library/ZendPdf/BinaryParser/Image/Png.php:184
switch($chunkType) {
case 'IDAT': // This chunk may appear more than once. It contains the actual image data.
$this->_parseIDATChunk($offset, $chunkLength);
break;
case 'PLTE': // This chunk contains the image palette.
$this->_parsePLTEChunk($offset, $chunkLength);
break;
case 'tRNS': // This chunk contains non-alpha channel transparency data
$this->_parseTRNSChunk($offset, $chunkLength);
break;
case 'IEND':
break 2; //End the loop too
//@TODO Implement the rest of the PNG chunks. (There are many not implemented here)
}
Switch 6779 at /home/nikic/package-analysis/sources/linfo/linfo/src/Linfo/Parsers/Hddtemp.php:172
switch ($this->mode) {
// Connect to daemon mode
case 'daemon':
return $this->parseSockData($this->getSock());
break;
// Syslog every n seconds
case 'syslog':
return $this->parseSysLogData();
break;
// Some other mode
default:
throw new Exception('Not supported mode');
break;
}
Switch 2710 at /home/nikic/package-analysis/sources/zendframework/zend-mail/src/Protocol/Imap.php:73
switch ($ssl) {
case 'ssl':
$host = 'ssl://' . $host;
if (! $port) {
$port = 993;
}
break;
case 'tls':
$isTls = true;
// break intentionally omitted
default:
if (! $port) {
$port = 143;
}
}
Switch 149 at /home/nikic/package-analysis/sources/markrogoyski/math-php/src/LinearAlgebra/Decomposition/Cholesky.php:115
switch ($name) {
case 'L':
return $this->L;
case 'LT':
case 'Lᵀ':
return $this->Lᵀ;
default:
throw new Exception\MatrixException("Cholesky class does not have a gettable property: $name");
}
Switch 7501 at /home/nikic/package-analysis/sources/greenlion/php-sql-parser/src/PHPSQLParser/processors/GroupByProcessor.php:54
switch ($trim) {
case ',':
$parsed = $this->processOrderExpression($parseInfo, $select);
unset($parsed['direction']);
$out[] = $parsed;
$parseInfo = $this->initParseInfo();
break;
default:
$parseInfo['base_expr'] .= $token;
}
Switch 1197 at /home/nikic/package-analysis/sources/symfony/symfony/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php:114
switch ($operator) {
case '|':
return $left | $right;
case '^':
return $left ^ $right;
case '&':
return $left & $right;
case '==':
return $left == $right;
case '===':
return $left === $right;
case '!=':
return $left != $right;
case '!==':
return $left !== $right;
case '<':
return $left < $right;
case '>':
return $left > $right;
case '>=':
return $left >= $right;
case '<=':
return $left <= $right;
case 'not in':
return !\in_array($left, $right);
case 'in':
return \in_array($left, $right);
case '+':
return $left + $right;
case '-':
return $left - $right;
case '~':
return $left.$right;
case '*':
return $left * $right;
case '/':
if (0 == $right) {
throw new \DivisionByZeroError('Division by zero');
}
return $left / $right;
case '%':
if (0 == $right) {
throw new \DivisionByZeroError('Modulo by zero');
}
return $left % $right;
case 'matches':
return preg_match($right, $left);
}
Switch 6845 at /home/nikic/package-analysis/sources/illuminate/auth/CreatesUserProviders.php:36
switch ($driver) {
case 'database':
return $this->createDatabaseProvider($config);
case 'eloquent':
return $this->createEloquentProvider($config);
default:
throw new InvalidArgumentException(
"Authentication user provider [{$driver}] is not defined."
);
}
Switch 6610 at /home/nikic/package-analysis/sources/square/connect/lib/Api/V1ItemsApi.php:2547
switch ($e->getCode()) {
case 200:
$data = \SquareConnect\ObjectSerializer::deserialize($e->getResponseBody(), '\SquareConnect\Model\V1Discount[]', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
Switch 1088 at /home/nikic/package-analysis/sources/twig/twig/src/Lexer.php:174
switch ($this->state) {
case self::STATE_DATA:
$this->lexData();
break;
case self::STATE_BLOCK:
$this->lexBlock();
break;
case self::STATE_VAR:
$this->lexVar();
break;
case self::STATE_STRING:
$this->lexString();
break;
case self::STATE_INTERPOLATION:
$this->lexInterpolation();
break;
}
Switch 2806 at /home/nikic/package-analysis/sources/sylius/theme-bundle/src/Asset/Installer/OutputAwareAssetsInstaller.php:73
switch ($symlinkMask) {
case AssetsInstallerInterface::HARD_COPY:
return 'The assets were copied.';
case AssetsInstallerInterface::SYMLINK:
return 'The assets were installed using symbolic links.';
case AssetsInstallerInterface::RELATIVE_SYMLINK:
return 'The assets were installed using relative symbolic links.';
}
Switch 3393 at /home/nikic/package-analysis/sources/roots/wordpress/wp-includes/ID3/module.audio-video.riff.php:744
switch ($strhfccType) {
case 'auds':
$thisfile_audio['bitrate_mode'] = 'cbr';
$thisfile_audio_dataformat = 'wav';
if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) {
$streamindex = count($thisfile_riff_audio);
}
$thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($strfData);
$thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag'];
// shortcut
$thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex];
$thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex];
if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) {
unset($thisfile_audio_streams_currentstream['bits_per_sample']);
}
$thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag'];
unset($thisfile_audio_streams_currentstream['raw']);
// shortcut
$thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw'];
unset($thisfile_riff_audio[$streamindex]['raw']);
$thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]);
$thisfile_audio['lossless'] = false;
switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) {
case 0x0001: // PCM
$thisfile_audio_dataformat = 'wav';
$thisfile_audio['lossless'] = true;
break;
case 0x0050: // MPEG Layer 2 or Layer 1
$thisfile_audio_dataformat = 'mp2'; // Assume Layer-2
break;
case 0x0055: // MPEG Layer 3
$thisfile_audio_dataformat = 'mp3';
break;
case 0x00FF: // AAC
$thisfile_audio_dataformat = 'aac';
break;
case 0x0161: // Windows Media v7 / v8 / v9
case 0x0162: // Windows Media Professional v9
case 0x0163: // Windows Media Lossess v9
$thisfile_audio_dataformat = 'wma';
break;
case 0x2000: // AC-3
$thisfile_audio_dataformat = 'ac3';
break;
case 0x2001: // DTS
$thisfile_audio_dataformat = 'dts';
break;
default:
$thisfile_audio_dataformat = 'wav';
break;
}
$thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat;
$thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless'];
$thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
break;
case 'iavs':
case 'vids':
// shortcut
$thisfile_riff_raw['strh'][$i] = array();
$thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i];
$thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType;
$thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4);
$thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags
$thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2));
$thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2));
$thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4));
$thisfile_riff_raw_strh_current['dwScale'] = $this->EitherEndian2Int(substr($strhData, 20, 4));
$thisfile_riff_raw_strh_current['dwRate'] = $this->EitherEndian2Int(substr($strhData, 24, 4));
$thisfile_riff_raw_strh_current['dwStart'] = $this->EitherEndian2Int(substr($strhData, 28, 4));
$thisfile_riff_raw_strh_current['dwLength'] = $this->EitherEndian2Int(substr($strhData, 32, 4));
$thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4));
$thisfile_riff_raw_strh_current['dwQuality'] = $this->EitherEndian2Int(substr($strhData, 40, 4));
$thisfile_riff_raw_strh_current['dwSampleSize'] = $this->EitherEndian2Int(substr($strhData, 44, 4));
$thisfile_riff_raw_strh_current['rcFrame'] = $this->EitherEndian2Int(substr($strhData, 48, 4));
$thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']);
$thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler'];
if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
$thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']);
$thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
}
$thisfile_video['codec'] = $thisfile_riff_video_current['codec'];
$thisfile_video['pixel_aspect_ratio'] = (float) 1;
switch ($thisfile_riff_raw_strh_current['fccHandler']) {
case 'HFYU': // Huffman Lossless Codec
case 'IRAW': // Intel YUV Uncompressed
case 'YUY2': // Uncompressed YUV 4:2:2
$thisfile_video['lossless'] = true;
break;
default:
$thisfile_video['lossless'] = false;
break;
}
switch ($strhfccType) {
case 'vids':
$thisfile_riff_raw_strf_strhfccType_streamindex = self::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($this->container == 'riff'));
$thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'];
if ($thisfile_riff_video_current['codec'] == 'DV') {
$thisfile_riff_video_current['dv_type'] = 2;
}
break;
case 'iavs':
$thisfile_riff_video_current['dv_type'] = 1;
break;
}
break;
default:
$this->warning('Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"');
break;
}
Switch 8361 at /home/nikic/package-analysis/sources/typo3/cms-frontend/Classes/Middleware/StaticRouteResolver.php:149
switch ($type) {
case 'staticText':
$content = $routeConfig['content'];
$contentType = 'text/plain; charset=utf-8';
break;
case 'uri':
$urlParams = $this->linkService->resolve($routeConfig['source']);
if ($urlParams['type'] === 'url' || $urlParams['type'] === 'page') {
$uri = $urlParams['url'] ?? $this->getPageUri($request, $site, $urlParams);
[$content, $contentType] = $this->getFromUri($uri);
} elseif ($urlParams['type'] === 'file') {
[$content, $contentType] = $this->getFromFile($urlParams['file']);
} else {
throw new \InvalidArgumentException('Can only handle URIs of type page, url or file.', 1537348076);
}
break;
default:
throw new \InvalidArgumentException(
'Can only handle static file configurations with type uri or staticText.',
1537348083
);
}
Switch 4473 at /home/nikic/package-analysis/sources/phan/phan/src/Phan/ForkPool/Reader.php:73
switch ($this->parsing_mode) {
case self::PARSE_HEADERS:
if ($this->buffer === "\r\n") {
$this->parsing_mode = self::PARSE_BODY;
$this->content_length = (int)$this->headers['Content-Length'];
$this->notification_type = $this->headers['Notification-Type'] ?? 'unknown';
$this->buffer = '';
} elseif (\substr($this->buffer, -2) === "\r\n") {
$parts = \explode(':', $this->buffer);
$this->headers[$parts[0]] = \trim($parts[1]);
$this->buffer = '';
}
break;
case self::PARSE_BODY:
if (\strlen($this->buffer) < $this->content_length) {
// We know the number of remaining bytes to read - try to read them all at once.
$buf = \fread($this->input, $this->content_length - \strlen($this->buffer));
if (\is_string($buf) && \strlen($buf) > 0) {
$this->buffer .= $buf;
}
}
if (\strlen($this->buffer) === $this->content_length) {
$this->read_messages[$this->notification_type] = ($this->read_messages[$this->notification_type] ?? 0) + 1;
($this->notification_handler)($this->notification_type, $this->buffer);
$this->parsing_mode = self::PARSE_HEADERS;
$this->headers = [];
$this->buffer = '';
}
break;
}
Switch 8543 at /home/nikic/package-analysis/sources/phing/phing/classes/phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php:168
switch ($this->state) {
case self::STATE_NORMAL:
switch ($ch) {
case '-':
if ('-' == $this->getc()) {
$this->state = self::STATE_COMMENT_LINEEND;
} else {
$this->ungetc();
}
break;
case '"':
$this->state = self::STATE_DOUBLE_QUOTED;
break;
case "'":
$this->state = self::STATE_SINGLE_QUOTED;
break;
case '/':
if ('*' == $this->getc()) {
$this->state = self::STATE_COMMENT_MULTILINE;
$this->commentDepth = 1;
} else {
$this->ungetc();
}
break;
case '$':
if (false !== ($tag = $this->checkDollarQuote())) {
$this->state = self::STATE_DOLLAR_QUOTED;
$this->quotingTag = $tag;
$sql .= '$' . $tag . '$';
continue 3;
}
break;
case '(':
$openParens++;
break;
case ')':
$openParens--;
break;
// technically we can use e.g. psql's \g command as delimiter
case $delimiter[0]:
// special case to allow "create rule" statements
// http://www.postgresql.org/docs/current/interactive/sql-createrule.html
if (';' == $delimiter && 0 < $openParens) {
break;
}
$hasQuery = true;
for ($i = 1, $delimiterLength = strlen($delimiter); $i < $delimiterLength; $i++) {
if ($delimiter[$i] != $this->getc()) {
$hasQuery = false;
}
}
if ($hasQuery) {
return $sql;
}
for ($j = 1; $j < $i; $j++) {
$this->ungetc();
}
}
break;
case self::STATE_COMMENT_LINEEND:
if ("\n" == $ch) {
$this->state = self::STATE_NORMAL;
}
break;
case self::STATE_COMMENT_MULTILINE:
switch ($ch) {
case '/':
if ('*' != $this->getc()) {
$this->ungetc();
} else {
$this->commentDepth++;
}
break;
case '*':
if ('/' != $this->getc()) {
$this->ungetc();
} else {
$this->commentDepth--;
if (0 == $this->commentDepth) {
$this->state = self::STATE_NORMAL;
continue 3;
}
}
}
// no break
case self::STATE_SINGLE_QUOTED:
case self::STATE_DOUBLE_QUOTED:
if ($this->escape) {
$this->escape = false;
break;
}
$quote = $this->state == self::STATE_SINGLE_QUOTED ? "'" : '"';
switch ($ch) {
case '\\':
$this->escape = true;
break;
case $quote:
if ($quote == $this->getc()) {
$sql .= $quote;
} else {
$this->ungetc();
$this->state = self::STATE_NORMAL;
}
}
// no break
case self::STATE_DOLLAR_QUOTED:
if ('$' == $ch && false !== ($tag = $this->checkDollarQuote())) {
if ($tag == $this->quotingTag) {
$this->state = self::STATE_NORMAL;
}
$sql .= '$' . $tag . '$';
continue 2;
}
}
Switch 8792 at /home/nikic/package-analysis/sources/doctrine/annotations/lib/Doctrine/Annotations/DocParser.php:1044
switch ($this->lexer->lookahead['type']) {
case DocLexer::T_STRING:
$this->match(DocLexer::T_STRING);
return $this->lexer->token['value'];
case DocLexer::T_INTEGER:
$this->match(DocLexer::T_INTEGER);
return (int)$this->lexer->token['value'];
case DocLexer::T_FLOAT:
$this->match(DocLexer::T_FLOAT);
return (float)$this->lexer->token['value'];
case DocLexer::T_TRUE:
$this->match(DocLexer::T_TRUE);
return true;
case DocLexer::T_FALSE:
$this->match(DocLexer::T_FALSE);
return false;
case DocLexer::T_NULL:
$this->match(DocLexer::T_NULL);
return null;
default:
$this->syntaxError('PlainValue');
}
Switch 8776 at /home/nikic/package-analysis/sources/bacon/bacon-qr-code/src/Renderer/Image/ImagickImageBackEnd.php:239
switch ($gradient->getType()) {
case GradientType::HORIZONTAL():
$gradientImage->newPseudoImage((int) $height, (int) $width, sprintf(
'gradient:%s-%s',
$startColor,
$endColor
));
$gradientImage->rotateImage('transparent', -90);
break;
case GradientType::VERTICAL():
$gradientImage->newPseudoImage((int) $width, (int) $height, sprintf(
'gradient:%s-%s',
$startColor,
$endColor
));
break;
case GradientType::DIAGONAL():
case GradientType::INVERSE_DIAGONAL():
$gradientImage->newPseudoImage((int) ($width * sqrt(2)), (int) ($height * sqrt(2)), sprintf(
'gradient:%s-%s',
$startColor,
$endColor
));
if (GradientType::DIAGONAL() === $gradient->getType()) {
$gradientImage->rotateImage('transparent', -45);
} else {
$gradientImage->rotateImage('transparent', -135);
}
$rotatedWidth = $gradientImage->getImageWidth();
$rotatedHeight = $gradientImage->getImageHeight();
$gradientImage->setImagePage($rotatedWidth, $rotatedHeight, 0, 0);
$gradientImage->cropImage(
intdiv($rotatedWidth, 2) - 2,
intdiv($rotatedHeight, 2) - 2,
intdiv($rotatedWidth, 4) + 1,
intdiv($rotatedWidth, 4) + 1
);
break;
case GradientType::RADIAL():
$gradientImage->newPseudoImage((int) $width, (int) $height, sprintf(
'radial-gradient:%s-%s',
$startColor,
$endColor
));
break;
}
Switch 1165 at /home/nikic/package-analysis/sources/symfony/symfony/src/Symfony/Component/Lock/Store/PdoStore.php:265
switch ($driver) {
case 'mysql':
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR(44) NOT NULL, $this->expirationCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
break;
case 'sqlite':
$sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->tokenCol TEXT NOT NULL, $this->expirationCol INTEGER)";
break;
case 'pgsql':
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR(64) NOT NULL, $this->expirationCol INTEGER)";
break;
case 'oci':
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR2(64) NOT NULL, $this->expirationCol INTEGER)";
break;
case 'sqlsrv':
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR(64) NOT NULL, $this->expirationCol INTEGER)";
break;
default:
throw new \DomainException(sprintf('Creating the lock table is currently not implemented for PDO driver "%s".', $driver));
}
Switch 2805 at /home/nikic/package-analysis/sources/sylius/sylius/src/Sylius/Component/Addressing/Matcher/ZoneMatcher.php:96
switch ($type = $member->getBelongsTo()->getType()) {
case ZoneInterface::TYPE_PROVINCE:
return null !== $address->getProvinceCode() && $address->getProvinceCode() === $member->getCode();
case ZoneInterface::TYPE_COUNTRY:
return null !== $address->getCountryCode() && $address->getCountryCode() === $member->getCode();
case ZoneInterface::TYPE_ZONE:
$zone = $this->getZoneByCode($member->getCode());
return null !== $zone && $this->addressBelongsToZone($address, $zone);
default:
throw new \InvalidArgumentException(sprintf('Unexpected zone type "%s".', $type));
}
Switch 8388 at /home/nikic/package-analysis/sources/api-platform/core/src/Bridge/Doctrine/MongoDbOdm/Filter/SearchFilter.php:169
switch ($strategy) {
case MongoDbType::STRING !== $type:
return MongoDbType::getType($type)->convertToDatabaseValue($value);
case null:
case self::STRATEGY_EXACT:
return $caseSensitive ? $value : new Regex("^$value$", 'i');
case self::STRATEGY_PARTIAL:
return new Regex($value, $caseSensitive ? '' : 'i');
case self::STRATEGY_START:
return new Regex("^$value", $caseSensitive ? '' : 'i');
case self::STRATEGY_END:
return new Regex("$value$", $caseSensitive ? '' : 'i');
case self::STRATEGY_WORD_START:
return new Regex("(^$value.*|.*\s$value.*)", $caseSensitive ? '' : 'i');
default:
throw new InvalidArgumentException(sprintf('strategy %s does not exist.', $strategy));
}
Switch 8294 at /home/nikic/package-analysis/sources/typo3/cms-extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php:888
switch ($rootLevel) {
// Only in pid 0
case 1:
$storagePageIds = [0];
break;
// Pid 0 and pagetree
case -1:
if (empty($storagePageIds)) {
$storagePageIds = [0];
} else {
$storagePageIds[] = 0;
}
break;
// Only pagetree or not set
case 0:
if (empty($storagePageIds)) {
throw new InconsistentQuerySettingsException('Missing storage page ids.', 1365779762);
}
break;
// Invalid configuration
default:
return '';
}
Switch 3840 at /home/nikic/package-analysis/sources/magento/zendframework1/library/Zend/Pdf/Canvas/Abstract.php:1013
switch ($fillType) {
case Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE:
$this->_contents .= " B*\n";
break;
case Zend_Pdf_Page::SHAPE_DRAW_FILL:
$this->_contents .= " f*\n";
break;
case Zend_Pdf_Page::SHAPE_DRAW_STROKE:
$this->_contents .= " S\n";
break;
}
Switch 3587 at /home/nikic/package-analysis/sources/geoip/geoip/src/timezone.php:308
switch ($region) {
case "AB":
$timezone = "America/Edmonton";
break;
case "BC":
$timezone = "America/Vancouver";
break;
case "MB":
$timezone = "America/Winnipeg";
break;
case "NB":
$timezone = "America/Halifax";
break;
case "NL":
$timezone = "America/St_Johns";
break;
case "NS":
$timezone = "America/Halifax";
break;
case "NT":
$timezone = "America/Yellowknife";
break;
case "NU":
$timezone = "America/Rankin_Inlet";
break;
case "ON":
$timezone = "America/Toronto";
break;
case "PE":
$timezone = "America/Halifax";
break;
case "QC":
$timezone = "America/Montreal";
break;
case "SK":
$timezone = "America/Regina";
break;
case "YT":
$timezone = "America/Whitehorse";
break;
}
Switch 6428 at /home/nikic/package-analysis/sources/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php:1778
switch ($yymajor) {
default:
break; /* If no destructor action specified: do nothing */
}
Switch 8324 at /home/nikic/package-analysis/sources/typo3/cms-impexp/Classes/Import.php:998
switch ((string)$config['type']) {
case 'db':
if (is_array($config['itemArray']) && !empty($config['itemArray'])) {
$itemConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
$valArray = $this->setRelations_db($config['itemArray'], $itemConfig);
$updateData[$table][$thisNewUid][$field] = implode(',', $valArray);
}
break;
case 'file':
if (is_array($config['newValueFiles']) && !empty($config['newValueFiles'])) {
$valArr = [];
foreach ($config['newValueFiles'] as $fI) {
$valArr[] = $this->import_addFileNameToBeCopied($fI);
}
$updateData[$table][$thisNewUid][$field] = implode(',', $valArr);
}
break;
}
Switch 1280 at /home/nikic/package-analysis/sources/symfony/twig-bridge/Mime/NotificationEmail.php:171
switch ($importance) {
case self::IMPORTANCE_URGENT:
return self::PRIORITY_HIGHEST;
case self::IMPORTANCE_HIGH:
return self::PRIORITY_HIGH;
case self::IMPORTANCE_MEDIUM:
return self::PRIORITY_NORMAL;
case self::IMPORTANCE_LOW:
default:
return self::PRIORITY_LOW;
}
Switch 2023 at /home/nikic/package-analysis/sources/zendframework/zendframework1/library/Zend/Feed/Entry/Rss.php:56
switch ($var) {
case 'content':
$prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/');
return parent::__get("$prefix:encoded");
default:
return parent::__get($var);
}
Switch 8084 at /home/nikic/package-analysis/sources/typo3/cms/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php:195
switch ($format) {
case 'date':
if ($itemValue) {
$option = isset($formatOptions['option']) ? trim($formatOptions['option']) : '';
if ($option) {
if (isset($formatOptions['strftime']) && $formatOptions['strftime']) {
$value = strftime($option, $itemValue);
} else {
$value = date($option, $itemValue);
}
} else {
$value = date('d-m-Y', $itemValue);
}
} else {
$value = '';
}
if (isset($formatOptions['appendAge']) && $formatOptions['appendAge']) {
$age = BackendUtility::calcAge(
$GLOBALS['EXEC_TIME'] - $itemValue,
$this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')
);
$value .= ' (' . $age . ')';
}
$itemValue = $value;
break;
case 'datetime':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = BackendUtility::datetime((int)$itemValue);
}
break;
case 'time':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = BackendUtility::time((int)$itemValue, false);
}
break;
case 'timesec':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = BackendUtility::time((int)$itemValue);
}
break;
case 'year':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = date('Y', (int)$itemValue);
}
break;
case 'int':
$baseArr = ['dec' => 'd', 'hex' => 'x', 'HEX' => 'X', 'oct' => 'o', 'bin' => 'b'];
$base = isset($formatOptions['base']) ? trim($formatOptions['base']) : '';
$format = $baseArr[$base] ?? 'd';
$itemValue = sprintf('%' . $format, $itemValue);
break;
case 'float':
// default precision
$precision = 2;
if (isset($formatOptions['precision'])) {
$precision = MathUtility::forceIntegerInRange($formatOptions['precision'], 1, 10, $precision);
}
$itemValue = sprintf('%.' . $precision . 'f', $itemValue);
break;
case 'number':
$format = isset($formatOptions['option']) ? trim($formatOptions['option']) : '';
$itemValue = sprintf('%' . $format, $itemValue);
break;
case 'md5':
$itemValue = md5($itemValue);
break;
case 'filesize':
// We need to cast to int here, otherwise empty values result in empty output,
// but we expect zero.
$value = GeneralUtility::formatSize((int)$itemValue);
if (!empty($formatOptions['appendByteSize'])) {
$value .= ' (' . $itemValue . ')';
}
$itemValue = $value;
break;
case 'user':
$func = trim($formatOptions['userFunc']);
if ($func) {
$params = [
'value' => $itemValue,
'args' => $formatOptions['userFunc'],
'config' => [
'type' => 'none',
'format' => $format,
'format.' => $formatOptions,
],
];
$itemValue = GeneralUtility::callUserFunction($func, $params, $this);
}
break;
default:
// Do nothing e.g. when $format === ''
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment