repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.setFont | public function setFont($font) {
if ($font === null) {
throw new CINArgumentException('Font cannot be null.', 'font');
}
$this->font = clone $font;
$this->font->setText($this->text);
$this->font->setRotationAngle($this->rotationAngle);
$this->font->se... | php | public function setFont($font) {
if ($font === null) {
throw new CINArgumentException('Font cannot be null.', 'font');
}
$this->font = clone $font;
$this->font->setText($this->text);
$this->font->setRotationAngle($this->rotationAngle);
$this->font->se... | [
"public",
"function",
"setFont",
"(",
"$",
"font",
")",
"{",
"if",
"(",
"$",
"font",
"===",
"null",
")",
"{",
"throw",
"new",
"CINArgumentException",
"(",
"'Font cannot be null.'",
",",
"'font'",
")",
";",
"}",
"$",
"this",
"->",
"font",
"=",
"clone",
... | Sets the font.
@param CINFont $font | [
"Sets",
"the",
"font",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L93-L103 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.setPosition | public function setPosition($position) {
$position = intval($position);
if ($position !== self::POSITION_TOP && $position !== self::POSITION_RIGHT && $position !== self::POSITION_BOTTOM && $position !== self::POSITION_LEFT) {
throw new CINArgumentException('The text position must be one o... | php | public function setPosition($position) {
$position = intval($position);
if ($position !== self::POSITION_TOP && $position !== self::POSITION_RIGHT && $position !== self::POSITION_BOTTOM && $position !== self::POSITION_LEFT) {
throw new CINArgumentException('The text position must be one o... | [
"public",
"function",
"setPosition",
"(",
"$",
"position",
")",
"{",
"$",
"position",
"=",
"intval",
"(",
"$",
"position",
")",
";",
"if",
"(",
"$",
"position",
"!==",
"self",
"::",
"POSITION_TOP",
"&&",
"$",
"position",
"!==",
"self",
"::",
"POSITION_RI... | Sets the text position for drawing.
@param int $position | [
"Sets",
"the",
"text",
"position",
"for",
"drawing",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L119-L126 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.setAlignment | public function setAlignment($alignment) {
$alignment = intval($alignment);
if ($alignment !== self::ALIGN_LEFT && $alignment !== self::ALIGN_TOP && $alignment !== self::ALIGN_CENTER && $alignment !== self::ALIGN_RIGHT && $alignment !== self::ALIGN_BOTTOM) {
throw new CINArgumentException... | php | public function setAlignment($alignment) {
$alignment = intval($alignment);
if ($alignment !== self::ALIGN_LEFT && $alignment !== self::ALIGN_TOP && $alignment !== self::ALIGN_CENTER && $alignment !== self::ALIGN_RIGHT && $alignment !== self::ALIGN_BOTTOM) {
throw new CINArgumentException... | [
"public",
"function",
"setAlignment",
"(",
"$",
"alignment",
")",
"{",
"$",
"alignment",
"=",
"intval",
"(",
"$",
"alignment",
")",
";",
"if",
"(",
"$",
"alignment",
"!==",
"self",
"::",
"ALIGN_LEFT",
"&&",
"$",
"alignment",
"!==",
"self",
"::",
"ALIGN_T... | Sets the text alignment for drawing.
@param int $alignment | [
"Sets",
"the",
"text",
"alignment",
"for",
"drawing",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L142-L149 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.setRotationAngle | public function setRotationAngle($rotationAngle) {
$this->rotationAngle = intval($rotationAngle);
$this->font->setRotationAngle($this->rotationAngle);
} | php | public function setRotationAngle($rotationAngle) {
$this->rotationAngle = intval($rotationAngle);
$this->font->setRotationAngle($this->rotationAngle);
} | [
"public",
"function",
"setRotationAngle",
"(",
"$",
"rotationAngle",
")",
"{",
"$",
"this",
"->",
"rotationAngle",
"=",
"intval",
"(",
"$",
"rotationAngle",
")",
";",
"$",
"this",
"->",
"font",
"->",
"setRotationAngle",
"(",
"$",
"this",
"->",
"rotationAngle... | Sets the rotation angle in degree.
@param int $rotationAngle | [
"Sets",
"the",
"rotation",
"angle",
"in",
"degree",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L201-L204 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.setBackgroundColor | public /*internal*/ function setBackgroundColor($backgroundColor) {
$this->backgroundColor = $backgroundColor;
$this->font->setBackgroundColor($this->backgroundColor);
} | php | public /*internal*/ function setBackgroundColor($backgroundColor) {
$this->backgroundColor = $backgroundColor;
$this->font->setBackgroundColor($this->backgroundColor);
} | [
"public",
"/*internal*/",
"function",
"setBackgroundColor",
"(",
"$",
"backgroundColor",
")",
"{",
"$",
"this",
"->",
"backgroundColor",
"=",
"$",
"backgroundColor",
";",
"$",
"this",
"->",
"font",
"->",
"setBackgroundColor",
"(",
"$",
"this",
"->",
"backgroundC... | Sets the background color in case of rotation.
@param CINColor $backgroundColor | [
"Sets",
"the",
"background",
"color",
"in",
"case",
"of",
"rotation",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L220-L223 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.setForegroundColor | public function setForegroundColor($foregroundColor) {
$this->foregroundColor = $foregroundColor;
$this->font->setForegroundColor($this->foregroundColor);
} | php | public function setForegroundColor($foregroundColor) {
$this->foregroundColor = $foregroundColor;
$this->font->setForegroundColor($this->foregroundColor);
} | [
"public",
"function",
"setForegroundColor",
"(",
"$",
"foregroundColor",
")",
"{",
"$",
"this",
"->",
"foregroundColor",
"=",
"$",
"foregroundColor",
";",
"$",
"this",
"->",
"font",
"->",
"setForegroundColor",
"(",
"$",
"this",
"->",
"foregroundColor",
")",
";... | Sets the foreground color.
@param CINColor $foregroundColor | [
"Sets",
"the",
"foreground",
"color",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L239-L242 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.getDimension | public function getDimension() {
$w = 0;
$h = 0;
$dimension = $this->font->getDimension();
$w = $dimension[0];
$h = $dimension[1];
if ($this->position === self::POSITION_TOP || $this->position === self::POSITION_BOTTOM) {
$h += $this->spacing;
... | php | public function getDimension() {
$w = 0;
$h = 0;
$dimension = $this->font->getDimension();
$w = $dimension[0];
$h = $dimension[1];
if ($this->position === self::POSITION_TOP || $this->position === self::POSITION_BOTTOM) {
$h += $this->spacing;
... | [
"public",
"function",
"getDimension",
"(",
")",
"{",
"$",
"w",
"=",
"0",
";",
"$",
"h",
"=",
"0",
";",
"$",
"dimension",
"=",
"$",
"this",
"->",
"font",
"->",
"getDimension",
"(",
")",
";",
"$",
"w",
"=",
"$",
"dimension",
"[",
"0",
"]",
";",
... | Gets the dimension taken by the label, including the spacing and offset.
[0]: width
[1]: height
@return int[] | [
"Gets",
"the",
"dimension",
"taken",
"by",
"the",
"label",
"including",
"the",
"spacing",
"and",
"offset",
".",
"[",
"0",
"]",
":",
"width",
"[",
"1",
"]",
":",
"height"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L251-L268 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINLabel.php | CINLabel.draw | public /*internal*/ function draw($im, $x1, $y1, $x2, $y2) {
$x = 0;
$y = 0;
$fontDimension = $this->font->getDimension();
if ($this->position === self::POSITION_TOP || $this->position === self::POSITION_BOTTOM) {
if ($this->position === self::POSITION_TOP) {
... | php | public /*internal*/ function draw($im, $x1, $y1, $x2, $y2) {
$x = 0;
$y = 0;
$fontDimension = $this->font->getDimension();
if ($this->position === self::POSITION_TOP || $this->position === self::POSITION_BOTTOM) {
if ($this->position === self::POSITION_TOP) {
... | [
"public",
"/*internal*/",
"function",
"draw",
"(",
"$",
"im",
",",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"x2",
",",
"$",
"y2",
")",
"{",
"$",
"x",
"=",
"0",
";",
"$",
"y",
"=",
"0",
";",
"$",
"fontDimension",
"=",
"$",
"this",
"->",
"font",
... | Draws the text.
The coordinate passed are the positions of the barcode.
$x1 and $y1 represent the top left corner.
$x2 and $y2 represent the bottom right corner.
@param resource $im
@param int $x1
@param int $y1
@param int $x2
@param int $y2 | [
"Draws",
"the",
"text",
".",
"The",
"coordinate",
"passed",
"are",
"the",
"positions",
"of",
"the",
"barcode",
".",
"$x1",
"and",
"$y1",
"represent",
"the",
"top",
"left",
"corner",
".",
"$x2",
"and",
"$y2",
"represent",
"the",
"bottom",
"right",
"corner",... | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINLabel.php#L282-L320 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.setStart | public function setStart($table) {
if ($table !== 'A' && $table !== 'B' && $table !== 'C' && $table !== null) {
throw new CINArgumentException('The starting table must be A, B, C or null.', 'table');
}
$this->starting_text = $table;
} | php | public function setStart($table) {
if ($table !== 'A' && $table !== 'B' && $table !== 'C' && $table !== null) {
throw new CINArgumentException('The starting table must be A, B, C or null.', 'table');
}
$this->starting_text = $table;
} | [
"public",
"function",
"setStart",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"$",
"table",
"!==",
"'A'",
"&&",
"$",
"table",
"!==",
"'B'",
"&&",
"$",
"table",
"!==",
"'C'",
"&&",
"$",
"table",
"!==",
"null",
")",
"{",
"throw",
"new",
"CINArgumentExcepti... | Specifies the start code. Can be 'A', 'B', 'C', or null
- Table A: Capitals + ASCII 0-31 + punct
- Table B: Capitals + LowerCase + punct
- Table C: Numbers
If null is specified, the table selection is automatically made.
The default is null.
@param string $table | [
"Specifies",
"the",
"start",
"code",
".",
"Can",
"be",
"A",
"B",
"C",
"or",
"null",
"-",
"Table",
"A",
":",
"Capitals",
"+",
"ASCII",
"0",
"-",
"31",
"+",
"punct",
"-",
"Table",
"B",
":",
"Capitals",
"+",
"LowerCase",
"+",
"punct",
"-",
"Table",
... | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L231-L237 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.parse | public function parse($text) {
$this->setStartFromText($text);
$this->text = '';
$seq = '';
$currentMode = $this->starting_text;
// Here, we format correctly what the user gives.
if (!is_array($text)) {
$seq = $this->getSequence($text, $currentMod... | php | public function parse($text) {
$this->setStartFromText($text);
$this->text = '';
$seq = '';
$currentMode = $this->starting_text;
// Here, we format correctly what the user gives.
if (!is_array($text)) {
$seq = $this->getSequence($text, $currentMod... | [
"public",
"function",
"parse",
"(",
"$",
"text",
")",
"{",
"$",
"this",
"->",
"setStartFromText",
"(",
"$",
"text",
")",
";",
"$",
"this",
"->",
"text",
"=",
"''",
";",
"$",
"seq",
"=",
"''",
";",
"$",
"currentMode",
"=",
"$",
"this",
"->",
"star... | Parses the text before displaying it.
@param mixed $text | [
"Parses",
"the",
"text",
"before",
"displaying",
"it",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L265-L308 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.draw | public function draw($im) {
$c = count($this->data);
for ($i = 0; $i < $c; $i++) {
$this->drawChar($im, $this->data[$i], true);
}
$this->drawChar($im, '1', true);
$this->drawText($im, 0, 0, $this->positionX, $this->thickness);
} | php | public function draw($im) {
$c = count($this->data);
for ($i = 0; $i < $c; $i++) {
$this->drawChar($im, $this->data[$i], true);
}
$this->drawChar($im, '1', true);
$this->drawText($im, 0, 0, $this->positionX, $this->thickness);
} | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"$",
"c",
"=",
"count",
"(",
"$",
"this",
"->",
"data",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"c",
";",
"$",
"i",
"++",
")",
"{",
"$",
"this",
"->",
"d... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L315-L323 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.calculateChecksum | protected function calculateChecksum() {
// Checksum
// First Char (START)
// + Starting with the first data character following the start character,
// take the value of the character (between 0 and 102, inclusive) multiply
// it by its character position (1) and add that t... | php | protected function calculateChecksum() {
// Checksum
// First Char (START)
// + Starting with the first data character following the start character,
// take the value of the character (between 0 and 102, inclusive) multiply
// it by its character position (1) and add that t... | [
"protected",
"function",
"calculateChecksum",
"(",
")",
"{",
"// Checksum\r",
"// First Char (START)\r",
"// + Starting with the first data character following the start character,\r",
"// take the value of the character (between 0 and 102, inclusive) multiply\r",
"// it by its character positio... | Overloaded method to calculate checksum. | [
"Overloaded",
"method",
"to",
"calculate",
"checksum",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L357-L371 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.processChecksum | protected function processChecksum() {
if ($this->checksumValue === false) { // Calculate the checksum only once
$this->calculateChecksum();
}
if ($this->checksumValue !== false) {
if ($this->lastTable === 'C') {
return (string)$this->checksumValue... | php | protected function processChecksum() {
if ($this->checksumValue === false) { // Calculate the checksum only once
$this->calculateChecksum();
}
if ($this->checksumValue !== false) {
if ($this->lastTable === 'C') {
return (string)$this->checksumValue... | [
"protected",
"function",
"processChecksum",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checksumValue",
"===",
"false",
")",
"{",
"// Calculate the checksum only once\r",
"$",
"this",
"->",
"calculateChecksum",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"... | Overloaded method to display the checksum. | [
"Overloaded",
"method",
"to",
"display",
"the",
"checksum",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L376-L390 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.setStartFromText | private function setStartFromText($text) {
if ($this->starting_text === null) {
// If we have a forced table at the start, we get that one...
if (is_array($text)) {
if (is_array($text[0])) {
// Code like array(array(ENCODING, ''))
... | php | private function setStartFromText($text) {
if ($this->starting_text === null) {
// If we have a forced table at the start, we get that one...
if (is_array($text)) {
if (is_array($text[0])) {
// Code like array(array(ENCODING, ''))
... | [
"private",
"function",
"setStartFromText",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"starting_text",
"===",
"null",
")",
"{",
"// If we have a forced table at the start, we get that one...\r",
"if",
"(",
"is_array",
"(",
"$",
"text",
")",
")",
"... | Specifies the starting_text table if none has been specified earlier.
@param string $text | [
"Specifies",
"the",
"starting_text",
"table",
"if",
"none",
"has",
"been",
"specified",
"earlier",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L397-L431 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.extractTilde | private static function extractTilde($text, $pos) {
if ($text[$pos] === '~') {
if (isset($text[$pos + 1])) {
// Do we have a tilde?
if ($text[$pos + 1] === '~') {
return '~~';
} elseif ($text[$pos + 1] === 'F') {
... | php | private static function extractTilde($text, $pos) {
if ($text[$pos] === '~') {
if (isset($text[$pos + 1])) {
// Do we have a tilde?
if ($text[$pos + 1] === '~') {
return '~~';
} elseif ($text[$pos + 1] === 'F') {
... | [
"private",
"static",
"function",
"extractTilde",
"(",
"$",
"text",
",",
"$",
"pos",
")",
"{",
"if",
"(",
"$",
"text",
"[",
"$",
"pos",
"]",
"===",
"'~'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"text",
"[",
"$",
"pos",
"+",
"1",
"]",
")",
")"... | Extracts the ~ value from the $text at the $pos.
If the tilde is not ~~, ~F1, ~F2, ~F3, ~F4; an error is raised.
@param string $text
@param int $pos
@return string | [
"Extracts",
"the",
"~",
"value",
"from",
"the",
"$text",
"at",
"the",
"$pos",
".",
"If",
"the",
"tilde",
"is",
"not",
"~~",
"~F1",
"~F2",
"~F3",
"~F4",
";",
"an",
"error",
"is",
"raised",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L441-L468 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.getSequenceParsed | private function getSequenceParsed($text, $currentMode) {
if ($this->tilde) {
$sequence = '';
$previousPos = 0;
while (($pos = strpos($text, '~', $previousPos)) !== false) {
$tildeData = self::extractTilde($text, $pos);
$simpleTilde = (... | php | private function getSequenceParsed($text, $currentMode) {
if ($this->tilde) {
$sequence = '';
$previousPos = 0;
while (($pos = strpos($text, '~', $previousPos)) !== false) {
$tildeData = self::extractTilde($text, $pos);
$simpleTilde = (... | [
"private",
"function",
"getSequenceParsed",
"(",
"$",
"text",
",",
"$",
"currentMode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tilde",
")",
"{",
"$",
"sequence",
"=",
"''",
";",
"$",
"previousPos",
"=",
"0",
";",
"while",
"(",
"(",
"$",
"pos",
"="... | Gets the "dotted" sequence for the $text based on the $currentMode.
There is also a check if we use the special tilde ~
@param string $text
@param string $currentMode
@return string | [
"Gets",
"the",
"dotted",
"sequence",
"for",
"the",
"$text",
"based",
"on",
"the",
"$currentMode",
".",
"There",
"is",
"also",
"a",
"check",
"if",
"we",
"use",
"the",
"special",
"tilde",
"~"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L478-L523 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.setParseA | private function setParseA($text, &$currentMode) {
$tmp = preg_quote($this->keysA, '/');
// If we accept the ~ for special character, we must allow it.
if ($this->tilde) {
$tmp .= '~';
}
$match = array();
if (preg_match('/[^' . $tmp . ']/', $text, $... | php | private function setParseA($text, &$currentMode) {
$tmp = preg_quote($this->keysA, '/');
// If we accept the ~ for special character, we must allow it.
if ($this->tilde) {
$tmp .= '~';
}
$match = array();
if (preg_match('/[^' . $tmp . ']/', $text, $... | [
"private",
"function",
"setParseA",
"(",
"$",
"text",
",",
"&",
"$",
"currentMode",
")",
"{",
"$",
"tmp",
"=",
"preg_quote",
"(",
"$",
"this",
"->",
"keysA",
",",
"'/'",
")",
";",
"// If we accept the ~ for special character, we must allow it.\r",
"if",
"(",
"... | Parses the text and returns the appropriate sequence for the Table A.
@param string $text
@param string $currentMode
@return string | [
"Parses",
"the",
"text",
"and",
"returns",
"the",
"appropriate",
"sequence",
"for",
"the",
"Table",
"A",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L532-L550 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.setParseB | private function setParseB($text, &$currentMode) {
$tmp = preg_quote($this->keysB, '/');
$match = array();
if (preg_match('/[^' . $tmp . ']/', $text, $match) === 1) {
// We found something not allowed
throw new CINParseException('code128', 'The text "' . $text . '"... | php | private function setParseB($text, &$currentMode) {
$tmp = preg_quote($this->keysB, '/');
$match = array();
if (preg_match('/[^' . $tmp . ']/', $text, $match) === 1) {
// We found something not allowed
throw new CINParseException('code128', 'The text "' . $text . '"... | [
"private",
"function",
"setParseB",
"(",
"$",
"text",
",",
"&",
"$",
"currentMode",
")",
"{",
"$",
"tmp",
"=",
"preg_quote",
"(",
"$",
"this",
"->",
"keysB",
",",
"'/'",
")",
";",
"$",
"match",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
... | Parses the text and returns the appropriate sequence for the Table B.
@param string $text
@param string $currentMode
@return string | [
"Parses",
"the",
"text",
"and",
"returns",
"the",
"appropriate",
"sequence",
"for",
"the",
"Table",
"B",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L559-L572 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.setParseC | private function setParseC($text, &$currentMode) {
$tmp = preg_quote($this->keysC, '/');
// If we accept the ~ for special character, we must allow it.
if ($this->tilde) {
$tmp .= '~F';
}
$match = array();
if (preg_match('/[^' . $tmp . ']/', $text, ... | php | private function setParseC($text, &$currentMode) {
$tmp = preg_quote($this->keysC, '/');
// If we accept the ~ for special character, we must allow it.
if ($this->tilde) {
$tmp .= '~F';
}
$match = array();
if (preg_match('/[^' . $tmp . ']/', $text, ... | [
"private",
"function",
"setParseC",
"(",
"$",
"text",
",",
"&",
"$",
"currentMode",
")",
"{",
"$",
"tmp",
"=",
"preg_quote",
"(",
"$",
"this",
"->",
"keysC",
",",
"'/'",
")",
";",
"// If we accept the ~ for special character, we must allow it.\r",
"if",
"(",
"... | Parses the text and returns the appropriate sequence for the Table C.
@param string $text
@param string $currentMode
@return string | [
"Parses",
"the",
"text",
"and",
"returns",
"the",
"appropriate",
"sequence",
"for",
"the",
"Table",
"C",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L581-L599 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.getSequence | private function getSequence($text, &$starting_text) {
$e = 10000;
$latLen = array(
array(0, 1, 1),
array(1, 0, 1),
array(1, 1, 0)
);
$shftLen = array(
array($e, 1, $e),
array(1, $e, $e),
array($e, $e, $e)
... | php | private function getSequence($text, &$starting_text) {
$e = 10000;
$latLen = array(
array(0, 1, 1),
array(1, 0, 1),
array(1, 1, 0)
);
$shftLen = array(
array($e, 1, $e),
array(1, $e, $e),
array($e, $e, $e)
... | [
"private",
"function",
"getSequence",
"(",
"$",
"text",
",",
"&",
"$",
"starting_text",
")",
"{",
"$",
"e",
"=",
"10000",
";",
"$",
"latLen",
"=",
"array",
"(",
"array",
"(",
"0",
",",
"1",
",",
"1",
")",
",",
"array",
"(",
"1",
",",
"0",
",",
... | Depending on the $text, it will return the correct
sequence to encode the text.
@param string $text
@param string $starting_text
@return string | [
"Depending",
"on",
"the",
"$text",
"it",
"will",
"return",
"the",
"correct",
"sequence",
"to",
"encode",
"the",
"text",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L609-L749 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.createBinaryStream | private function createBinaryStream($text, $seq) {
$c = strlen($seq);
$data = array(); // code stream
$indcheck = array(); // index for checksum
$currentEncoding = 0;
if ($this->starting_text === 'A') {
$currentEncoding = 0;
$indcheck[] = self::... | php | private function createBinaryStream($text, $seq) {
$c = strlen($seq);
$data = array(); // code stream
$indcheck = array(); // index for checksum
$currentEncoding = 0;
if ($this->starting_text === 'A') {
$currentEncoding = 0;
$indcheck[] = self::... | [
"private",
"function",
"createBinaryStream",
"(",
"$",
"text",
",",
"$",
"seq",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"seq",
")",
";",
"$",
"data",
"=",
"array",
"(",
")",
";",
"// code stream\r",
"$",
"indcheck",
"=",
"array",
"(",
")",
";"... | Depending on the sequence $seq given (returned from getSequence()),
this method will return the code stream in an array. Each char will be a
string of bit based on the Code 128.
Each letter from the sequence represents bits.
0 to 2 are latches
A to B are Shift + Letter
. is a char in the current encoding
@param stri... | [
"Depending",
"on",
"the",
"sequence",
"$seq",
"given",
"(",
"returned",
"from",
"getSequence",
"()",
")",
"this",
"method",
"will",
"return",
"the",
"code",
"stream",
"in",
"an",
"array",
".",
"Each",
"char",
"will",
"be",
"a",
"string",
"of",
"bit",
"ba... | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L766-L825 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.encodeChar | private function encodeChar(&$data, $encoding, $seq, $text, &$i, &$counter, &$indcheck) {
if (isset($seq[$i + 1]) && $seq[$i + 1] === 'F') {
// We have a flag !!
if ($text[$counter + 1] === 'F') {
$number = $text[$counter + 2];
$fnc = $this->fnc[$enco... | php | private function encodeChar(&$data, $encoding, $seq, $text, &$i, &$counter, &$indcheck) {
if (isset($seq[$i + 1]) && $seq[$i + 1] === 'F') {
// We have a flag !!
if ($text[$counter + 1] === 'F') {
$number = $text[$counter + 2];
$fnc = $this->fnc[$enco... | [
"private",
"function",
"encodeChar",
"(",
"&",
"$",
"data",
",",
"$",
"encoding",
",",
"$",
"seq",
",",
"$",
"text",
",",
"&",
"$",
"i",
",",
"&",
"$",
"counter",
",",
"&",
"$",
"indcheck",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"seq",
"[",
... | Encodes characters, base on its encoding and sequence
@param int[] $data
@param int $encoding
@param string $seq
@param string $text
@param int $i
@param int $counter
@param int[] $indcheck | [
"Encodes",
"characters",
"base",
"on",
"its",
"encoding",
"and",
"sequence"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L838-L871 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode128.php | CINcode128.setData | private function setData($data) {
$this->indcheck = $data[0];
$this->data = $data[1];
$this->calculateChecksum();
$this->data[] = $this->code[$this->checksumValue];
$this->data[] = $this->code[self::KEY_STOP];
} | php | private function setData($data) {
$this->indcheck = $data[0];
$this->data = $data[1];
$this->calculateChecksum();
$this->data[] = $this->code[$this->checksumValue];
$this->data[] = $this->code[self::KEY_STOP];
} | [
"private",
"function",
"setData",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"indcheck",
"=",
"$",
"data",
"[",
"0",
"]",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
"[",
"1",
"]",
";",
"$",
"this",
"->",
"calculateChecksum",
"(",
")",
... | Saves data into the classes.
This method will save data, calculate real column number
(if -1 was selected), the real error level (if -1 was
selected)... It will add Padding to the end and generate
the error codes.
@param array $data | [
"Saves",
"data",
"into",
"the",
"classes",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode128.php#L883-L889 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawPNG.php | CINDrawPNG.setDPI | public function setDPI($dpi) {
if (is_numeric($dpi)) {
$this->dpi = max(1, $dpi);
} else {
$this->dpi = null;
}
} | php | public function setDPI($dpi) {
if (is_numeric($dpi)) {
$this->dpi = max(1, $dpi);
} else {
$this->dpi = null;
}
} | [
"public",
"function",
"setDPI",
"(",
"$",
"dpi",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"dpi",
")",
")",
"{",
"$",
"this",
"->",
"dpi",
"=",
"max",
"(",
"1",
",",
"$",
"dpi",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"dpi",
"=",
... | Sets the DPI.
@param int $dpi | [
"Sets",
"the",
"DPI",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawPNG.php#L46-L52 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawPNG.php | CINDrawPNG.draw | public function draw() {
ob_start();
imagepng($this->im);
$bin = ob_get_contents();
ob_end_clean();
$this->setInternalProperties($bin);
if (empty($this->filename)) {
echo $bin;
} else {
file_put_contents($this->filename, $bin);... | php | public function draw() {
ob_start();
imagepng($this->im);
$bin = ob_get_contents();
ob_end_clean();
$this->setInternalProperties($bin);
if (empty($this->filename)) {
echo $bin;
} else {
file_put_contents($this->filename, $bin);... | [
"public",
"function",
"draw",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"imagepng",
"(",
"$",
"this",
"->",
"im",
")",
";",
"$",
"bin",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_end_clean",
"(",
")",
";",
"$",
"this",
"->",
"setInternalProperties",
... | Draws the PNG on the screen or in a file. | [
"Draws",
"the",
"PNG",
"on",
"the",
"screen",
"or",
"in",
"a",
"file",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawPNG.php#L57-L70 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINFontFile.php | CINFontFile.setRotationAngle | public function setRotationAngle($rotationAngle) {
$this->rotationAngle = (int)$rotationAngle;
if ($this->rotationAngle !== 90 && $this->rotationAngle !== 180 && $this->rotationAngle !== 270) {
$this->rotationAngle = 0;
}
$this->rotationAngle = (360 - $this->rotationAn... | php | public function setRotationAngle($rotationAngle) {
$this->rotationAngle = (int)$rotationAngle;
if ($this->rotationAngle !== 90 && $this->rotationAngle !== 180 && $this->rotationAngle !== 270) {
$this->rotationAngle = 0;
}
$this->rotationAngle = (360 - $this->rotationAn... | [
"public",
"function",
"setRotationAngle",
"(",
"$",
"rotationAngle",
")",
"{",
"$",
"this",
"->",
"rotationAngle",
"=",
"(",
"int",
")",
"$",
"rotationAngle",
";",
"if",
"(",
"$",
"this",
"->",
"rotationAngle",
"!==",
"90",
"&&",
"$",
"this",
"->",
"rota... | Sets the rotation in degree.
@param int | [
"Sets",
"the",
"rotation",
"in",
"degree",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINFontFile.php#L79-L88 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINFontFile.php | CINFontFile.getDimension | public function getDimension() {
$w = 0.0;
$h = 0.0;
$box = $this->getBox();
if ($box !== null) {
$minX = min(array($box[0], $box[2], $box[4], $box[6]));
$maxX = max(array($box[0], $box[2], $box[4], $box[6]));
$minY = min(array($box[1], $box[3... | php | public function getDimension() {
$w = 0.0;
$h = 0.0;
$box = $this->getBox();
if ($box !== null) {
$minX = min(array($box[0], $box[2], $box[4], $box[6]));
$maxX = max(array($box[0], $box[2], $box[4], $box[6]));
$minY = min(array($box[1], $box[3... | [
"public",
"function",
"getDimension",
"(",
")",
"{",
"$",
"w",
"=",
"0.0",
";",
"$",
"h",
"=",
"0.0",
";",
"$",
"box",
"=",
"$",
"this",
"->",
"getBox",
"(",
")",
";",
"if",
"(",
"$",
"box",
"!==",
"null",
")",
"{",
"$",
"minX",
"=",
"min",
... | Returns the width and height that the text takes to be written.
@return int[] | [
"Returns",
"the",
"width",
"and",
"height",
"that",
"the",
"text",
"takes",
"to",
"be",
"written",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINFontFile.php#L147-L168 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINFontFile.php | CINFontFile.draw | public function draw($im, $x, $y) {
$drawingPosition = $this->getDrawingPosition($x, $y);
imagettftext($im, $this->size, $this->rotationAngle, $drawingPosition[0], $drawingPosition[1], $this->foregroundColor->allocate($im), $this->path, $this->text);
} | php | public function draw($im, $x, $y) {
$drawingPosition = $this->getDrawingPosition($x, $y);
imagettftext($im, $this->size, $this->rotationAngle, $drawingPosition[0], $drawingPosition[1], $this->foregroundColor->allocate($im), $this->path, $this->text);
} | [
"public",
"function",
"draw",
"(",
"$",
"im",
",",
"$",
"x",
",",
"$",
"y",
")",
"{",
"$",
"drawingPosition",
"=",
"$",
"this",
"->",
"getDrawingPosition",
"(",
"$",
"x",
",",
"$",
"y",
")",
";",
"imagettftext",
"(",
"$",
"im",
",",
"$",
"this",
... | Draws the text on the image at a specific position.
$x and $y represent the left bottom corner.
@param resource $im
@param int $x
@param int $y | [
"Draws",
"the",
"text",
"on",
"the",
"image",
"at",
"a",
"specific",
"position",
".",
"$x",
"and",
"$y",
"represent",
"the",
"left",
"bottom",
"corner",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINFontFile.php#L178-L181 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINColor.php | CINColor.allocate | public function allocate(&$im) {
$allocated = imagecolorallocate($im, $this->r, $this->g, $this->b);
if ($this->transparent) {
return imagecolortransparent($im, $allocated);
} else {
return $allocated;
}
} | php | public function allocate(&$im) {
$allocated = imagecolorallocate($im, $this->r, $this->g, $this->b);
if ($this->transparent) {
return imagecolortransparent($im, $allocated);
} else {
return $allocated;
}
} | [
"public",
"function",
"allocate",
"(",
"&",
"$",
"im",
")",
"{",
"$",
"allocated",
"=",
"imagecolorallocate",
"(",
"$",
"im",
",",
"$",
"this",
"->",
"r",
",",
"$",
"this",
"->",
"g",
",",
"$",
"this",
"->",
"b",
")",
";",
"if",
"(",
"$",
"this... | Returns the int value for PHP color.
@param resource $im
@return int | [
"Returns",
"the",
"int",
"value",
"for",
"PHP",
"color",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINColor.php#L98-L105 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINDrawing.php | CINDrawing.draw | public function draw() {
$size = $this->barcode->getDimension(0, 0);
$this->w = max(1, $size[0]);
$this->h = max(1, $size[1]);
$this->init();
$this->barcode->draw($this->im);
} | php | public function draw() {
$size = $this->barcode->getDimension(0, 0);
$this->w = max(1, $size[0]);
$this->h = max(1, $size[1]);
$this->init();
$this->barcode->draw($this->im);
} | [
"public",
"function",
"draw",
"(",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"barcode",
"->",
"getDimension",
"(",
"0",
",",
"0",
")",
";",
"$",
"this",
"->",
"w",
"=",
"max",
"(",
"1",
",",
"$",
"size",
"[",
"0",
"]",
")",
";",
"$",
"... | Draws the barcode on the image $im. | [
"Draws",
"the",
"barcode",
"on",
"the",
"image",
"$im",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINDrawing.php#L148-L154 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINDrawing.php | CINDrawing.finish | public function finish($image_style = self::IMG_FORMAT_PNG, $quality = 100) {
$drawer = null;
$im = $this->im;
if ($this->rotateDegree > 0.0) {
if (function_exists('imagerotate')) {
$im = imagerotate($this->im, 360 - $this->rotateDegree, $this->color->allocate(... | php | public function finish($image_style = self::IMG_FORMAT_PNG, $quality = 100) {
$drawer = null;
$im = $this->im;
if ($this->rotateDegree > 0.0) {
if (function_exists('imagerotate')) {
$im = imagerotate($this->im, 360 - $this->rotateDegree, $this->color->allocate(... | [
"public",
"function",
"finish",
"(",
"$",
"image_style",
"=",
"self",
"::",
"IMG_FORMAT_PNG",
",",
"$",
"quality",
"=",
"100",
")",
"{",
"$",
"drawer",
"=",
"null",
";",
"$",
"im",
"=",
"$",
"this",
"->",
"im",
";",
"if",
"(",
"$",
"this",
"->",
... | Saves $im into the file (many format available).
@param int $image_style
@param int $quality | [
"Saves",
"$im",
"into",
"the",
"file",
"(",
"many",
"format",
"available",
")",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINDrawing.php#L162-L197 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINDrawing.php | CINDrawing.drawException | public function drawException($exception) {
$this->w = 1;
$this->h = 1;
$this->init();
// Is the image big enough?
$w = imagesx($this->im);
$h = imagesy($this->im);
$text = 'Error: ' . $exception->getMessage();
$width = imagefontwidth(2) * st... | php | public function drawException($exception) {
$this->w = 1;
$this->h = 1;
$this->init();
// Is the image big enough?
$w = imagesx($this->im);
$h = imagesy($this->im);
$text = 'Error: ' . $exception->getMessage();
$width = imagefontwidth(2) * st... | [
"public",
"function",
"drawException",
"(",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"w",
"=",
"1",
";",
"$",
"this",
"->",
"h",
"=",
"1",
";",
"$",
"this",
"->",
"init",
"(",
")",
";",
"// Is the image big enough?\r",
"$",
"w",
"=",
"imagesx",... | Writes the Error on the picture.
@param Exception $exception | [
"Writes",
"the",
"Error",
"on",
"the",
"picture",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINDrawing.php#L204-L230 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINDrawing.php | CINDrawing.init | private function init() {
if ($this->im === null) {
$this->im = imagecreatetruecolor($this->w, $this->h)
or die('Can\'t Initialize the GD Libraty');
imagefilledrectangle($this->im, 0, 0, $this->w - 1, $this->h - 1, $this->color->allocate($this->im));
}
} | php | private function init() {
if ($this->im === null) {
$this->im = imagecreatetruecolor($this->w, $this->h)
or die('Can\'t Initialize the GD Libraty');
imagefilledrectangle($this->im, 0, 0, $this->w - 1, $this->h - 1, $this->color->allocate($this->im));
}
} | [
"private",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"im",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"im",
"=",
"imagecreatetruecolor",
"(",
"$",
"this",
"->",
"w",
",",
"$",
"this",
"->",
"h",
")",
"or",
"die",
"(",
"'... | Init Image and color background. | [
"Init",
"Image",
"and",
"color",
"background",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINDrawing.php#L242-L248 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupcext5.php | CINupcext5.addDefaultLabel | protected function addDefaultLabel() {
parent::addDefaultLabel();
if ($this->defaultLabel !== null) {
$this->defaultLabel->setPosition(CINLabel::POSITION_TOP);
}
} | php | protected function addDefaultLabel() {
parent::addDefaultLabel();
if ($this->defaultLabel !== null) {
$this->defaultLabel->setPosition(CINLabel::POSITION_TOP);
}
} | [
"protected",
"function",
"addDefaultLabel",
"(",
")",
"{",
"parent",
"::",
"addDefaultLabel",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"defaultLabel",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"defaultLabel",
"->",
"setPosition",
"(",
"CINLabel",
"::... | Adds the default label. | [
"Adds",
"the",
"default",
"label",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupcext5.php#L110-L116 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupcext5.php | CINupcext5.calculateChecksum | protected function calculateChecksum() {
// Calculating Checksum
// Consider the right-most digit of the message to be in an "odd" position,
// and assign odd/even to each character moving from right to left
// Odd Position = 3, Even Position = 9
// Multiply it by the number... | php | protected function calculateChecksum() {
// Calculating Checksum
// Consider the right-most digit of the message to be in an "odd" position,
// and assign odd/even to each character moving from right to left
// Odd Position = 3, Even Position = 9
// Multiply it by the number... | [
"protected",
"function",
"calculateChecksum",
"(",
")",
"{",
"// Calculating Checksum\r",
"// Consider the right-most digit of the message to be in an \"odd\" position,\r",
"// and assign odd/even to each character moving from right to left\r",
"// Odd Position = 3, Even Position = 9\r",
"// Mul... | Overloaded method to calculate checksum. | [
"Overloaded",
"method",
"to",
"calculate",
"checksum",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupcext5.php#L145-L172 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupca.php | CINupca.draw | public function draw($im) {
// The following code is exactly the same as EAN13. We just add a 0 in front of the code !
$this->text = '0' . $this->text; // We will remove it at the end... don't worry
parent::draw($im);
// We remove the 0 in front, as we said :)
$this->tex... | php | public function draw($im) {
// The following code is exactly the same as EAN13. We just add a 0 in front of the code !
$this->text = '0' . $this->text; // We will remove it at the end... don't worry
parent::draw($im);
// We remove the 0 in front, as we said :)
$this->tex... | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"// The following code is exactly the same as EAN13. We just add a 0 in front of the code !\r",
"$",
"this",
"->",
"text",
"=",
"'0'",
".",
"$",
"this",
"->",
"text",
";",
"// We will remove it at the end... don't worr... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupca.php#L41-L49 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupca.php | CINupca.drawExtendedBars | protected function drawExtendedBars($im, $plus) {
$temp_text = $this->text . $this->keys[$this->checksumValue];
$rememberX = $this->positionX;
$rememberH = $this->thickness;
// We increase the bars
// First 2 Bars
$this->thickness = $this->thickness + intval($plus... | php | protected function drawExtendedBars($im, $plus) {
$temp_text = $this->text . $this->keys[$this->checksumValue];
$rememberX = $this->positionX;
$rememberH = $this->thickness;
// We increase the bars
// First 2 Bars
$this->thickness = $this->thickness + intval($plus... | [
"protected",
"function",
"drawExtendedBars",
"(",
"$",
"im",
",",
"$",
"plus",
")",
"{",
"$",
"temp_text",
"=",
"$",
"this",
"->",
"text",
".",
"$",
"this",
"->",
"keys",
"[",
"$",
"this",
"->",
"checksumValue",
"]",
";",
"$",
"rememberX",
"=",
"$",
... | Draws the extended bars on the image.
@param resource $im
@param int $plus | [
"Draws",
"the",
"extended",
"bars",
"on",
"the",
"image",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupca.php#L57-L93 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINothercode.php | CINothercode.draw | public function draw($im) {
$this->drawChar($im, $this->text, true);
$this->drawText($im, 0, 0, $this->positionX, $this->thickness);
} | php | public function draw($im) {
$this->drawChar($im, $this->text, true);
$this->drawText($im, 0, 0, $this->positionX, $this->thickness);
} | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"$",
"this",
"->",
"drawChar",
"(",
"$",
"im",
",",
"$",
"this",
"->",
"text",
",",
"true",
")",
";",
"$",
"this",
"->",
"drawText",
"(",
"$",
"im",
",",
"0",
",",
"0",
",",
"$",
"this",... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINothercode.php#L35-L38 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINothercode.php | CINothercode.getLabel | public function getLabel() {
$label = $this->label;
if ($this->label === CINBarcode1D::AUTO_LABEL) {
$label = '';
}
return $label;
} | php | public function getLabel() {
$label = $this->label;
if ($this->label === CINBarcode1D::AUTO_LABEL) {
$label = '';
}
return $label;
} | [
"public",
"function",
"getLabel",
"(",
")",
"{",
"$",
"label",
"=",
"$",
"this",
"->",
"label",
";",
"if",
"(",
"$",
"this",
"->",
"label",
"===",
"CINBarcode1D",
"::",
"AUTO_LABEL",
")",
"{",
"$",
"label",
"=",
"''",
";",
"}",
"return",
"$",
"labe... | Gets the label.
If the label was set to CINBarcode1D::AUTO_LABEL, the label will display the value from the text parsed.
@return string | [
"Gets",
"the",
"label",
".",
"If",
"the",
"label",
"was",
"set",
"to",
"CINBarcode1D",
"::",
"AUTO_LABEL",
"the",
"label",
"will",
"display",
"the",
"value",
"from",
"the",
"text",
"parsed",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINothercode.php#L46-L53 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINothercode.php | CINothercode.getDimension | public function getDimension($w, $h) {
$array = str_split($this->text, 1);
$textlength = array_sum($array) + count($array);
$w += $textlength;
$h += $this->thickness;
return parent::getDimension($w, $h);
} | php | public function getDimension($w, $h) {
$array = str_split($this->text, 1);
$textlength = array_sum($array) + count($array);
$w += $textlength;
$h += $this->thickness;
return parent::getDimension($w, $h);
} | [
"public",
"function",
"getDimension",
"(",
"$",
"w",
",",
"$",
"h",
")",
"{",
"$",
"array",
"=",
"str_split",
"(",
"$",
"this",
"->",
"text",
",",
"1",
")",
";",
"$",
"textlength",
"=",
"array_sum",
"(",
"$",
"array",
")",
"+",
"count",
"(",
"$",... | Returns the maximal size of a barcode.
@param int $w
@param int $h
@return int[] | [
"Returns",
"the",
"maximal",
"size",
"of",
"a",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINothercode.php#L62-L69 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINisbn.php | CINisbn.addDefaultLabel | protected function addDefaultLabel() {
if ($this->isDefaultEanLabelEnabled()) {
$isbn = $this->createISBNText();
$font = $this->font;
$topLabel = new CINLabel($isbn, $font, CINLabel::POSITION_TOP, CINLabel::ALIGN_CENTER);
$this->addLabel($topLabel);
... | php | protected function addDefaultLabel() {
if ($this->isDefaultEanLabelEnabled()) {
$isbn = $this->createISBNText();
$font = $this->font;
$topLabel = new CINLabel($isbn, $font, CINLabel::POSITION_TOP, CINLabel::ALIGN_CENTER);
$this->addLabel($topLabel);
... | [
"protected",
"function",
"addDefaultLabel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDefaultEanLabelEnabled",
"(",
")",
")",
"{",
"$",
"isbn",
"=",
"$",
"this",
"->",
"createISBNText",
"(",
")",
";",
"$",
"font",
"=",
"$",
"this",
"->",
"font",
... | Adds the default label. | [
"Adds",
"the",
"default",
"label",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINisbn.php#L44-L55 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINisbn.php | CINisbn.setGS1 | public function setGS1($gs1) {
$gs1 = (int)$gs1;
if ($gs1 !== self::GS1_AUTO && $gs1 !== self::GS1_PREFIX978 && $gs1 !== self::GS1_PREFIX979) {
throw new CINArgumentException('The GS1 argument must be CINisbn::GS1_AUTO, CINisbn::GS1_PREFIX978, or CINisbn::GS1_PREFIX979', 'gs1');
... | php | public function setGS1($gs1) {
$gs1 = (int)$gs1;
if ($gs1 !== self::GS1_AUTO && $gs1 !== self::GS1_PREFIX978 && $gs1 !== self::GS1_PREFIX979) {
throw new CINArgumentException('The GS1 argument must be CINisbn::GS1_AUTO, CINisbn::GS1_PREFIX978, or CINisbn::GS1_PREFIX979', 'gs1');
... | [
"public",
"function",
"setGS1",
"(",
"$",
"gs1",
")",
"{",
"$",
"gs1",
"=",
"(",
"int",
")",
"$",
"gs1",
";",
"if",
"(",
"$",
"gs1",
"!==",
"self",
"::",
"GS1_AUTO",
"&&",
"$",
"gs1",
"!==",
"self",
"::",
"GS1_PREFIX978",
"&&",
"$",
"gs1",
"!==",... | Sets the first numbers of the barcode.
- GS1_AUTO: Adds 978 before the code
- GS1_PREFIX978: Adds 978 before the code
- GS1_PREFIX979: Adds 979 before the code
@param int $gs1 | [
"Sets",
"the",
"first",
"numbers",
"of",
"the",
"barcode",
".",
"-",
"GS1_AUTO",
":",
"Adds",
"978",
"before",
"the",
"code",
"-",
"GS1_PREFIX978",
":",
"Adds",
"978",
"before",
"the",
"code",
"-",
"GS1_PREFIX979",
":",
"Adds",
"979",
"before",
"the",
"c... | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINisbn.php#L65-L72 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINisbn.php | CINisbn.checkCharsAllowed | protected function checkCharsAllowed() {
$c = strlen($this->text);
// Special case, if we have 10 digits, the last one can be X
if ($c === 10) {
if (array_search($this->text[9], $this->keys) === false && $this->text[9] !== 'X') {
throw new CINParseException('is... | php | protected function checkCharsAllowed() {
$c = strlen($this->text);
// Special case, if we have 10 digits, the last one can be X
if ($c === 10) {
if (array_search($this->text[9], $this->keys) === false && $this->text[9] !== 'X') {
throw new CINParseException('is... | [
"protected",
"function",
"checkCharsAllowed",
"(",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"// Special case, if we have 10 digits, the last one can be X\r",
"if",
"(",
"$",
"c",
"===",
"10",
")",
"{",
"if",
"(",
"array_sear... | Check chars allowed. | [
"Check",
"chars",
"allowed",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINisbn.php#L77-L91 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINisbn.php | CINisbn.checkCorrectLength | protected function checkCorrectLength() {
$c = strlen($this->text);
// If we have 13 chars just flush the last one
if ($c === 13) {
$this->text = substr($this->text, 0, 12);
} elseif ($c === 9 || $c === 10) {
if ($c === 10) {
// Before dro... | php | protected function checkCorrectLength() {
$c = strlen($this->text);
// If we have 13 chars just flush the last one
if ($c === 13) {
$this->text = substr($this->text, 0, 12);
} elseif ($c === 9 || $c === 10) {
if ($c === 10) {
// Before dro... | [
"protected",
"function",
"checkCorrectLength",
"(",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"// If we have 13 chars just flush the last one\r",
"if",
"(",
"$",
"c",
"===",
"13",
")",
"{",
"$",
"this",
"->",
"text",
"=",... | Check correct length. | [
"Check",
"correct",
"length",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINisbn.php#L96-L120 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINisbn.php | CINisbn.createISBNText | private function createISBNText() {
$isbn = '';
if (!empty($this->text)) {
// We try to create the ISBN Text... the hyphen really depends the ISBN agency.
// We just put one before the checksum and one after the GS1 if present.
$c = strlen($this->text);
... | php | private function createISBNText() {
$isbn = '';
if (!empty($this->text)) {
// We try to create the ISBN Text... the hyphen really depends the ISBN agency.
// We just put one before the checksum and one after the GS1 if present.
$c = strlen($this->text);
... | [
"private",
"function",
"createISBNText",
"(",
")",
"{",
"$",
"isbn",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"text",
")",
")",
"{",
"// We try to create the ISBN Text... the hyphen really depends the ISBN agency.\r",
"// We just put one before... | Creates the ISBN text.
@return string | [
"Creates",
"the",
"ISBN",
"text",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINisbn.php#L127-L165 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.setTrackingCode | public function setTrackingCode($barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber) {
$barcodeIdentifier = (string)(int)$barcodeIdentifier;
$serviceTypeIdentifier = (int)$serviceTypeIdentifier;
$mailerIdentifier = (int)$mailerIdentifier;
$serialNumber = (str... | php | public function setTrackingCode($barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber) {
$barcodeIdentifier = (string)(int)$barcodeIdentifier;
$serviceTypeIdentifier = (int)$serviceTypeIdentifier;
$mailerIdentifier = (int)$mailerIdentifier;
$serialNumber = (str... | [
"public",
"function",
"setTrackingCode",
"(",
"$",
"barcodeIdentifier",
",",
"$",
"serviceTypeIdentifier",
",",
"$",
"mailerIdentifier",
",",
"$",
"serialNumber",
")",
"{",
"$",
"barcodeIdentifier",
"=",
"(",
"string",
")",
"(",
"int",
")",
"$",
"barcodeIdentifi... | Sets the tracking code.
@param int $barcodeIdentifier 2-digit number. 2nd digit must be 0-4
@param int $serviceTypeIdentifier 3 digits
@param int $mailerIdentifier 6 or 9 digits
@param int $serialNumber 9 (if mailerId is 6) or 6 digits (if mailerId is 9) | [
"Sets",
"the",
"tracking",
"code",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L274-L314 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.parse | public function parse($text) {
parent::parse($text);
$number = self::executeStep1($this->text, $this->barcodeIdentifier, $this->serviceTypeIdentifier, $this->mailerIdentifier, $this->serialNumber);
$crc = self::executeStep2($number);
$codewords = self::executeStep3($number);
... | php | public function parse($text) {
parent::parse($text);
$number = self::executeStep1($this->text, $this->barcodeIdentifier, $this->serviceTypeIdentifier, $this->mailerIdentifier, $this->serialNumber);
$crc = self::executeStep2($number);
$codewords = self::executeStep3($number);
... | [
"public",
"function",
"parse",
"(",
"$",
"text",
")",
"{",
"parent",
"::",
"parse",
"(",
"$",
"text",
")",
";",
"$",
"number",
"=",
"self",
"::",
"executeStep1",
"(",
"$",
"this",
"->",
"text",
",",
"$",
"this",
"->",
"barcodeIdentifier",
",",
"$",
... | Parses the text before displaying it.
@param mixed $text | [
"Parses",
"the",
"text",
"before",
"displaying",
"it",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L321-L330 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.draw | public function draw($im) {
if ($this->quietZone) {
$this->positionX += 9;
}
$c = strlen($this->data);
for ($i = 0; $i < $c; $i++) {
$this->drawChar($im, $this->data[$i]);
}
$this->drawText($im, 0, 0, $this->positionX, $this->thickness ... | php | public function draw($im) {
if ($this->quietZone) {
$this->positionX += 9;
}
$c = strlen($this->data);
for ($i = 0; $i < $c; $i++) {
$this->drawChar($im, $this->data[$i]);
}
$this->drawText($im, 0, 0, $this->positionX, $this->thickness ... | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"quietZone",
")",
"{",
"$",
"this",
"->",
"positionX",
"+=",
"9",
";",
"}",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"data",
")",
";",
"for",
"(",
"... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L337-L348 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.getDimension | public function getDimension($w, $h) {
$w += 65 * 3;
$h += $this->thickness;
// We remove the white on the right
$w -= 1.56;
if ($this->quietZone) {
$w += 18;
$h += 4;
}
return parent::getDimension($w, $h);
} | php | public function getDimension($w, $h) {
$w += 65 * 3;
$h += $this->thickness;
// We remove the white on the right
$w -= 1.56;
if ($this->quietZone) {
$w += 18;
$h += 4;
}
return parent::getDimension($w, $h);
} | [
"public",
"function",
"getDimension",
"(",
"$",
"w",
",",
"$",
"h",
")",
"{",
"$",
"w",
"+=",
"65",
"*",
"3",
";",
"$",
"h",
"+=",
"$",
"this",
"->",
"thickness",
";",
"// We remove the white on the right\r",
"$",
"w",
"-=",
"1.56",
";",
"if",
"(",
... | Returns the maximal size of a barcode.
@param int $w
@param int $h
@return int[] | [
"Returns",
"the",
"maximal",
"size",
"of",
"a",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L357-L370 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.validate | protected function validate() {
// Tracking must have been entered
if ($this->barcodeIdentifier === null || $this->serviceTypeIdentifier === null || $this->mailerIdentifier === null || $this->serialNumber === null) {
throw new CINParseException('intelligentmail', 'The tracking code must b... | php | protected function validate() {
// Tracking must have been entered
if ($this->barcodeIdentifier === null || $this->serviceTypeIdentifier === null || $this->mailerIdentifier === null || $this->serialNumber === null) {
throw new CINParseException('intelligentmail', 'The tracking code must b... | [
"protected",
"function",
"validate",
"(",
")",
"{",
"// Tracking must have been entered\r",
"if",
"(",
"$",
"this",
"->",
"barcodeIdentifier",
"===",
"null",
"||",
"$",
"this",
"->",
"serviceTypeIdentifier",
"===",
"null",
"||",
"$",
"this",
"->",
"mailerIdentifie... | Validates the input. | [
"Validates",
"the",
"input",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L375-L394 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.drawChar | protected function drawChar($im, $code, $startBar = true) {
$y1 = 0;
$y2 = 0;
switch ($code) {
case 'A':
$y1 = 0;
$y2 = $this->thickness - ($this->thickness / 2.5);
break;
case 'D':
$y1 = 3.096;
... | php | protected function drawChar($im, $code, $startBar = true) {
$y1 = 0;
$y2 = 0;
switch ($code) {
case 'A':
$y1 = 0;
$y2 = $this->thickness - ($this->thickness / 2.5);
break;
case 'D':
$y1 = 3.096;
... | [
"protected",
"function",
"drawChar",
"(",
"$",
"im",
",",
"$",
"code",
",",
"$",
"startBar",
"=",
"true",
")",
"{",
"$",
"y1",
"=",
"0",
";",
"$",
"y2",
"=",
"0",
";",
"switch",
"(",
"$",
"code",
")",
"{",
"case",
"'A'",
":",
"$",
"y1",
"=",
... | Overloaded method for drawing special barcode.
@param resource $im
@param string $code
@param boolean $startBar | [
"Overloaded",
"method",
"for",
"drawing",
"special",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L403-L432 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.executeStep1 | private static function executeStep1($text, $barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber) {
$number = self::conversionRoutingCode($text);
$number = self::conversionTrackingCode($number, $barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber);
... | php | private static function executeStep1($text, $barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber) {
$number = self::conversionRoutingCode($text);
$number = self::conversionTrackingCode($number, $barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber);
... | [
"private",
"static",
"function",
"executeStep1",
"(",
"$",
"text",
",",
"$",
"barcodeIdentifier",
",",
"$",
"serviceTypeIdentifier",
",",
"$",
"mailerIdentifier",
",",
"$",
"serialNumber",
")",
"{",
"$",
"number",
"=",
"self",
"::",
"conversionRoutingCode",
"(",... | Executes Step 1: Conversion of Data Fields into Binary Data
@param string $text
@param string $barcodeIdentifier
@param string $serviceTypeIdentifier
@param string $mailerIdentifier
@param string $serialNumber
@return string BCNumber | [
"Executes",
"Step",
"1",
":",
"Conversion",
"of",
"Data",
"Fields",
"into",
"Binary",
"Data"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L444-L449 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.executeStep2 | private static function executeStep2($number) {
$byteArray = str_pad(self::bcdecuc($number), 13, chr(0), STR_PAD_LEFT);
$generatorPolynomial = 0x0f35;
$frameCheckSequence = 0x07ff;
$data = 0;
$byteIndex = 0;
$bit = 0;
$data = (ord($byteArray[$byteIndex]... | php | private static function executeStep2($number) {
$byteArray = str_pad(self::bcdecuc($number), 13, chr(0), STR_PAD_LEFT);
$generatorPolynomial = 0x0f35;
$frameCheckSequence = 0x07ff;
$data = 0;
$byteIndex = 0;
$bit = 0;
$data = (ord($byteArray[$byteIndex]... | [
"private",
"static",
"function",
"executeStep2",
"(",
"$",
"number",
")",
"{",
"$",
"byteArray",
"=",
"str_pad",
"(",
"self",
"::",
"bcdecuc",
"(",
"$",
"number",
")",
",",
"13",
",",
"chr",
"(",
"0",
")",
",",
"STR_PAD_LEFT",
")",
";",
"$",
"generat... | Executes Step 2: Generation of 11-Bit CRC on Binary Data
@param $number BCNumber
@return int | [
"Executes",
"Step",
"2",
":",
"Generation",
"of",
"11",
"-",
"Bit",
"CRC",
"on",
"Binary",
"Data"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L457-L495 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.executeStep3 | private static function executeStep3($number) {
$codewords = array();
$codewords[9] = (int)bcmod($number, '636');
$number = bcdiv($number, '636', 0);
for ($i = 8; $i >= 0; $i--) {
$codewords[$i] = (int)bcmod($number, '1365');
$number = bcdiv($number, '1365... | php | private static function executeStep3($number) {
$codewords = array();
$codewords[9] = (int)bcmod($number, '636');
$number = bcdiv($number, '636', 0);
for ($i = 8; $i >= 0; $i--) {
$codewords[$i] = (int)bcmod($number, '1365');
$number = bcdiv($number, '1365... | [
"private",
"static",
"function",
"executeStep3",
"(",
"$",
"number",
")",
"{",
"$",
"codewords",
"=",
"array",
"(",
")",
";",
"$",
"codewords",
"[",
"9",
"]",
"=",
"(",
"int",
")",
"bcmod",
"(",
"$",
"number",
",",
"'636'",
")",
";",
"$",
"number",... | Executes Step 3: Conversion from Binary Data to Codewords
@param string $number BCNumber
@return int[] | [
"Executes",
"Step",
"3",
":",
"Conversion",
"from",
"Binary",
"Data",
"to",
"Codewords"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L503-L514 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.executeStep5 | private static function executeStep5($codewords, $crc) {
$characters = array();
for ($i = 0; $i < 10; $i++) {
if ($codewords[$i] <= 1286) {
$characters[$i] = self::$characterTable1[$codewords[$i]];
} else {
$characters[$i] = self::$characterT... | php | private static function executeStep5($codewords, $crc) {
$characters = array();
for ($i = 0; $i < 10; $i++) {
if ($codewords[$i] <= 1286) {
$characters[$i] = self::$characterTable1[$codewords[$i]];
} else {
$characters[$i] = self::$characterT... | [
"private",
"static",
"function",
"executeStep5",
"(",
"$",
"codewords",
",",
"$",
"crc",
")",
"{",
"$",
"characters",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"10",
";",
"$",
"i",
"++",
")",
"{",
"if",
... | Executes Step 5: Conversion from Codewords to Characters
@param int[] $codewords
@param int $crc
@return int[] | [
"Executes",
"Step",
"5",
":",
"Conversion",
"from",
"Codewords",
"to",
"Characters"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L539-L557 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.executeStep6 | private static function executeStep6($characters) {
$bars = '';
for ($i = 0; $i < 65; $i++) {
$barPosition = self::$barPositions[$i];
$descender = $barPosition[0];
$ascender = $barPosition[1];
$extenderDescender = !!($characters[$descender[0]] & (1 <... | php | private static function executeStep6($characters) {
$bars = '';
for ($i = 0; $i < 65; $i++) {
$barPosition = self::$barPositions[$i];
$descender = $barPosition[0];
$ascender = $barPosition[1];
$extenderDescender = !!($characters[$descender[0]] & (1 <... | [
"private",
"static",
"function",
"executeStep6",
"(",
"$",
"characters",
")",
"{",
"$",
"bars",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"65",
";",
"$",
"i",
"++",
")",
"{",
"$",
"barPosition",
"=",
"self",
"::",
"$",... | Executes Step 6: Conversion from Characters to the Intelligent Mail Barcode
@param int[] $characters
@return string | [
"Executes",
"Step",
"6",
":",
"Conversion",
"from",
"Characters",
"to",
"the",
"Intelligent",
"Mail",
"Barcode"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L565-L586 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.conversionRoutingCode | private static function conversionRoutingCode($zipcode) {
$number = $zipcode;
switch (strlen($zipcode)) {
case 11:
$number = bcadd($number, '1000000000', 0);
case 9:
$number = bcadd($number, '100000', 0);
case 5:
... | php | private static function conversionRoutingCode($zipcode) {
$number = $zipcode;
switch (strlen($zipcode)) {
case 11:
$number = bcadd($number, '1000000000', 0);
case 9:
$number = bcadd($number, '100000', 0);
case 5:
... | [
"private",
"static",
"function",
"conversionRoutingCode",
"(",
"$",
"zipcode",
")",
"{",
"$",
"number",
"=",
"$",
"zipcode",
";",
"switch",
"(",
"strlen",
"(",
"$",
"zipcode",
")",
")",
"{",
"case",
"11",
":",
"$",
"number",
"=",
"bcadd",
"(",
"$",
"... | Converts the routing code zipcode.
@param string $zipcode
@return string BCNumber | [
"Converts",
"the",
"routing",
"code",
"zipcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L594-L606 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.conversionTrackingCode | private static function conversionTrackingCode($number, $barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber) {
$number = bcmul($number, 10, 0);
$number = bcadd($number, $barcodeIdentifier[0], 0);
$number = bcmul($number, 5, 0);
$number = bcadd($number, $barco... | php | private static function conversionTrackingCode($number, $barcodeIdentifier, $serviceTypeIdentifier, $mailerIdentifier, $serialNumber) {
$number = bcmul($number, 10, 0);
$number = bcadd($number, $barcodeIdentifier[0], 0);
$number = bcmul($number, 5, 0);
$number = bcadd($number, $barco... | [
"private",
"static",
"function",
"conversionTrackingCode",
"(",
"$",
"number",
",",
"$",
"barcodeIdentifier",
",",
"$",
"serviceTypeIdentifier",
",",
"$",
"mailerIdentifier",
",",
"$",
"serialNumber",
")",
"{",
"$",
"number",
"=",
"bcmul",
"(",
"$",
"number",
... | Converts the tracking code number.
@param string $number BCNumber
@param string $barcodeIdentifier
@param string $serviceTypeIdentifier
@param string $mailerIdentifier
@param string $serialNumber
@return string BCNumber | [
"Converts",
"the",
"tracking",
"code",
"number",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L618-L631 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php | CINintelligentmail.bcdecuc | private static function bcdecuc($dec) {
$last = bcmod($dec, 256);
$remain = bcdiv(bcsub($dec, $last), 256, 0);
if ($remain == 0) {
return pack('C', $last);
} else {
return self::bcdecuc($remain) . pack('C', $last);
}
} | php | private static function bcdecuc($dec) {
$last = bcmod($dec, 256);
$remain = bcdiv(bcsub($dec, $last), 256, 0);
if ($remain == 0) {
return pack('C', $last);
} else {
return self::bcdecuc($remain) . pack('C', $last);
}
} | [
"private",
"static",
"function",
"bcdecuc",
"(",
"$",
"dec",
")",
"{",
"$",
"last",
"=",
"bcmod",
"(",
"$",
"dec",
",",
"256",
")",
";",
"$",
"remain",
"=",
"bcdiv",
"(",
"bcsub",
"(",
"$",
"dec",
",",
"$",
"last",
")",
",",
"256",
",",
"0",
... | Transforms a BCNumber into unsigned char*.
@param string $dec BCNumber
@param string | [
"Transforms",
"a",
"BCNumber",
"into",
"unsigned",
"char",
"*",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINintelligentmail.php#L639-L648 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/QrCode.php | QrCode.setStructureAppend | public function setStructureAppend($n, $m, $parity, $original_data)
{
$this->structure_append_n = $n;
$this->structure_append_m = $m;
$this->structure_append_parity = $parity;
$this->structure_append_original_data = $original_data;
return $this;
} | php | public function setStructureAppend($n, $m, $parity, $original_data)
{
$this->structure_append_n = $n;
$this->structure_append_m = $m;
$this->structure_append_parity = $parity;
$this->structure_append_original_data = $original_data;
return $this;
} | [
"public",
"function",
"setStructureAppend",
"(",
"$",
"n",
",",
"$",
"m",
",",
"$",
"parity",
",",
"$",
"original_data",
")",
"{",
"$",
"this",
"->",
"structure_append_n",
"=",
"$",
"n",
";",
"$",
"this",
"->",
"structure_append_m",
"=",
"$",
"m",
";",... | Set structure append.
@param int $n
@param int $m
@param int $parity Parity
@param string $original_data Original data
@return QrCode | [
"Set",
"structure",
"append",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/QrCode.php#L184-L192 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/QrCode.php | QrCode.setErrorCorrection | public function setErrorCorrection($error_correction)
{
if (!is_numeric($error_correction)) {
$level_constant = 'CodeItNow\BarcodeBundle\Utils\QrCode::LEVEL_'.strtoupper($error_correction);
$error_correction = constant($level_constant);
}
if (in_array($error_correcti... | php | public function setErrorCorrection($error_correction)
{
if (!is_numeric($error_correction)) {
$level_constant = 'CodeItNow\BarcodeBundle\Utils\QrCode::LEVEL_'.strtoupper($error_correction);
$error_correction = constant($level_constant);
}
if (in_array($error_correcti... | [
"public",
"function",
"setErrorCorrection",
"(",
"$",
"error_correction",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"error_correction",
")",
")",
"{",
"$",
"level_constant",
"=",
"'CodeItNow\\BarcodeBundle\\Utils\\QrCode::LEVEL_'",
".",
"strtoupper",
"(",
"$... | Set QR Code error correction level.
@param mixed $error_correction Error Correction Level
@return QrCode | [
"Set",
"QR",
"Code",
"error",
"correction",
"level",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/QrCode.php#L227-L239 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/QrCode.php | QrCode.getDataUri | public function getDataUri()
{
if (empty($this->image)) {
$this->create();
}
ob_start();
call_user_func('image'.$this->image_type, $this->image);
$contents = ob_get_clean();
return 'data:image/'.$this->image_type.';base64,'.base64_encode($contents);
... | php | public function getDataUri()
{
if (empty($this->image)) {
$this->create();
}
ob_start();
call_user_func('image'.$this->image_type, $this->image);
$contents = ob_get_clean();
return 'data:image/'.$this->image_type.';base64,'.base64_encode($contents);
... | [
"public",
"function",
"getDataUri",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"image",
")",
")",
"{",
"$",
"this",
"->",
"create",
"(",
")",
";",
"}",
"ob_start",
"(",
")",
";",
"call_user_func",
"(",
"'image'",
".",
"$",
"this",
... | Return the data URI.
@return string | [
"Return",
"the",
"data",
"URI",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/QrCode.php#L686-L697 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/QrCode.php | QrCode.render | public function render($filename = null, $format = 'png')
{
$this->create();
if ($format == 'jpg') {
$format = 'jpeg';
}
if (!in_array($format, $this->image_types_available)) {
$format = $this->image_type;
}
if (!function_exists('image'.$for... | php | public function render($filename = null, $format = 'png')
{
$this->create();
if ($format == 'jpg') {
$format = 'jpeg';
}
if (!in_array($format, $this->image_types_available)) {
$format = $this->image_type;
}
if (!function_exists('image'.$for... | [
"public",
"function",
"render",
"(",
"$",
"filename",
"=",
"null",
",",
"$",
"format",
"=",
"'png'",
")",
"{",
"$",
"this",
"->",
"create",
"(",
")",
";",
"if",
"(",
"$",
"format",
"==",
"'jpg'",
")",
"{",
"$",
"format",
"=",
"'jpeg'",
";",
"}",
... | Render the QR Code then save it to given file name or
output it to the browser when file name omitted.
@param null|string $filename File name of the QR Code
@param null|string $format Format of the file (png, jpeg, jpg, gif, wbmp)
@throws Exception
@throws Exception
@return QrCode | [
"Render",
"the",
"QR",
"Code",
"then",
"save",
"it",
"to",
"given",
"file",
"name",
"or",
"output",
"it",
"to",
"the",
"browser",
"when",
"file",
"name",
"omitted",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/QrCode.php#L725-L752 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/QrCode.php | QrCode.create | public function create()
{
$image_path = $this->image_path;
$path = $this->path;
$version_ul = 40;
$qrcode_data_string = $this->text;//Previously from $_GET["d"];
$qrcode_error_correct = $this->error_correction;//Previously from $_GET["e"];
$qrcode_module_size = $t... | php | public function create()
{
$image_path = $this->image_path;
$path = $this->path;
$version_ul = 40;
$qrcode_data_string = $this->text;//Previously from $_GET["d"];
$qrcode_error_correct = $this->error_correction;//Previously from $_GET["e"];
$qrcode_module_size = $t... | [
"public",
"function",
"create",
"(",
")",
"{",
"$",
"image_path",
"=",
"$",
"this",
"->",
"image_path",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"path",
";",
"$",
"version_ul",
"=",
"40",
";",
"$",
"qrcode_data_string",
"=",
"$",
"this",
"->",
"text... | Create the image.
@throws Exception
@throws \OverflowException | [
"Create",
"the",
"image",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/QrCode.php#L819-L1517 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.setForegroundColor | public function setForegroundColor($code) {
if ($code instanceof CINColor) {
$this->colorFg = $code;
} else {
$this->colorFg = new CINColor($code);
}
} | php | public function setForegroundColor($code) {
if ($code instanceof CINColor) {
$this->colorFg = $code;
} else {
$this->colorFg = new CINColor($code);
}
} | [
"public",
"function",
"setForegroundColor",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"$",
"code",
"instanceof",
"CINColor",
")",
"{",
"$",
"this",
"->",
"colorFg",
"=",
"$",
"code",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"colorFg",
"=",
"new",
"CINC... | Sets the foreground color of the barcode. It could be a CINColor
value or simply a language code (white, black, yellow...) or hex value.
@param mixed $code | [
"Sets",
"the",
"foreground",
"color",
"of",
"the",
"barcode",
".",
"It",
"could",
"be",
"a",
"CINColor",
"value",
"or",
"simply",
"a",
"language",
"code",
"(",
"white",
"black",
"yellow",
"...",
")",
"or",
"hex",
"value",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L62-L68 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.setBackgroundColor | public function setBackgroundColor($code) {
if ($code instanceof CINColor) {
$this->colorBg = $code;
} else {
$this->colorBg = new CINColor($code);
}
foreach ($this->labels as $label) {
$label->setBackgroundColor($this->colorBg);
}
... | php | public function setBackgroundColor($code) {
if ($code instanceof CINColor) {
$this->colorBg = $code;
} else {
$this->colorBg = new CINColor($code);
}
foreach ($this->labels as $label) {
$label->setBackgroundColor($this->colorBg);
}
... | [
"public",
"function",
"setBackgroundColor",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"$",
"code",
"instanceof",
"CINColor",
")",
"{",
"$",
"this",
"->",
"colorBg",
"=",
"$",
"code",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"colorBg",
"=",
"new",
"CINC... | Sets the background color of the barcode. It could be a CINColor
value or simply a language code (white, black, yellow...) or hex value.
@param mixed $code | [
"Sets",
"the",
"background",
"color",
"of",
"the",
"barcode",
".",
"It",
"could",
"be",
"a",
"CINColor",
"value",
"or",
"simply",
"a",
"language",
"code",
"(",
"white",
"black",
"yellow",
"...",
")",
"or",
"hex",
"value",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L85-L95 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.setScale | public function setScale($scale) {
$scale = intval($scale);
if ($scale <= 0) {
throw new CINArgumentException('The scale must be larger than 0.', 'scale');
}
$this->scale = $scale;
} | php | public function setScale($scale) {
$scale = intval($scale);
if ($scale <= 0) {
throw new CINArgumentException('The scale must be larger than 0.', 'scale');
}
$this->scale = $scale;
} | [
"public",
"function",
"setScale",
"(",
"$",
"scale",
")",
"{",
"$",
"scale",
"=",
"intval",
"(",
"$",
"scale",
")",
";",
"if",
"(",
"$",
"scale",
"<=",
"0",
")",
"{",
"throw",
"new",
"CINArgumentException",
"(",
"'The scale must be larger than 0.'",
",",
... | Sets the scale of the barcode in pixel.
If the scale is lower than 1, an exception is raised.
@param int $scale | [
"Sets",
"the",
"scale",
"of",
"the",
"barcode",
"in",
"pixel",
".",
"If",
"the",
"scale",
"is",
"lower",
"than",
"1",
"an",
"exception",
"is",
"raised",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L123-L130 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.getDimension | public function getDimension($w, $h) {
$labels = $this->getBiggestLabels(false);
$pixelsAround = array(0, 0, 0, 0); // TRBL
if (isset($labels[CINLabel::POSITION_TOP])) {
$dimension = $labels[CINLabel::POSITION_TOP]->getDimension();
$pixelsAround[0] += $dimension[1];
... | php | public function getDimension($w, $h) {
$labels = $this->getBiggestLabels(false);
$pixelsAround = array(0, 0, 0, 0); // TRBL
if (isset($labels[CINLabel::POSITION_TOP])) {
$dimension = $labels[CINLabel::POSITION_TOP]->getDimension();
$pixelsAround[0] += $dimension[1];
... | [
"public",
"function",
"getDimension",
"(",
"$",
"w",
",",
"$",
"h",
")",
"{",
"$",
"labels",
"=",
"$",
"this",
"->",
"getBiggestLabels",
"(",
"false",
")",
";",
"$",
"pixelsAround",
"=",
"array",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
... | Returns the maximal size of a barcode.
[0]->width
[1]->height
@param int $w
@param int $h
@return int[] | [
"Returns",
"the",
"maximal",
"size",
"of",
"a",
"barcode",
".",
"[",
"0",
"]",
"-",
">",
"width",
"[",
"1",
"]",
"-",
">",
"height"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L148-L209 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.setOffsetX | public function setOffsetX($offsetX) {
$offsetX = intval($offsetX);
if ($offsetX < 0) {
throw new CINArgumentException('The offset X must be 0 or larger.', 'offsetX');
}
$this->offsetX = $offsetX;
} | php | public function setOffsetX($offsetX) {
$offsetX = intval($offsetX);
if ($offsetX < 0) {
throw new CINArgumentException('The offset X must be 0 or larger.', 'offsetX');
}
$this->offsetX = $offsetX;
} | [
"public",
"function",
"setOffsetX",
"(",
"$",
"offsetX",
")",
"{",
"$",
"offsetX",
"=",
"intval",
"(",
"$",
"offsetX",
")",
";",
"if",
"(",
"$",
"offsetX",
"<",
"0",
")",
"{",
"throw",
"new",
"CINArgumentException",
"(",
"'The offset X must be 0 or larger.'"... | Sets the X offset.
@param int $offsetX | [
"Sets",
"the",
"X",
"offset",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L225-L232 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.setOffsetY | public function setOffsetY($offsetY) {
$offsetY = intval($offsetY);
if ($offsetY < 0) {
throw new CINArgumentException('The offset Y must be 0 or larger.', 'offsetY');
}
$this->offsetY = $offsetY;
} | php | public function setOffsetY($offsetY) {
$offsetY = intval($offsetY);
if ($offsetY < 0) {
throw new CINArgumentException('The offset Y must be 0 or larger.', 'offsetY');
}
$this->offsetY = $offsetY;
} | [
"public",
"function",
"setOffsetY",
"(",
"$",
"offsetY",
")",
"{",
"$",
"offsetY",
"=",
"intval",
"(",
"$",
"offsetY",
")",
";",
"if",
"(",
"$",
"offsetY",
"<",
"0",
")",
"{",
"throw",
"new",
"CINArgumentException",
"(",
"'The offset Y must be 0 or larger.'"... | Sets the Y offset.
@param int $offsetY | [
"Sets",
"the",
"Y",
"offset",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L248-L255 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.addLabel | public function addLabel(CINLabel $label) {
$label->setBackgroundColor($this->colorBg);
$label->setForegroundColor($this->colorFg);
$this->labels[] = $label;
} | php | public function addLabel(CINLabel $label) {
$label->setBackgroundColor($this->colorBg);
$label->setForegroundColor($this->colorFg);
$this->labels[] = $label;
} | [
"public",
"function",
"addLabel",
"(",
"CINLabel",
"$",
"label",
")",
"{",
"$",
"label",
"->",
"setBackgroundColor",
"(",
"$",
"this",
"->",
"colorBg",
")",
";",
"$",
"label",
"->",
"setForegroundColor",
"(",
"$",
"this",
"->",
"colorFg",
")",
";",
"$",
... | Adds the label to the drawing.
@param CINLabel $label | [
"Adds",
"the",
"label",
"to",
"the",
"drawing",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L262-L266 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.removeLabel | public function removeLabel(CINLabel $label) {
$remove = -1;
$c = count($this->labels);
for ($i = 0; $i < $c; $i++) {
if ($this->labels[$i] === $label) {
$remove = $i;
break;
}
}
if ($remove > -1) {
a... | php | public function removeLabel(CINLabel $label) {
$remove = -1;
$c = count($this->labels);
for ($i = 0; $i < $c; $i++) {
if ($this->labels[$i] === $label) {
$remove = $i;
break;
}
}
if ($remove > -1) {
a... | [
"public",
"function",
"removeLabel",
"(",
"CINLabel",
"$",
"label",
")",
"{",
"$",
"remove",
"=",
"-",
"1",
";",
"$",
"c",
"=",
"count",
"(",
"$",
"this",
"->",
"labels",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"c",... | Removes the label from the drawing.
@param CINLabel $label | [
"Removes",
"the",
"label",
"from",
"the",
"drawing",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L273-L286 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.drawText | protected function drawText($im, $x1, $y1, $x2, $y2) {
foreach ($this->labels as $label) {
$label->draw($im,
($x1 + $this->offsetX) * $this->scale + $this->pushLabel[0],
($y1 + $this->offsetY) * $this->scale + $this->pushLabel[1],
($x2 + $this->of... | php | protected function drawText($im, $x1, $y1, $x2, $y2) {
foreach ($this->labels as $label) {
$label->draw($im,
($x1 + $this->offsetX) * $this->scale + $this->pushLabel[0],
($y1 + $this->offsetY) * $this->scale + $this->pushLabel[1],
($x2 + $this->of... | [
"protected",
"function",
"drawText",
"(",
"$",
"im",
",",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"x2",
",",
"$",
"y2",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"labels",
"as",
"$",
"label",
")",
"{",
"$",
"label",
"->",
"draw",
"(",
"$",
"i... | Draws the text.
The coordinate passed are the positions of the barcode.
$x1 and $y1 represent the top left corner.
$x2 and $y2 represent the bottom right corner.
@param resource $im
@param int $x1
@param int $y1
@param int $x2
@param int $y2 | [
"Draws",
"the",
"text",
".",
"The",
"coordinate",
"passed",
"are",
"the",
"positions",
"of",
"the",
"barcode",
".",
"$x1",
"and",
"$y1",
"represent",
"the",
"top",
"left",
"corner",
".",
"$x2",
"and",
"$y2",
"represent",
"the",
"bottom",
"right",
"corner",... | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L307-L315 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.drawPixel | protected function drawPixel($im, $x, $y, $color = self::COLOR_FG) {
$xR = ($x + $this->offsetX) * $this->scale + $this->pushLabel[0];
$yR = ($y + $this->offsetY) * $this->scale + $this->pushLabel[1];
// We always draw a rectangle
imagefilledrectangle($im,
$xR,
... | php | protected function drawPixel($im, $x, $y, $color = self::COLOR_FG) {
$xR = ($x + $this->offsetX) * $this->scale + $this->pushLabel[0];
$yR = ($y + $this->offsetY) * $this->scale + $this->pushLabel[1];
// We always draw a rectangle
imagefilledrectangle($im,
$xR,
... | [
"protected",
"function",
"drawPixel",
"(",
"$",
"im",
",",
"$",
"x",
",",
"$",
"y",
",",
"$",
"color",
"=",
"self",
"::",
"COLOR_FG",
")",
"{",
"$",
"xR",
"=",
"(",
"$",
"x",
"+",
"$",
"this",
"->",
"offsetX",
")",
"*",
"$",
"this",
"->",
"sc... | Draws 1 pixel on the resource at a specific position with a determined color.
@param resource $im
@param int $x
@param int $y
@param int $color | [
"Draws",
"1",
"pixel",
"on",
"the",
"resource",
"at",
"a",
"specific",
"position",
"with",
"a",
"determined",
"color",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L325-L336 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.drawRectangle | protected function drawRectangle($im, $x1, $y1, $x2, $y2, $color = self::COLOR_FG) {
if ($this->scale === 1) {
imagefilledrectangle($im,
($x1 + $this->offsetX) + $this->pushLabel[0],
($y1 + $this->offsetY) + $this->pushLabel[1],
($x2 + $this->offs... | php | protected function drawRectangle($im, $x1, $y1, $x2, $y2, $color = self::COLOR_FG) {
if ($this->scale === 1) {
imagefilledrectangle($im,
($x1 + $this->offsetX) + $this->pushLabel[0],
($y1 + $this->offsetY) + $this->pushLabel[1],
($x2 + $this->offs... | [
"protected",
"function",
"drawRectangle",
"(",
"$",
"im",
",",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"x2",
",",
"$",
"y2",
",",
"$",
"color",
"=",
"self",
"::",
"COLOR_FG",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scale",
"===",
"1",
")",
"{",
... | Draws an empty rectangle on the resource at a specific position with a determined color.
@param resource $im
@param int $x1
@param int $y1
@param int $x2
@param int $y2
@param int $color | [
"Draws",
"an",
"empty",
"rectangle",
"on",
"the",
"resource",
"at",
"a",
"specific",
"position",
"with",
"a",
"determined",
"color",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L348-L362 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.drawFilledRectangle | protected function drawFilledRectangle($im, $x1, $y1, $x2, $y2, $color = self::COLOR_FG) {
if ($x1 > $x2) { // Swap
$x1 ^= $x2 ^= $x1 ^= $x2;
}
if ($y1 > $y2) { // Swap
$y1 ^= $y2 ^= $y1 ^= $y2;
}
imagefilledrectangle($im,
($x1 + $t... | php | protected function drawFilledRectangle($im, $x1, $y1, $x2, $y2, $color = self::COLOR_FG) {
if ($x1 > $x2) { // Swap
$x1 ^= $x2 ^= $x1 ^= $x2;
}
if ($y1 > $y2) { // Swap
$y1 ^= $y2 ^= $y1 ^= $y2;
}
imagefilledrectangle($im,
($x1 + $t... | [
"protected",
"function",
"drawFilledRectangle",
"(",
"$",
"im",
",",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"x2",
",",
"$",
"y2",
",",
"$",
"color",
"=",
"self",
"::",
"COLOR_FG",
")",
"{",
"if",
"(",
"$",
"x1",
">",
"$",
"x2",
")",
"{",
"// Swap... | Draws a filled rectangle on the resource at a specific position with a determined color.
@param resource $im
@param int $x1
@param int $y1
@param int $x2
@param int $y2
@param int $color | [
"Draws",
"a",
"filled",
"rectangle",
"on",
"the",
"resource",
"at",
"a",
"specific",
"position",
"with",
"a",
"determined",
"color",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L374-L389 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.getColor | protected function getColor($im, $color) {
if ($color === self::COLOR_BG) {
return $this->colorBg->allocate($im);
} else {
return $this->colorFg->allocate($im);
}
} | php | protected function getColor($im, $color) {
if ($color === self::COLOR_BG) {
return $this->colorBg->allocate($im);
} else {
return $this->colorFg->allocate($im);
}
} | [
"protected",
"function",
"getColor",
"(",
"$",
"im",
",",
"$",
"color",
")",
"{",
"if",
"(",
"$",
"color",
"===",
"self",
"::",
"COLOR_BG",
")",
"{",
"return",
"$",
"this",
"->",
"colorBg",
"->",
"allocate",
"(",
"$",
"im",
")",
";",
"}",
"else",
... | Allocates the color based on the integer.
@param resource $im
@param int $color
@return resource | [
"Allocates",
"the",
"color",
"based",
"on",
"the",
"integer",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L398-L404 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINBarcode.php | CINBarcode.getBiggestLabels | private function getBiggestLabels($reversed = false) {
$searchLR = $reversed ? 1 : 0;
$searchTB = $reversed ? 0 : 1;
$labels = array();
foreach ($this->labels as $label) {
$position = $label->getPosition();
if (isset($labels[$position])) {
... | php | private function getBiggestLabels($reversed = false) {
$searchLR = $reversed ? 1 : 0;
$searchTB = $reversed ? 0 : 1;
$labels = array();
foreach ($this->labels as $label) {
$position = $label->getPosition();
if (isset($labels[$position])) {
... | [
"private",
"function",
"getBiggestLabels",
"(",
"$",
"reversed",
"=",
"false",
")",
"{",
"$",
"searchLR",
"=",
"$",
"reversed",
"?",
"1",
":",
"0",
";",
"$",
"searchTB",
"=",
"$",
"reversed",
"?",
"0",
":",
"1",
";",
"$",
"labels",
"=",
"array",
"(... | Returning the biggest label widths for LEFT/RIGHT and heights for TOP/BOTTOM.
@param bool $reversed
@return CINLabel[] | [
"Returning",
"the",
"biggest",
"label",
"widths",
"for",
"LEFT",
"/",
"RIGHT",
"and",
"heights",
"for",
"TOP",
"/",
"BOTTOM",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINBarcode.php#L412-L437 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/JoinDraw.php | JoinDraw.findPosition | private function findPosition($size1, $size2, $alignment) {
$rsize1 = max($size1, $size2);
$rsize2 = min($size1, $size2);
if ($alignment === self::ALIGN_LEFT) { // Or TOP
return 0;
} elseif ($alignment === self::ALIGN_CENTER) {
return $rsize1 / 2 - $rsize2... | php | private function findPosition($size1, $size2, $alignment) {
$rsize1 = max($size1, $size2);
$rsize2 = min($size1, $size2);
if ($alignment === self::ALIGN_LEFT) { // Or TOP
return 0;
} elseif ($alignment === self::ALIGN_CENTER) {
return $rsize1 / 2 - $rsize2... | [
"private",
"function",
"findPosition",
"(",
"$",
"size1",
",",
"$",
"size2",
",",
"$",
"alignment",
")",
"{",
"$",
"rsize1",
"=",
"max",
"(",
"$",
"size1",
",",
"$",
"size2",
")",
";",
"$",
"rsize2",
"=",
"min",
"(",
"$",
"size1",
",",
"$",
"size... | Finds the position where the barcode should be aligned.
@param int $size1
@param int $size2
@param int $ailgnment
@return int | [
"Finds",
"the",
"position",
"where",
"the",
"barcode",
"should",
"be",
"aligned",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/JoinDraw.php#L84-L95 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/JoinDraw.php | JoinDraw.createIm | private function createIm() {
$w1 = imagesx($this->image1);
$w2 = imagesx($this->image2);
$h1 = imagesy($this->image1);
$h2 = imagesy($this->image2);
if ($this->position === self::POSITION_LEFT || $this->position === self::POSITION_RIGHT) {
$w = $w1 + $w2 + $t... | php | private function createIm() {
$w1 = imagesx($this->image1);
$w2 = imagesx($this->image2);
$h1 = imagesy($this->image1);
$h2 = imagesy($this->image2);
if ($this->position === self::POSITION_LEFT || $this->position === self::POSITION_RIGHT) {
$w = $w1 + $w2 + $t... | [
"private",
"function",
"createIm",
"(",
")",
"{",
"$",
"w1",
"=",
"imagesx",
"(",
"$",
"this",
"->",
"image1",
")",
";",
"$",
"w2",
"=",
"imagesx",
"(",
"$",
"this",
"->",
"image2",
")",
";",
"$",
"h1",
"=",
"imagesy",
"(",
"$",
"this",
"->",
"... | Creates the image. | [
"Creates",
"the",
"image",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/JoinDraw.php#L116-L186 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINi25.php | CINi25.draw | public function draw($im) {
$temp_text = $this->text;
// Checksum
if ($this->checksum === true) {
$this->calculateChecksum();
$temp_text .= $this->keys[$this->checksumValue];
}
// Starting Code
$this->drawChar($im, '0000', true);
... | php | public function draw($im) {
$temp_text = $this->text;
// Checksum
if ($this->checksum === true) {
$this->calculateChecksum();
$temp_text .= $this->keys[$this->checksumValue];
}
// Starting Code
$this->drawChar($im, '0000', true);
... | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"$",
"temp_text",
"=",
"$",
"this",
"->",
"text",
";",
"// Checksum\r",
"if",
"(",
"$",
"this",
"->",
"checksum",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"calculateChecksum",
"(",
")",
";",
... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINi25.php#L67-L95 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINi25.php | CINi25.getDimension | public function getDimension($w, $h) {
$textlength = (3 + ($this->ratio + 1) * 2) * strlen($this->text);
$startlength = 4;
$checksumlength = 0;
if ($this->checksum === true) {
$checksumlength = (3 + ($this->ratio + 1) * 2);
}
$endlength = 2 + ($this->... | php | public function getDimension($w, $h) {
$textlength = (3 + ($this->ratio + 1) * 2) * strlen($this->text);
$startlength = 4;
$checksumlength = 0;
if ($this->checksum === true) {
$checksumlength = (3 + ($this->ratio + 1) * 2);
}
$endlength = 2 + ($this->... | [
"public",
"function",
"getDimension",
"(",
"$",
"w",
",",
"$",
"h",
")",
"{",
"$",
"textlength",
"=",
"(",
"3",
"+",
"(",
"$",
"this",
"->",
"ratio",
"+",
"1",
")",
"*",
"2",
")",
"*",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"$",
... | Returns the maximal size of a barcode.
@param int $w
@param int $h
@return int[] | [
"Returns",
"the",
"maximal",
"size",
"of",
"a",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINi25.php#L104-L117 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINi25.php | CINi25.validate | protected function validate() {
$c = strlen($this->text);
if ($c === 0) {
throw new CINParseException('i25', 'No data has been entered.');
}
// Checking if all chars are allowed
for ($i = 0; $i < $c; $i++) {
if (array_search($this->text[$i], $this... | php | protected function validate() {
$c = strlen($this->text);
if ($c === 0) {
throw new CINParseException('i25', 'No data has been entered.');
}
// Checking if all chars are allowed
for ($i = 0; $i < $c; $i++) {
if (array_search($this->text[$i], $this... | [
"protected",
"function",
"validate",
"(",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"if",
"(",
"$",
"c",
"===",
"0",
")",
"{",
"throw",
"new",
"CINParseException",
"(",
"'i25'",
",",
"'No data has been entered.'",
")"... | Validates the input. | [
"Validates",
"the",
"input",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINi25.php#L122-L143 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINi25.php | CINi25.calculateChecksum | protected function calculateChecksum() {
// Calculating Checksum
// Consider the right-most digit of the message to be in an "even" position,
// and assign odd/even to each character moving from right to left
// Even Position = 3, Odd Position = 1
// Multiply it by the numbe... | php | protected function calculateChecksum() {
// Calculating Checksum
// Consider the right-most digit of the message to be in an "even" position,
// and assign odd/even to each character moving from right to left
// Even Position = 3, Odd Position = 1
// Multiply it by the numbe... | [
"protected",
"function",
"calculateChecksum",
"(",
")",
"{",
"// Calculating Checksum\r",
"// Consider the right-most digit of the message to be in an \"even\" position,\r",
"// and assign odd/even to each character moving from right to left\r",
"// Even Position = 3, Odd Position = 1\r",
"// Mu... | Overloaded method to calculate checksum. | [
"Overloaded",
"method",
"to",
"calculate",
"checksum",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINi25.php#L148-L171 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINi25.php | CINi25.changeBars | private function changeBars($in) {
if ($this->ratio > 1) {
$c = strlen($in);
for ($i = 0; $i < $c; $i++) {
$in[$i] = $in[$i] === '1' ? $this->ratio : $in[$i];
}
}
return $in;
} | php | private function changeBars($in) {
if ($this->ratio > 1) {
$c = strlen($in);
for ($i = 0; $i < $c; $i++) {
$in[$i] = $in[$i] === '1' ? $this->ratio : $in[$i];
}
}
return $in;
} | [
"private",
"function",
"changeBars",
"(",
"$",
"in",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ratio",
">",
"1",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"in",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"c",
";"... | Changes the size of the bars based on the ratio
@param string $in
@return string | [
"Changes",
"the",
"size",
"of",
"the",
"bars",
"based",
"on",
"the",
"ratio"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINi25.php#L194-L203 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupcext2.php | CINupcext2.draw | public function draw($im) {
// Starting Code
$this->drawChar($im, '001', true);
// Code
for ($i = 0; $i < 2; $i++) {
$this->drawChar($im, self::inverse($this->findCode($this->text[$i]), $this->codeParity[intval($this->text) % 4][$i]), false);
if ($i === 0)... | php | public function draw($im) {
// Starting Code
$this->drawChar($im, '001', true);
// Code
for ($i = 0; $i < 2; $i++) {
$this->drawChar($im, self::inverse($this->findCode($this->text[$i]), $this->codeParity[intval($this->text) % 4][$i]), false);
if ($i === 0)... | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"// Starting Code\r",
"$",
"this",
"->",
"drawChar",
"(",
"$",
"im",
",",
"'001'",
",",
"true",
")",
";",
"// Code\r",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"2",
";",
"$",
"i... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupcext2.php#L59-L72 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupcext2.php | CINupcext2.getDimension | public function getDimension($w, $h) {
$startlength = 4;
$textlength = 2 * 7;
$intercharlength = 2;
$w += $startlength + $textlength + $intercharlength;
$h += $this->thickness;
return parent::getDimension($w, $h);
} | php | public function getDimension($w, $h) {
$startlength = 4;
$textlength = 2 * 7;
$intercharlength = 2;
$w += $startlength + $textlength + $intercharlength;
$h += $this->thickness;
return parent::getDimension($w, $h);
} | [
"public",
"function",
"getDimension",
"(",
"$",
"w",
",",
"$",
"h",
")",
"{",
"$",
"startlength",
"=",
"4",
";",
"$",
"textlength",
"=",
"2",
"*",
"7",
";",
"$",
"intercharlength",
"=",
"2",
";",
"$",
"w",
"+=",
"$",
"startlength",
"+",
"$",
"tex... | Returns the maximal size of a barcode.
@param int $w
@param int $h
@return int[] | [
"Returns",
"the",
"maximal",
"size",
"of",
"a",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupcext2.php#L81-L89 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINcode39.php | CINcode39.calculateChecksum | protected function calculateChecksum() {
$this->checksumValue = 0;
$c = strlen($this->text);
for ($i = 0; $i < $c; $i++) {
$this->checksumValue += $this->findIndex($this->text[$i]);
}
$this->checksumValue = $this->checksumValue % 43;
} | php | protected function calculateChecksum() {
$this->checksumValue = 0;
$c = strlen($this->text);
for ($i = 0; $i < $c; $i++) {
$this->checksumValue += $this->findIndex($this->text[$i]);
}
$this->checksumValue = $this->checksumValue % 43;
} | [
"protected",
"function",
"calculateChecksum",
"(",
")",
"{",
"$",
"this",
"->",
"checksumValue",
"=",
"0",
";",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"c",
";"... | Overloaded method to calculate checksum. | [
"Overloaded",
"method",
"to",
"calculate",
"checksum",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINcode39.php#L170-L178 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php | BarcodeGenerator.generate | public function generate($text=null, $type=null, $format=null, $fontPath=null){
if(isset($text)){
$this->text = $text;
}
if(isset($type)){
$this->barcodeType = $type;
}
if(isset($format)){
$this->format = $format;
}
if(... | php | public function generate($text=null, $type=null, $format=null, $fontPath=null){
if(isset($text)){
$this->text = $text;
}
if(isset($type)){
$this->barcodeType = $type;
}
if(isset($format)){
$this->format = $format;
}
if(... | [
"public",
"function",
"generate",
"(",
"$",
"text",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"$",
"format",
"=",
"null",
",",
"$",
"fontPath",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"text",
")",
")",
"{",
"$",
"this",
"->"... | Generate barcode
@param string $text Barcode text to generate
@param string $type Barcode type such as code128
@param string $format Barcode format such as png, jpeg
@param string $fontPath Font path to use in barcode text
@return string Base64Encoded string will return | [
"Generate",
"barcode"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php#L226-L242 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php | BarcodeGenerator._getCode | private function _getCode(){
$code = null;
//try{
$text = $this->text;
$textColor = new CINColor($this->foregroundColor);
$backgroudColor = new CINColor($this->backgroundColor);
$fontPath = isset($this->font) ? $this->font : $this->_getDefaultFont();
... | php | private function _getCode(){
$code = null;
//try{
$text = $this->text;
$textColor = new CINColor($this->foregroundColor);
$backgroudColor = new CINColor($this->backgroundColor);
$fontPath = isset($this->font) ? $this->font : $this->_getDefaultFont();
... | [
"private",
"function",
"_getCode",
"(",
")",
"{",
"$",
"code",
"=",
"null",
";",
"//try{",
"$",
"text",
"=",
"$",
"this",
"->",
"text",
";",
"$",
"textColor",
"=",
"new",
"CINColor",
"(",
"$",
"this",
"->",
"foregroundColor",
")",
";",
"$",
"backgrou... | Get barcode object to create image
@return object Barcode object | [
"Get",
"barcode",
"object",
"to",
"create",
"image"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php#L248-L283 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php | BarcodeGenerator._render | private function _render(){
$textColor = new CINColor($this->foregroundColor);
$backgroudColor = new CINColor($this->backgroundColor);
/* Here is the list of the arguments
1 - Filename (empty : display on screen)
2 - Background color */
$drawing = new CINDrawing(... | php | private function _render(){
$textColor = new CINColor($this->foregroundColor);
$backgroudColor = new CINColor($this->backgroundColor);
/* Here is the list of the arguments
1 - Filename (empty : display on screen)
2 - Background color */
$drawing = new CINDrawing(... | [
"private",
"function",
"_render",
"(",
")",
"{",
"$",
"textColor",
"=",
"new",
"CINColor",
"(",
"$",
"this",
"->",
"foregroundColor",
")",
";",
"$",
"backgroudColor",
"=",
"new",
"CINColor",
"(",
"$",
"this",
"->",
"backgroundColor",
")",
";",
"/* Here is ... | Render barcode as base64 encoded
@return string Base64Encoded image | [
"Render",
"barcode",
"as",
"base64",
"encoded"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php#L289-L328 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php | BarcodeGenerator._getFormat | private function _getFormat(){
$format = '';
switch(strtoupper($this->format)){
case 'PNG':
$format = CINDrawing::IMG_FORMAT_PNG;
break;
case 'JPEG':
$format = CINDrawing::IMG_FORMAT_JPEG;
break;
case 'GI... | php | private function _getFormat(){
$format = '';
switch(strtoupper($this->format)){
case 'PNG':
$format = CINDrawing::IMG_FORMAT_PNG;
break;
case 'JPEG':
$format = CINDrawing::IMG_FORMAT_JPEG;
break;
case 'GI... | [
"private",
"function",
"_getFormat",
"(",
")",
"{",
"$",
"format",
"=",
"''",
";",
"switch",
"(",
"strtoupper",
"(",
"$",
"this",
"->",
"format",
")",
")",
"{",
"case",
"'PNG'",
":",
"$",
"format",
"=",
"CINDrawing",
"::",
"IMG_FORMAT_PNG",
";",
"break... | Barcode image format
@return string | [
"Barcode",
"image",
"format"
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Utils/BarcodeGenerator.php#L334-L354 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINpostnet.php | CINpostnet.draw | public function draw($im) {
// Checksum
$checksum = 0;
$c = strlen($this->text);
for ($i = 0; $i < $c; $i++) {
$checksum += intval($this->text[$i]);
}
$checksum = 10 - ($checksum % 10);
// Starting Code
$this->drawChar($im, '1');
... | php | public function draw($im) {
// Checksum
$checksum = 0;
$c = strlen($this->text);
for ($i = 0; $i < $c; $i++) {
$checksum += intval($this->text[$i]);
}
$checksum = 10 - ($checksum % 10);
// Starting Code
$this->drawChar($im, '1');
... | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"// Checksum\r",
"$",
"checksum",
"=",
"0",
";",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"c",
";",
"... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINpostnet.php#L47-L71 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINpostnet.php | CINpostnet.drawChar | protected function drawChar($im, $code, $startBar = true) {
$c = strlen($code);
for ($i = 0; $i < $c; $i++) {
if ($code[$i] === '0') {
$posY = $this->thickness - ($this->thickness / 2.5);
} else {
$posY = 0;
}
$thi... | php | protected function drawChar($im, $code, $startBar = true) {
$c = strlen($code);
for ($i = 0; $i < $c; $i++) {
if ($code[$i] === '0') {
$posY = $this->thickness - ($this->thickness / 2.5);
} else {
$posY = 0;
}
$thi... | [
"protected",
"function",
"drawChar",
"(",
"$",
"im",
",",
"$",
"code",
",",
"$",
"startBar",
"=",
"true",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"code",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"c",
";",
"$",... | Overloaded method for drawing special barcode.
@param resource $im
@param string $code
@param boolean $startBar | [
"Overloaded",
"method",
"for",
"drawing",
"special",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINpostnet.php#L126-L138 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupce.php | CINupce.draw | public function draw($im) {
$this->calculateChecksum();
// Starting Code
$this->drawChar($im, '000', true);
$c = strlen($this->upce);
for ($i = 0; $i < $c; $i++) {
$this->drawChar($im, self::inverse($this->findCode($this->upce[$i]), $this->codeParity[intval($t... | php | public function draw($im) {
$this->calculateChecksum();
// Starting Code
$this->drawChar($im, '000', true);
$c = strlen($this->upce);
for ($i = 0; $i < $c; $i++) {
$this->drawChar($im, self::inverse($this->findCode($this->upce[$i]), $this->codeParity[intval($t... | [
"public",
"function",
"draw",
"(",
"$",
"im",
")",
"{",
"$",
"this",
"->",
"calculateChecksum",
"(",
")",
";",
"// Starting Code\r",
"$",
"this",
"->",
"drawChar",
"(",
"$",
"im",
",",
"'000'",
",",
"true",
")",
";",
"$",
"c",
"=",
"strlen",
"(",
"... | Draws the barcode.
@param resource $im | [
"Draws",
"the",
"barcode",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupce.php#L92-L114 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupce.php | CINupce.addDefaultLabel | protected function addDefaultLabel() {
if ($this->isDefaultEanLabelEnabled()) {
$this->processChecksum();
$font = $this->font;
$this->labelLeft = new CINLabel(substr($this->text, 0, 1), $font, CINLabel::POSITION_LEFT, CINLabel::ALIGN_BOTTOM);
$labelLeftDime... | php | protected function addDefaultLabel() {
if ($this->isDefaultEanLabelEnabled()) {
$this->processChecksum();
$font = $this->font;
$this->labelLeft = new CINLabel(substr($this->text, 0, 1), $font, CINLabel::POSITION_LEFT, CINLabel::ALIGN_BOTTOM);
$labelLeftDime... | [
"protected",
"function",
"addDefaultLabel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDefaultEanLabelEnabled",
"(",
")",
")",
"{",
"$",
"this",
"->",
"processChecksum",
"(",
")",
";",
"$",
"font",
"=",
"$",
"this",
"->",
"font",
";",
"$",
"this",... | Adds the default label. | [
"Adds",
"the",
"default",
"label",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupce.php#L137-L160 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupce.php | CINupce.validate | protected function validate() {
$c = strlen($this->text);
if ($c === 0) {
throw new CINParseException('upce', 'No data has been entered.');
}
// Checking if all chars are allowed
for ($i = 0; $i < $c; $i++) {
if (array_search($this->text[$i], $thi... | php | protected function validate() {
$c = strlen($this->text);
if ($c === 0) {
throw new CINParseException('upce', 'No data has been entered.');
}
// Checking if all chars are allowed
for ($i = 0; $i < $c; $i++) {
if (array_search($this->text[$i], $thi... | [
"protected",
"function",
"validate",
"(",
")",
"{",
"$",
"c",
"=",
"strlen",
"(",
"$",
"this",
"->",
"text",
")",
";",
"if",
"(",
"$",
"c",
"===",
"0",
")",
"{",
"throw",
"new",
"CINParseException",
"(",
"'upce'",
",",
"'No data has been entered.'",
")... | Validates the input. | [
"Validates",
"the",
"input",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupce.php#L176-L247 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/CINupce.php | CINupce.drawExtendedBars | protected function drawExtendedBars($im, $plus) {
$rememberX = $this->positionX;
$rememberH = $this->thickness;
// We increase the bars
$this->thickness = $this->thickness + intval($plus / $this->scale);
$this->positionX = 0;
$this->drawSingleBar($im, CINBarcode::... | php | protected function drawExtendedBars($im, $plus) {
$rememberX = $this->positionX;
$rememberH = $this->thickness;
// We increase the bars
$this->thickness = $this->thickness + intval($plus / $this->scale);
$this->positionX = 0;
$this->drawSingleBar($im, CINBarcode::... | [
"protected",
"function",
"drawExtendedBars",
"(",
"$",
"im",
",",
"$",
"plus",
")",
"{",
"$",
"rememberX",
"=",
"$",
"this",
"->",
"positionX",
";",
"$",
"rememberH",
"=",
"$",
"this",
"->",
"thickness",
";",
"// We increase the bars\r",
"$",
"this",
"->",... | Draws the extended bars on the image.
@param resource $im
@param int $plus | [
"Draws",
"the",
"extended",
"bars",
"on",
"the",
"image",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/CINupce.php#L302-L321 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawJPG.php | CINDrawJPG.setDPI | public function setDPI($dpi) {
if(is_int($dpi)) {
$this->dpi = max(1, $dpi);
} else {
$this->dpi = null;
}
} | php | public function setDPI($dpi) {
if(is_int($dpi)) {
$this->dpi = max(1, $dpi);
} else {
$this->dpi = null;
}
} | [
"public",
"function",
"setDPI",
"(",
"$",
"dpi",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"dpi",
")",
")",
"{",
"$",
"this",
"->",
"dpi",
"=",
"max",
"(",
"1",
",",
"$",
"dpi",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"dpi",
"=",
"nul... | Sets the DPI.
@param int $dpi | [
"Sets",
"the",
"DPI",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawJPG.php#L46-L52 |
codeitnowin/barcode-generator | CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawJPG.php | CINDrawJPG.draw | public function draw() {
ob_start();
imagejpeg($this->im, null, $this->quality);
$bin = ob_get_contents();
ob_end_clean();
$this->setInternalProperties($bin);
if (empty($this->filename)) {
echo $bin;
} else {
file_put_contents(... | php | public function draw() {
ob_start();
imagejpeg($this->im, null, $this->quality);
$bin = ob_get_contents();
ob_end_clean();
$this->setInternalProperties($bin);
if (empty($this->filename)) {
echo $bin;
} else {
file_put_contents(... | [
"public",
"function",
"draw",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"imagejpeg",
"(",
"$",
"this",
"->",
"im",
",",
"null",
",",
"$",
"this",
"->",
"quality",
")",
";",
"$",
"bin",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_end_clean",
"(",
")"... | Draws the JPG on the screen or in a file. | [
"Draws",
"the",
"JPG",
"on",
"the",
"screen",
"or",
"in",
"a",
"file",
"."
] | train | https://github.com/codeitnowin/barcode-generator/blob/6325a15ae904ec401b947e1a3e868de1c2cc80b0/CodeItNow/BarcodeBundle/Generator/Drawer/CINDrawJPG.php#L66-L79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.