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
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.average
public function average($alias, $field = null, $script = null) { $aggregation = new AvgAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function average($alias, $field = null, $script = null) { $aggregation = new AvgAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "average", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "AvgAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ";", "$"...
Add an average aggregate. @param $alias @param string|null $field @param string|null $script
[ "Add", "an", "average", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L52-L57
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.cardinality
public function cardinality($alias, $field = null, $script = null, $precision = null, $rehash = null) { $aggregation = new CardinalityAggregation($alias); $aggregation->setField($field); $aggregation->setScript($script); $aggregation->setPrecisionThreshold($precision); $a...
php
public function cardinality($alias, $field = null, $script = null, $precision = null, $rehash = null) { $aggregation = new CardinalityAggregation($alias); $aggregation->setField($field); $aggregation->setScript($script); $aggregation->setPrecisionThreshold($precision); $a...
[ "public", "function", "cardinality", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ",", "$", "precision", "=", "null", ",", "$", "rehash", "=", "null", ")", "{", "$", "aggregation", "=", "new", "CardinalityAggregat...
Add an cardinality aggregate. @param $alias @param string|null $field @param string|null $script @param int $precision @param bool $rehash
[ "Add", "an", "cardinality", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L68-L81
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.dateRange
public function dateRange($alias, $field, $format, array $ranges) { $aggregation = new DateRangeAggregation($alias, $field, $format, $ranges); $this->append($aggregation); }
php
public function dateRange($alias, $field, $format, array $ranges) { $aggregation = new DateRangeAggregation($alias, $field, $format, $ranges); $this->append($aggregation); }
[ "public", "function", "dateRange", "(", "$", "alias", ",", "$", "field", ",", "$", "format", ",", "array", "$", "ranges", ")", "{", "$", "aggregation", "=", "new", "DateRangeAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "format", ",", ...
Add a date range aggregate. @param $alias @param $field @param $format @param array $ranges @internal param null $from @internal param null $to
[ "Add", "a", "date", "range", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L94-L99
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.geoBounds
public function geoBounds($alias, $field, $wrap_longitude = true) { $aggregation = new GeoBoundsAggregation($alias, $field, $wrap_longitude); $this->append($aggregation); }
php
public function geoBounds($alias, $field, $wrap_longitude = true) { $aggregation = new GeoBoundsAggregation($alias, $field, $wrap_longitude); $this->append($aggregation); }
[ "public", "function", "geoBounds", "(", "$", "alias", ",", "$", "field", ",", "$", "wrap_longitude", "=", "true", ")", "{", "$", "aggregation", "=", "new", "GeoBoundsAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "wrap_longitude", ")", ";"...
Add a geo bounds aggregate. @param string $alias @param null|string $field @param bool $wrap_longitude
[ "Add", "a", "geo", "bounds", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L108-L113
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.geoDistance
public function geoDistance($alias, $field, $origin, array $ranges) { $aggregation = new GeoDistanceAggregation($alias, $field, $origin, $ranges); $this->append($aggregation); }
php
public function geoDistance($alias, $field, $origin, array $ranges) { $aggregation = new GeoDistanceAggregation($alias, $field, $origin, $ranges); $this->append($aggregation); }
[ "public", "function", "geoDistance", "(", "$", "alias", ",", "$", "field", ",", "$", "origin", ",", "array", "$", "ranges", ")", "{", "$", "aggregation", "=", "new", "GeoDistanceAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "origin", ",...
Add a geo bounds aggregate. @param string $alias @param null|string $field @param string $origin @param array $ranges
[ "Add", "a", "geo", "bounds", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L123-L128
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.geoHashGrid
public function geoHashGrid($alias, $field, $precision, $size = null, $shardSize = null) { $aggregation = new GeoHashGridAggregation($alias, $field, $precision, $size, $shardSize); $this->append($aggregation); }
php
public function geoHashGrid($alias, $field, $precision, $size = null, $shardSize = null) { $aggregation = new GeoHashGridAggregation($alias, $field, $precision, $size, $shardSize); $this->append($aggregation); }
[ "public", "function", "geoHashGrid", "(", "$", "alias", ",", "$", "field", ",", "$", "precision", ",", "$", "size", "=", "null", ",", "$", "shardSize", "=", "null", ")", "{", "$", "aggregation", "=", "new", "GeoHashGridAggregation", "(", "$", "alias", ...
Add a geo hash grid aggregate. @param string $alias @param null|string $field @param float $precision @param null $size @param null $shardSize
[ "Add", "a", "geo", "hash", "grid", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L139-L144
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.histogram
public function histogram( $alias, $field, $interval, $minDocCount = null, $orderMode = null, $orderDirection = 'asc', $extendedBoundsMin = null, $extendedBoundsMax = null, $keyed = null ) { $aggregation = new HistogramAggregation($alia...
php
public function histogram( $alias, $field, $interval, $minDocCount = null, $orderMode = null, $orderDirection = 'asc', $extendedBoundsMin = null, $extendedBoundsMax = null, $keyed = null ) { $aggregation = new HistogramAggregation($alia...
[ "public", "function", "histogram", "(", "$", "alias", ",", "$", "field", ",", "$", "interval", ",", "$", "minDocCount", "=", "null", ",", "$", "orderMode", "=", "null", ",", "$", "orderDirection", "=", "'asc'", ",", "$", "extendedBoundsMin", "=", "null",...
Add a histogram aggregate. @param $alias @param string $field @param int $interval @param int $minDocCount @param string $orderMode @param string $orderDirection @param int $extendedBoundsMin @param int $extendedBoundsMax @param bool $keyed
[ "Add", "a", "histogram", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L159-L174
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.ipv4Range
public function ipv4Range($alias, $field, array $ranges) { $aggregation = new Ipv4RangeAggregation($alias, $field, $ranges); $this->append($aggregation); }
php
public function ipv4Range($alias, $field, array $ranges) { $aggregation = new Ipv4RangeAggregation($alias, $field, $ranges); $this->append($aggregation); }
[ "public", "function", "ipv4Range", "(", "$", "alias", ",", "$", "field", ",", "array", "$", "ranges", ")", "{", "$", "aggregation", "=", "new", "Ipv4RangeAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "ranges", ")", ";", "$", "this", "...
Add an ipv4 range aggregate. @param $alias @param null $field @param array $ranges
[ "Add", "an", "ipv4", "range", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L183-L188
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.max
public function max($alias, $field = null, $script = null) { $aggregation = new MaxAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function max($alias, $field = null, $script = null) { $aggregation = new MaxAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "max", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "MaxAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ";", "$", ...
Add an max aggregate. @param $alias @param string|null $field @param string|null $script
[ "Add", "an", "max", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L197-L202
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.min
public function min($alias, $field = null, $script = null) { $aggregation = new MinAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function min($alias, $field = null, $script = null) { $aggregation = new MinAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "min", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "MinAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ";", "$", ...
Add an min aggregate. @param $alias @param string|null $field @param string|null $script
[ "Add", "an", "min", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L211-L216
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.missing
public function missing($alias, $field) { $aggregation = new MissingAggregation($alias, $field); $this->append($aggregation); }
php
public function missing($alias, $field) { $aggregation = new MissingAggregation($alias, $field); $this->append($aggregation); }
[ "public", "function", "missing", "(", "$", "alias", ",", "$", "field", ")", "{", "$", "aggregation", "=", "new", "MissingAggregation", "(", "$", "alias", ",", "$", "field", ")", ";", "$", "this", "->", "append", "(", "$", "aggregation", ")", ";", "}"...
Add an missing aggregate. @param string $alias @param string $field
[ "Add", "an", "missing", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L224-L229
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.percentile
public function percentile($alias, $field, $percents, $script = null, $compression = null) { $aggregation = new PercentilesAggregation($alias, $field, $percents, $script, $compression); $this->append($aggregation); }
php
public function percentile($alias, $field, $percents, $script = null, $compression = null) { $aggregation = new PercentilesAggregation($alias, $field, $percents, $script, $compression); $this->append($aggregation); }
[ "public", "function", "percentile", "(", "$", "alias", ",", "$", "field", ",", "$", "percents", ",", "$", "script", "=", "null", ",", "$", "compression", "=", "null", ")", "{", "$", "aggregation", "=", "new", "PercentilesAggregation", "(", "$", "alias", ...
Add an percentile aggregate. @param $alias @param string $field @param $percents @param null $script @param null $compression
[ "Add", "an", "percentile", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L240-L245
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.percentileRanks
public function percentileRanks($alias, $field, array $values, $script = null, $compression = null) { $aggregation = new PercentileRanksAggregation($alias, $field, $values, $script, $compression); $this->append($aggregation); }
php
public function percentileRanks($alias, $field, array $values, $script = null, $compression = null) { $aggregation = new PercentileRanksAggregation($alias, $field, $values, $script, $compression); $this->append($aggregation); }
[ "public", "function", "percentileRanks", "(", "$", "alias", ",", "$", "field", ",", "array", "$", "values", ",", "$", "script", "=", "null", ",", "$", "compression", "=", "null", ")", "{", "$", "aggregation", "=", "new", "PercentileRanksAggregation", "(", ...
Add an percentileRanks aggregate. @param $alias @param string $field @param array $values @param null $script @param null $compression
[ "Add", "an", "percentileRanks", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L256-L261
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.stats
public function stats($alias, $field = null, $script = null) { $aggregation = new StatsAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function stats($alias, $field = null, $script = null) { $aggregation = new StatsAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "stats", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "StatsAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ";", "$"...
Add an stats aggregate. @param $alias @param string $field @param string|null $script
[ "Add", "an", "stats", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L270-L275
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.sum
public function sum($alias, $field = null, $script = null) { $aggregation = new SumAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function sum($alias, $field = null, $script = null) { $aggregation = new SumAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "sum", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "SumAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ";", "$", ...
Add an sum aggregate. @param $alias @param string $field @param string|null $script
[ "Add", "an", "sum", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L284-L289
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.valueCount
public function valueCount($alias, $field = null, $script = null) { $aggregation = new ValueCountAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function valueCount($alias, $field = null, $script = null) { $aggregation = new ValueCountAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "valueCount", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "ValueCountAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ...
Add a value count aggregate. @param $alias @param string $field @param string|null $script
[ "Add", "a", "value", "count", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L298-L303
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.range
public function range($alias, $field, array $ranges, $keyed = false) { $aggregation = new RangeAggregation($alias, $field, $ranges, $keyed); $this->append($aggregation); }
php
public function range($alias, $field, array $ranges, $keyed = false) { $aggregation = new RangeAggregation($alias, $field, $ranges, $keyed); $this->append($aggregation); }
[ "public", "function", "range", "(", "$", "alias", ",", "$", "field", ",", "array", "$", "ranges", ",", "$", "keyed", "=", "false", ")", "{", "$", "aggregation", "=", "new", "RangeAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "ranges",...
Add a range aggregate. @param string $alias @param string $field @param array $ranges @param bool $keyed
[ "Add", "a", "range", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L313-L318
sleimanx2/plastic
src/DSL/AggregationBuilder.php
AggregationBuilder.terms
public function terms($alias, $field = null, $script = null) { $aggregation = new TermsAggregation($alias, $field, $script); $this->append($aggregation); }
php
public function terms($alias, $field = null, $script = null) { $aggregation = new TermsAggregation($alias, $field, $script); $this->append($aggregation); }
[ "public", "function", "terms", "(", "$", "alias", ",", "$", "field", "=", "null", ",", "$", "script", "=", "null", ")", "{", "$", "aggregation", "=", "new", "TermsAggregation", "(", "$", "alias", ",", "$", "field", ",", "$", "script", ")", ";", "$"...
Add a terms aggregate. @param string $alias @param string|null $field @param string|null $script
[ "Add", "a", "terms", "aggregate", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/AggregationBuilder.php#L327-L332
sleimanx2/plastic
src/Mappings/Mapper.php
Mapper.runMappingList
public function runMappingList(array $mappings, array $options = []) { // First we will just make sure that there are any migrations to run. If there // aren't, we will just make a note of it to the developer. if (count($mappings) == 0) { $this->note('<info>Nothing to map</info>'...
php
public function runMappingList(array $mappings, array $options = []) { // First we will just make sure that there are any migrations to run. If there // aren't, we will just make a note of it to the developer. if (count($mappings) == 0) { $this->note('<info>Nothing to map</info>'...
[ "public", "function", "runMappingList", "(", "array", "$", "mappings", ",", "array", "$", "options", "=", "[", "]", ")", "{", "// First we will just make sure that there are any migrations to run. If there", "// aren't, we will just make a note of it to the developer.", "if", "...
Run an array of mappings. @param array $mappings @param array $options
[ "Run", "an", "array", "of", "mappings", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mapper.php#L59-L81
sleimanx2/plastic
src/Mappings/Mapper.php
Mapper.runMap
public function runMap($file, $batch, $index = null) { $mapping = $this->resolve($file); $mapping->setIndex($index); $mapping->map(); $this->repository->log($file, $batch); $this->note('<info>Mapped:</info> '.$file); }
php
public function runMap($file, $batch, $index = null) { $mapping = $this->resolve($file); $mapping->setIndex($index); $mapping->map(); $this->repository->log($file, $batch); $this->note('<info>Mapped:</info> '.$file); }
[ "public", "function", "runMap", "(", "$", "file", ",", "$", "batch", ",", "$", "index", "=", "null", ")", "{", "$", "mapping", "=", "$", "this", "->", "resolve", "(", "$", "file", ")", ";", "$", "mapping", "->", "setIndex", "(", "$", "index", ")"...
Run the given mapping file. @param $file @param $batch @param string|null $index The index on which to run the mappings instead of the default one.
[ "Run", "the", "given", "mapping", "file", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mapper.php#L90-L101
sleimanx2/plastic
src/Mappings/Mapper.php
Mapper.getMappingFiles
public function getMappingFiles($path) { $files = $this->files->glob($path.'/*_*.php'); if ($files === false) { return []; } $files = array_map(function ($file) { return str_replace('.php', '', basename($file)); }, $files); return $files; ...
php
public function getMappingFiles($path) { $files = $this->files->glob($path.'/*_*.php'); if ($files === false) { return []; } $files = array_map(function ($file) { return str_replace('.php', '', basename($file)); }, $files); return $files; ...
[ "public", "function", "getMappingFiles", "(", "$", "path", ")", "{", "$", "files", "=", "$", "this", "->", "files", "->", "glob", "(", "$", "path", ".", "'/*_*.php'", ")", ";", "if", "(", "$", "files", "===", "false", ")", "{", "return", "[", "]", ...
Get all of the migration files in a given path. @param $path @return array
[ "Get", "all", "of", "the", "migration", "files", "in", "a", "given", "path", "." ]
train
https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mapper.php#L124-L137
johnkary/phpunit-speedtrap
src/SpeedTrapListener.php
SpeedTrapListener.getSlowThreshold
protected function getSlowThreshold(TestCase $test): int { $ann = $test->getAnnotations(); return isset($ann['method']['slowThreshold'][0]) ? (int) $ann['method']['slowThreshold'][0] : $this->slowThreshold; }
php
protected function getSlowThreshold(TestCase $test): int { $ann = $test->getAnnotations(); return isset($ann['method']['slowThreshold'][0]) ? (int) $ann['method']['slowThreshold'][0] : $this->slowThreshold; }
[ "protected", "function", "getSlowThreshold", "(", "TestCase", "$", "test", ")", ":", "int", "{", "$", "ann", "=", "$", "test", "->", "getAnnotations", "(", ")", ";", "return", "isset", "(", "$", "ann", "[", "'method'", "]", "[", "'slowThreshold'", "]", ...
Calculate slow test threshold for given test. A TestCase may override the suite-wide slowness threshold by using the annotation {@slowThreshold} with a threshold value in milliseconds. For example, the following test would be considered slow if its execution time meets or exceeds 5000ms (5 seconds): <code> \@slowThre...
[ "Calculate", "slow", "test", "threshold", "for", "given", "test", ".", "A", "TestCase", "may", "override", "the", "suite", "-", "wide", "slowness", "threshold", "by", "using", "the", "annotation", "{", "@slowThreshold", "}", "with", "a", "threshold", "value", ...
train
https://github.com/johnkary/phpunit-speedtrap/blob/dae486f5bc009ae9000057f4d702e1e5add32263/src/SpeedTrapListener.php#L223-L228
symfony/webpack-encore-bundle
src/CacheWarmer/EntrypointCacheWarmer.php
EntrypointCacheWarmer.doWarmUp
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter) { foreach ($this->cacheKeys as $cacheKey => $path) { // If the file does not exist then just skip past this entry point. if (!file_exists($path)) { continue; } $entryPointLooku...
php
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter) { foreach ($this->cacheKeys as $cacheKey => $path) { // If the file does not exist then just skip past this entry point. if (!file_exists($path)) { continue; } $entryPointLooku...
[ "protected", "function", "doWarmUp", "(", "$", "cacheDir", ",", "ArrayAdapter", "$", "arrayAdapter", ")", "{", "foreach", "(", "$", "this", "->", "cacheKeys", "as", "$", "cacheKey", "=>", "$", "path", ")", "{", "// If the file does not exist then just skip past th...
{@inheritdoc}
[ "{" ]
train
https://github.com/symfony/webpack-encore-bundle/blob/2384cfde92226f2447eb422570c322afe2ae15ea/src/CacheWarmer/EntrypointCacheWarmer.php#L31-L49
usmanhalalit/pixie
src/Pixie/ConnectionAdapters/Mysql.php
Mysql.doConnect
protected function doConnect($config) { $connectionString = "mysql:dbname={$config['database']}"; if (isset($config['host'])) { $connectionString .= ";host={$config['host']}"; } if (isset($config['port'])) { $connectionString .= ";port={$conf...
php
protected function doConnect($config) { $connectionString = "mysql:dbname={$config['database']}"; if (isset($config['host'])) { $connectionString .= ";host={$config['host']}"; } if (isset($config['port'])) { $connectionString .= ";port={$conf...
[ "protected", "function", "doConnect", "(", "$", "config", ")", "{", "$", "connectionString", "=", "\"mysql:dbname={$config['database']}\"", ";", "if", "(", "isset", "(", "$", "config", "[", "'host'", "]", ")", ")", "{", "$", "connectionString", ".=", "\";host=...
@param $config @return mixed
[ "@param", "$config" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/ConnectionAdapters/Mysql.php#L10-L36
usmanhalalit/pixie
src/Pixie/Connection.php
Connection.createAlias
public function createAlias($alias) { class_alias('Pixie\\AliasFacade', $alias); $builder = $this->container->build('\\Pixie\\QueryBuilder\\QueryBuilderHandler', array($this)); AliasFacade::setQueryBuilderInstance($builder); }
php
public function createAlias($alias) { class_alias('Pixie\\AliasFacade', $alias); $builder = $this->container->build('\\Pixie\\QueryBuilder\\QueryBuilderHandler', array($this)); AliasFacade::setQueryBuilderInstance($builder); }
[ "public", "function", "createAlias", "(", "$", "alias", ")", "{", "class_alias", "(", "'Pixie\\\\AliasFacade'", ",", "$", "alias", ")", ";", "$", "builder", "=", "$", "this", "->", "container", "->", "build", "(", "'\\\\Pixie\\\\QueryBuilder\\\\QueryBuilderHandler...
Create an easily accessible query builder alias @param $alias
[ "Create", "an", "easily", "accessible", "query", "builder", "alias" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/Connection.php#L66-L71
usmanhalalit/pixie
src/Pixie/Connection.php
Connection.connect
protected function connect() { // Build a database connection if we don't have one connected $adapter = '\\Pixie\\ConnectionAdapters\\' . ucfirst(strtolower($this->adapter)); $adapterInstance = $this->container->build($adapter, array($this->container)); $pdo = $adapterInstance->co...
php
protected function connect() { // Build a database connection if we don't have one connected $adapter = '\\Pixie\\ConnectionAdapters\\' . ucfirst(strtolower($this->adapter)); $adapterInstance = $this->container->build($adapter, array($this->container)); $pdo = $adapterInstance->co...
[ "protected", "function", "connect", "(", ")", "{", "// Build a database connection if we don't have one connected", "$", "adapter", "=", "'\\\\Pixie\\\\ConnectionAdapters\\\\'", ".", "ucfirst", "(", "strtolower", "(", "$", "this", "->", "adapter", ")", ")", ";", "$", ...
Create the connection adapter
[ "Create", "the", "connection", "adapter" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/Connection.php#L85-L100
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.query
public function query($sql, $bindings = array()) { list($this->pdoStatement) = $this->statement($sql, $bindings); return $this; }
php
public function query($sql, $bindings = array()) { list($this->pdoStatement) = $this->statement($sql, $bindings); return $this; }
[ "public", "function", "query", "(", "$", "sql", ",", "$", "bindings", "=", "array", "(", ")", ")", "{", "list", "(", "$", "this", "->", "pdoStatement", ")", "=", "$", "this", "->", "statement", "(", "$", "sql", ",", "$", "bindings", ")", ";", "re...
@param $sql @param array $bindings @return $this
[ "@param", "$sql", "@param", "array", "$bindings" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L131-L136
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.statement
public function statement($sql, $bindings = array()) { $start = microtime(true); $pdoStatement = $this->pdo->prepare($sql); foreach ($bindings as $key => $value) { $pdoStatement->bindValue( is_int($key) ? $key + 1 : $key, $value, is...
php
public function statement($sql, $bindings = array()) { $start = microtime(true); $pdoStatement = $this->pdo->prepare($sql); foreach ($bindings as $key => $value) { $pdoStatement->bindValue( is_int($key) ? $key + 1 : $key, $value, is...
[ "public", "function", "statement", "(", "$", "sql", ",", "$", "bindings", "=", "array", "(", ")", ")", "{", "$", "start", "=", "microtime", "(", "true", ")", ";", "$", "pdoStatement", "=", "$", "this", "->", "pdo", "->", "prepare", "(", "$", "sql",...
@param $sql @param array $bindings @return array PDOStatement and execution time as float
[ "@param", "$sql", "@param", "array", "$bindings" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L144-L157
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.get
public function get() { $eventResult = $this->fireEvents('before-select'); if (!is_null($eventResult)) { return $eventResult; }; $executionTime = 0; if (is_null($this->pdoStatement)) { $queryObject = $this->getQuery('select'); list($this->...
php
public function get() { $eventResult = $this->fireEvents('before-select'); if (!is_null($eventResult)) { return $eventResult; }; $executionTime = 0; if (is_null($this->pdoStatement)) { $queryObject = $this->getQuery('select'); list($this->...
[ "public", "function", "get", "(", ")", "{", "$", "eventResult", "=", "$", "this", "->", "fireEvents", "(", "'before-select'", ")", ";", "if", "(", "!", "is_null", "(", "$", "eventResult", ")", ")", "{", "return", "$", "eventResult", ";", "}", ";", "$...
Get all rows @return \stdClass|array @throws Exception
[ "Get", "all", "rows" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L165-L187
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.first
public function first() { $this->limit(1); $result = $this->get(); return empty($result) ? null : $result[0]; }
php
public function first() { $this->limit(1); $result = $this->get(); return empty($result) ? null : $result[0]; }
[ "public", "function", "first", "(", ")", "{", "$", "this", "->", "limit", "(", "1", ")", ";", "$", "result", "=", "$", "this", "->", "get", "(", ")", ";", "return", "empty", "(", "$", "result", ")", "?", "null", ":", "$", "result", "[", "0", ...
Get first row @return \stdClass|null
[ "Get", "first", "row" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L194-L199
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.count
public function count() { // Get the current statements $originalStatements = $this->statements; unset($this->statements['orderBys']); unset($this->statements['limit']); unset($this->statements['offset']); $count = $this->aggregate('count'); $this->statement...
php
public function count() { // Get the current statements $originalStatements = $this->statements; unset($this->statements['orderBys']); unset($this->statements['limit']); unset($this->statements['offset']); $count = $this->aggregate('count'); $this->statement...
[ "public", "function", "count", "(", ")", "{", "// Get the current statements", "$", "originalStatements", "=", "$", "this", "->", "statements", ";", "unset", "(", "$", "this", "->", "statements", "[", "'orderBys'", "]", ")", ";", "unset", "(", "$", "this", ...
Get count of rows @return int
[ "Get", "count", "of", "rows" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L230-L243
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.aggregate
protected function aggregate($type) { // Get the current selects $mainSelects = isset($this->statements['selects']) ? $this->statements['selects'] : null; // Replace select with a scalar value like `count` $this->statements['selects'] = array($this->raw($type . '(*) as field')); ...
php
protected function aggregate($type) { // Get the current selects $mainSelects = isset($this->statements['selects']) ? $this->statements['selects'] : null; // Replace select with a scalar value like `count` $this->statements['selects'] = array($this->raw($type . '(*) as field')); ...
[ "protected", "function", "aggregate", "(", "$", "type", ")", "{", "// Get the current selects", "$", "mainSelects", "=", "isset", "(", "$", "this", "->", "statements", "[", "'selects'", "]", ")", "?", "$", "this", "->", "statements", "[", "'selects'", "]", ...
@param $type @return int
[ "@param", "$type" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L250-L272
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.getQuery
public function getQuery($type = 'select', $dataToBePassed = array()) { $allowedTypes = array('select', 'insert', 'insertignore', 'replace', 'delete', 'update', 'criteriaonly'); if (!in_array(strtolower($type), $allowedTypes)) { throw new Exception($type . ' is not a known type.', 2); ...
php
public function getQuery($type = 'select', $dataToBePassed = array()) { $allowedTypes = array('select', 'insert', 'insertignore', 'replace', 'delete', 'update', 'criteriaonly'); if (!in_array(strtolower($type), $allowedTypes)) { throw new Exception($type . ' is not a known type.', 2); ...
[ "public", "function", "getQuery", "(", "$", "type", "=", "'select'", ",", "$", "dataToBePassed", "=", "array", "(", ")", ")", "{", "$", "allowedTypes", "=", "array", "(", "'select'", ",", "'insert'", ",", "'insertignore'", ",", "'replace'", ",", "'delete'"...
@param string $type @param array $dataToBePassed @return mixed @throws Exception
[ "@param", "string", "$type", "@param", "array", "$dataToBePassed" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L281-L294
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.subQuery
public function subQuery(QueryBuilderHandler $queryBuilder, $alias = null) { $sql = '(' . $queryBuilder->getQuery()->getRawSql() . ')'; if ($alias) { $sql = $sql . ' as ' . $alias; } return $queryBuilder->raw($sql); }
php
public function subQuery(QueryBuilderHandler $queryBuilder, $alias = null) { $sql = '(' . $queryBuilder->getQuery()->getRawSql() . ')'; if ($alias) { $sql = $sql . ' as ' . $alias; } return $queryBuilder->raw($sql); }
[ "public", "function", "subQuery", "(", "QueryBuilderHandler", "$", "queryBuilder", ",", "$", "alias", "=", "null", ")", "{", "$", "sql", "=", "'('", ".", "$", "queryBuilder", "->", "getQuery", "(", ")", "->", "getRawSql", "(", ")", ".", "')'", ";", "if...
@param QueryBuilderHandler $queryBuilder @param null $alias @return Raw
[ "@param", "QueryBuilderHandler", "$queryBuilder", "@param", "null", "$alias" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L302-L310
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.doInsert
private function doInsert($data, $type) { $eventResult = $this->fireEvents('before-insert'); if (!is_null($eventResult)) { return $eventResult; } // If first value is not an array // Its not a batch insert if (!is_array(current($data))) { $que...
php
private function doInsert($data, $type) { $eventResult = $this->fireEvents('before-insert'); if (!is_null($eventResult)) { return $eventResult; } // If first value is not an array // Its not a batch insert if (!is_array(current($data))) { $que...
[ "private", "function", "doInsert", "(", "$", "data", ",", "$", "type", ")", "{", "$", "eventResult", "=", "$", "this", "->", "fireEvents", "(", "'before-insert'", ")", ";", "if", "(", "!", "is_null", "(", "$", "eventResult", ")", ")", "{", "return", ...
@param $data @return array|string
[ "@param", "$data" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L317-L351
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.updateOrInsert
public function updateOrInsert($data) { if ($this->first()) { return $this->update($data); } else { return $this->insert($data); } }
php
public function updateOrInsert($data) { if ($this->first()) { return $this->update($data); } else { return $this->insert($data); } }
[ "public", "function", "updateOrInsert", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "first", "(", ")", ")", "{", "return", "$", "this", "->", "update", "(", "$", "data", ")", ";", "}", "else", "{", "return", "$", "this", "->", "inse...
@param $data @return array|string
[ "@param", "$data" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L408-L415
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.table
public function table($tables) { if (!is_array($tables)) { // because a single table is converted to an array anyways, // this makes sense. $tables = func_get_args(); } $instance = new static($this->connection, $this->getFetchMode()); $tables = $t...
php
public function table($tables) { if (!is_array($tables)) { // because a single table is converted to an array anyways, // this makes sense. $tables = func_get_args(); } $instance = new static($this->connection, $this->getFetchMode()); $tables = $t...
[ "public", "function", "table", "(", "$", "tables", ")", "{", "if", "(", "!", "is_array", "(", "$", "tables", ")", ")", "{", "// because a single table is converted to an array anyways,", "// this makes sense.", "$", "tables", "=", "func_get_args", "(", ")", ";", ...
@param string|array $tables Single table or array of tables @return QueryBuilderHandler @throws Exception
[ "@param", "string|array", "$tables", "Single", "table", "or", "array", "of", "tables" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L452-L464
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.from
public function from($tables) { if (!is_array($tables)) { $tables = func_get_args(); } $tables = $this->addTablePrefix($tables, false); $this->addStatement('tables', $tables); return $this; }
php
public function from($tables) { if (!is_array($tables)) { $tables = func_get_args(); } $tables = $this->addTablePrefix($tables, false); $this->addStatement('tables', $tables); return $this; }
[ "public", "function", "from", "(", "$", "tables", ")", "{", "if", "(", "!", "is_array", "(", "$", "tables", ")", ")", "{", "$", "tables", "=", "func_get_args", "(", ")", ";", "}", "$", "tables", "=", "$", "this", "->", "addTablePrefix", "(", "$", ...
@param $tables @return $this
[ "@param", "$tables" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L471-L480
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.select
public function select($fields) { if (!is_array($fields)) { $fields = func_get_args(); } $fields = $this->addTablePrefix($fields); $this->addStatement('selects', $fields); return $this; }
php
public function select($fields) { if (!is_array($fields)) { $fields = func_get_args(); } $fields = $this->addTablePrefix($fields); $this->addStatement('selects', $fields); return $this; }
[ "public", "function", "select", "(", "$", "fields", ")", "{", "if", "(", "!", "is_array", "(", "$", "fields", ")", ")", "{", "$", "fields", "=", "func_get_args", "(", ")", ";", "}", "$", "fields", "=", "$", "this", "->", "addTablePrefix", "(", "$",...
@param $fields @return $this
[ "@param", "$fields" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L487-L496
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.groupBy
public function groupBy($field) { $field = $this->addTablePrefix($field); $this->addStatement('groupBys', $field); return $this; }
php
public function groupBy($field) { $field = $this->addTablePrefix($field); $this->addStatement('groupBys', $field); return $this; }
[ "public", "function", "groupBy", "(", "$", "field", ")", "{", "$", "field", "=", "$", "this", "->", "addTablePrefix", "(", "$", "field", ")", ";", "$", "this", "->", "addStatement", "(", "'groupBys'", ",", "$", "field", ")", ";", "return", "$", "this...
@param $field @return $this
[ "@param", "$field" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L515-L520
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.orderBy
public function orderBy($fields, $defaultDirection = 'ASC') { if (!is_array($fields)) { $fields = array($fields); } foreach ($fields as $key => $value) { $field = $key; $type = $value; if (is_int($key)) { $field = $value; ...
php
public function orderBy($fields, $defaultDirection = 'ASC') { if (!is_array($fields)) { $fields = array($fields); } foreach ($fields as $key => $value) { $field = $key; $type = $value; if (is_int($key)) { $field = $value; ...
[ "public", "function", "orderBy", "(", "$", "fields", ",", "$", "defaultDirection", "=", "'ASC'", ")", "{", "if", "(", "!", "is_array", "(", "$", "fields", ")", ")", "{", "$", "fields", "=", "array", "(", "$", "fields", ")", ";", "}", "foreach", "("...
@param $fields @param string $defaultDirection @return $this
[ "@param", "$fields", "@param", "string", "$defaultDirection" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L528-L548
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.having
public function having($key, $operator, $value, $joiner = 'AND') { $key = $this->addTablePrefix($key); $this->statements['havings'][] = compact('key', 'operator', 'value', 'joiner'); return $this; }
php
public function having($key, $operator, $value, $joiner = 'AND') { $key = $this->addTablePrefix($key); $this->statements['havings'][] = compact('key', 'operator', 'value', 'joiner'); return $this; }
[ "public", "function", "having", "(", "$", "key", ",", "$", "operator", ",", "$", "value", ",", "$", "joiner", "=", "'AND'", ")", "{", "$", "key", "=", "$", "this", "->", "addTablePrefix", "(", "$", "key", ")", ";", "$", "this", "->", "statements", ...
@param $key @param $operator @param $value @param string $joiner @return $this
[ "@param", "$key", "@param", "$operator", "@param", "$value", "@param", "string", "$joiner" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L580-L585
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.where
public function where($key, $operator = null, $value = null) { // If two params are given then assume operator is = if (func_num_args() == 2) { $value = $operator; $operator = '='; } return $this->whereHandler($key, $operator, $value); }
php
public function where($key, $operator = null, $value = null) { // If two params are given then assume operator is = if (func_num_args() == 2) { $value = $operator; $operator = '='; } return $this->whereHandler($key, $operator, $value); }
[ "public", "function", "where", "(", "$", "key", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "// If two params are given then assume operator is =", "if", "(", "func_num_args", "(", ")", "==", "2", ")", "{", "$", "value", "=...
@param $key @param $operator @param $value @return $this
[ "@param", "$key", "@param", "$operator", "@param", "$value" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L606-L614
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.join
public function join($table, $key, $operator = null, $value = null, $type = 'inner') { if (!$key instanceof \Closure) { $key = function ($joinBuilder) use ($key, $operator, $value) { $joinBuilder->on($key, $operator, $value); }; } // Build a new JoinB...
php
public function join($table, $key, $operator = null, $value = null, $type = 'inner') { if (!$key instanceof \Closure) { $key = function ($joinBuilder) use ($key, $operator, $value) { $joinBuilder->on($key, $operator, $value); }; } // Build a new JoinB...
[ "public", "function", "join", "(", "$", "table", ",", "$", "key", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ",", "$", "type", "=", "'inner'", ")", "{", "if", "(", "!", "$", "key", "instanceof", "\\", "Closure", ")", "{", ...
@param $table @param $key @param $operator @param $value @param string $type @return $this
[ "@param", "$table", "@param", "$key", "@param", "$operator", "@param", "$value", "@param", "string", "$type" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L787-L806
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.transaction
public function transaction(\Closure $callback) { try { // Begin the PDO transaction $this->pdo->beginTransaction(); // Get the Transaction class $transaction = $this->container->build('\\Pixie\\QueryBuilder\\Transaction', array($this->connection)); ...
php
public function transaction(\Closure $callback) { try { // Begin the PDO transaction $this->pdo->beginTransaction(); // Get the Transaction class $transaction = $this->container->build('\\Pixie\\QueryBuilder\\Transaction', array($this->connection)); ...
[ "public", "function", "transaction", "(", "\\", "Closure", "$", "callback", ")", "{", "try", "{", "// Begin the PDO transaction", "$", "this", "->", "pdo", "->", "beginTransaction", "(", ")", ";", "// Get the Transaction class", "$", "transaction", "=", "$", "th...
Runs a transaction @param $callback @return $this
[ "Runs", "a", "transaction" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L815-L840
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.innerJoin
public function innerJoin($table, $key, $operator = null, $value = null) { return $this->join($table, $key, $operator, $value, 'inner'); }
php
public function innerJoin($table, $key, $operator = null, $value = null) { return $this->join($table, $key, $operator, $value, 'inner'); }
[ "public", "function", "innerJoin", "(", "$", "table", ",", "$", "key", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "join", "(", "$", "table", ",", "$", "key", ",", "$", "operator", ","...
@param $table @param $key @param null $operator @param null $value @return $this
[ "@param", "$table", "@param", "$key", "@param", "null", "$operator", "@param", "null", "$value" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L876-L879
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.whereHandler
protected function whereHandler($key, $operator = null, $value = null, $joiner = 'AND') { $key = $this->addTablePrefix($key); $this->statements['wheres'][] = compact('key', 'operator', 'value', 'joiner'); return $this; }
php
protected function whereHandler($key, $operator = null, $value = null, $joiner = 'AND') { $key = $this->addTablePrefix($key); $this->statements['wheres'][] = compact('key', 'operator', 'value', 'joiner'); return $this; }
[ "protected", "function", "whereHandler", "(", "$", "key", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ",", "$", "joiner", "=", "'AND'", ")", "{", "$", "key", "=", "$", "this", "->", "addTablePrefix", "(", "$", "key", ")", ";"...
@param $key @param $operator @param $value @param string $joiner @return $this
[ "@param", "$key", "@param", "$operator", "@param", "$value", "@param", "string", "$joiner" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L931-L936
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.addTablePrefix
public function addTablePrefix($values, $tableFieldMix = true) { if (is_null($this->tablePrefix)) { return $values; } // $value will be an array and we will add prefix to all table names // If supplied value is not an array then make it one $single = false; ...
php
public function addTablePrefix($values, $tableFieldMix = true) { if (is_null($this->tablePrefix)) { return $values; } // $value will be an array and we will add prefix to all table names // If supplied value is not an array then make it one $single = false; ...
[ "public", "function", "addTablePrefix", "(", "$", "values", ",", "$", "tableFieldMix", "=", "true", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "tablePrefix", ")", ")", "{", "return", "$", "values", ";", "}", "// $value will be an array and we wi...
Add table prefix (if given) on given string. @param $values @param bool $tableFieldMix If we have mixes of field and table names with a "." @return array|mixed
[ "Add", "table", "prefix", "(", "if", "given", ")", "on", "given", "string", "." ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L946-L987
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.registerEvent
public function registerEvent($event, $table, \Closure $action) { $table = $table ?: ':any'; if ($table != ':any') { $table = $this->addTablePrefix($table, false); } return $this->connection->getEventHandler()->registerEvent($event, $table, $action); }
php
public function registerEvent($event, $table, \Closure $action) { $table = $table ?: ':any'; if ($table != ':any') { $table = $this->addTablePrefix($table, false); } return $this->connection->getEventHandler()->registerEvent($event, $table, $action); }
[ "public", "function", "registerEvent", "(", "$", "event", ",", "$", "table", ",", "\\", "Closure", "$", "action", ")", "{", "$", "table", "=", "$", "table", "?", ":", "':any'", ";", "if", "(", "$", "table", "!=", "':any'", ")", "{", "$", "table", ...
@param $event @param string $table @param callable $action @return void
[ "@param", "$event", "@param", "string", "$table", "@param", "callable", "$action" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L1024-L1033
usmanhalalit/pixie
src/Pixie/QueryBuilder/QueryBuilderHandler.php
QueryBuilderHandler.removeEvent
public function removeEvent($event, $table = ':any') { if ($table != ':any') { $table = $this->addTablePrefix($table, false); } return $this->connection->getEventHandler()->removeEvent($event, $table); }
php
public function removeEvent($event, $table = ':any') { if ($table != ':any') { $table = $this->addTablePrefix($table, false); } return $this->connection->getEventHandler()->removeEvent($event, $table); }
[ "public", "function", "removeEvent", "(", "$", "event", ",", "$", "table", "=", "':any'", ")", "{", "if", "(", "$", "table", "!=", "':any'", ")", "{", "$", "table", "=", "$", "this", "->", "addTablePrefix", "(", "$", "table", ",", "false", ")", ";"...
@param $event @param string $table @return void
[ "@param", "$event", "@param", "string", "$table" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/QueryBuilderHandler.php#L1041-L1048
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.select
public function select($statements) { if (!array_key_exists('tables', $statements)) { throw new Exception('No table specified.', 3); } elseif (!array_key_exists('selects', $statements)) { $statements['selects'][] = '*'; } // From $tables = $this->arra...
php
public function select($statements) { if (!array_key_exists('tables', $statements)) { throw new Exception('No table specified.', 3); } elseif (!array_key_exists('selects', $statements)) { $statements['selects'][] = '*'; } // From $tables = $this->arra...
[ "public", "function", "select", "(", "$", "statements", ")", "{", "if", "(", "!", "array_key_exists", "(", "'tables'", ",", "$", "statements", ")", ")", "{", "throw", "new", "Exception", "(", "'No table specified.'", ",", "3", ")", ";", "}", "elseif", "(...
Build select query string and bindings @param $statements @throws Exception @return array
[ "Build", "select", "query", "string", "and", "bindings" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L33-L99
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.getUpdateStatement
private function getUpdateStatement($data) { $bindings = array(); $statement = ''; foreach ($data as $key => $value) { if ($value instanceof Raw) { $statement .= $this->wrapSanitizer($key) . '=' . $value . ','; } else { $statement .= $...
php
private function getUpdateStatement($data) { $bindings = array(); $statement = ''; foreach ($data as $key => $value) { if ($value instanceof Raw) { $statement .= $this->wrapSanitizer($key) . '=' . $value . ','; } else { $statement .= $...
[ "private", "function", "getUpdateStatement", "(", "$", "data", ")", "{", "$", "bindings", "=", "array", "(", ")", ";", "$", "statement", "=", "''", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", ...
Build fields assignment part of SET ... or ON DUBLICATE KEY UPDATE ... statements @param array $data @return array
[ "Build", "fields", "assignment", "part", "of", "SET", "...", "or", "ON", "DUBLICATE", "KEY", "UPDATE", "...", "statements" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L221-L237
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.update
public function update($statements, array $data) { if (!isset($statements['tables'])) { throw new Exception('No table specified', 3); } elseif (count($data) < 1) { throw new Exception('No data given.', 4); } $table = end($statements['tables']); // Up...
php
public function update($statements, array $data) { if (!isset($statements['tables'])) { throw new Exception('No table specified', 3); } elseif (count($data) < 1) { throw new Exception('No data given.', 4); } $table = end($statements['tables']); // Up...
[ "public", "function", "update", "(", "$", "statements", ",", "array", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "statements", "[", "'tables'", "]", ")", ")", "{", "throw", "new", "Exception", "(", "'No table specified'", ",", "3", ")", ...
Build update query @param $statements @param array $data @return array @throws Exception
[ "Build", "update", "query" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L248-L279
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.delete
public function delete($statements) { if (!isset($statements['tables'])) { throw new Exception('No table specified', 3); } $table = end($statements['tables']); // Wheres list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', '...
php
public function delete($statements) { if (!isset($statements['tables'])) { throw new Exception('No table specified', 3); } $table = end($statements['tables']); // Wheres list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', '...
[ "public", "function", "delete", "(", "$", "statements", ")", "{", "if", "(", "!", "isset", "(", "$", "statements", "[", "'tables'", "]", ")", ")", "{", "throw", "new", "Exception", "(", "'No table specified'", ",", "3", ")", ";", "}", "$", "table", "...
Build delete query @param $statements @return array @throws Exception
[ "Build", "delete", "query" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L289-L308
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.buildCriteria
protected function buildCriteria($statements, $bindValues = true) { $criteria = ''; $bindings = array(); foreach ($statements as $statement) { $key = $this->wrapSanitizer($statement['key']); $value = $statement['value']; if (is_null($value) && $key instan...
php
protected function buildCriteria($statements, $bindValues = true) { $criteria = ''; $bindings = array(); foreach ($statements as $statement) { $key = $this->wrapSanitizer($statement['key']); $value = $statement['value']; if (is_null($value) && $key instan...
[ "protected", "function", "buildCriteria", "(", "$", "statements", ",", "$", "bindValues", "=", "true", ")", "{", "$", "criteria", "=", "''", ";", "$", "bindings", "=", "array", "(", ")", ";", "foreach", "(", "$", "statements", "as", "$", "statement", "...
Build generic criteria string and bindings from statements, like "a = b and c = ?" @param $statements @param bool $bindValues @return array
[ "Build", "generic", "criteria", "string", "and", "bindings", "from", "statements", "like", "a", "=", "b", "and", "c", "=", "?" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L362-L438
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.buildCriteriaWithType
protected function buildCriteriaWithType($statements, $key, $type, $bindValues = true) { $criteria = ''; $bindings = array(); if (isset($statements[$key])) { // Get the generic/adapter agnostic criteria string from parent list($criteria, $bindings) = $this->buildCrit...
php
protected function buildCriteriaWithType($statements, $key, $type, $bindValues = true) { $criteria = ''; $bindings = array(); if (isset($statements[$key])) { // Get the generic/adapter agnostic criteria string from parent list($criteria, $bindings) = $this->buildCrit...
[ "protected", "function", "buildCriteriaWithType", "(", "$", "statements", ",", "$", "key", ",", "$", "type", ",", "$", "bindValues", "=", "true", ")", "{", "$", "criteria", "=", "''", ";", "$", "bindings", "=", "array", "(", ")", ";", "if", "(", "iss...
Build criteria string and binding with various types added, like WHERE and Having @param $statements @param $key @param $type @param bool $bindValues @return array
[ "Build", "criteria", "string", "and", "binding", "with", "various", "types", "added", "like", "WHERE", "and", "Having" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L479-L494
usmanhalalit/pixie
src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
BaseAdapter.buildJoin
protected function buildJoin($statements) { $sql = ''; if (!array_key_exists('joins', $statements) || !is_array($statements['joins'])) { return $sql; } foreach ($statements['joins'] as $joinArr) { if (is_array($joinArr['table'])) { $mainTable...
php
protected function buildJoin($statements) { $sql = ''; if (!array_key_exists('joins', $statements) || !is_array($statements['joins'])) { return $sql; } foreach ($statements['joins'] as $joinArr) { if (is_array($joinArr['table'])) { $mainTable...
[ "protected", "function", "buildJoin", "(", "$", "statements", ")", "{", "$", "sql", "=", "''", ";", "if", "(", "!", "array_key_exists", "(", "'joins'", ",", "$", "statements", ")", "||", "!", "is_array", "(", "$", "statements", "[", "'joins'", "]", ")"...
Build join string @param $statements @return array
[ "Build", "join", "string" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/QueryBuilder/Adapters/BaseAdapter.php#L503-L536
usmanhalalit/pixie
src/Pixie/EventHandler.php
EventHandler.getEvent
public function getEvent($event, $table = ':any') { if ($table instanceof Raw) { return null; } return isset($this->events[$table][$event]) ? $this->events[$table][$event] : null; }
php
public function getEvent($event, $table = ':any') { if ($table instanceof Raw) { return null; } return isset($this->events[$table][$event]) ? $this->events[$table][$event] : null; }
[ "public", "function", "getEvent", "(", "$", "event", ",", "$", "table", "=", "':any'", ")", "{", "if", "(", "$", "table", "instanceof", "Raw", ")", "{", "return", "null", ";", "}", "return", "isset", "(", "$", "this", "->", "events", "[", "$", "tab...
@param $event @param $table @return callable|null
[ "@param", "$event", "@param", "$table" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/EventHandler.php#L32-L38
usmanhalalit/pixie
src/Pixie/EventHandler.php
EventHandler.registerEvent
public function registerEvent($event, $table, \Closure $action) { $table = $table ?: ':any'; $this->events[$table][$event] = $action; }
php
public function registerEvent($event, $table, \Closure $action) { $table = $table ?: ':any'; $this->events[$table][$event] = $action; }
[ "public", "function", "registerEvent", "(", "$", "event", ",", "$", "table", ",", "\\", "Closure", "$", "action", ")", "{", "$", "table", "=", "$", "table", "?", ":", "':any'", ";", "$", "this", "->", "events", "[", "$", "table", "]", "[", "$", "...
@param $event @param string $table @param callable $action @return void
[ "@param", "$event", "@param", "string", "$table", "@param", "callable", "$action" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/EventHandler.php#L47-L52
usmanhalalit/pixie
src/Pixie/ConnectionAdapters/Sqlite.php
Sqlite.doConnect
public function doConnect($config) { $connectionString = 'sqlite:' . $config['database']; return $this->container->build( '\PDO', array($connectionString, null, null, $config['options']) ); }
php
public function doConnect($config) { $connectionString = 'sqlite:' . $config['database']; return $this->container->build( '\PDO', array($connectionString, null, null, $config['options']) ); }
[ "public", "function", "doConnect", "(", "$", "config", ")", "{", "$", "connectionString", "=", "'sqlite:'", ".", "$", "config", "[", "'database'", "]", ";", "return", "$", "this", "->", "container", "->", "build", "(", "'\\PDO'", ",", "array", "(", "$", ...
@param $config @return mixed
[ "@param", "$config" ]
train
https://github.com/usmanhalalit/pixie/blob/d35ae8f49ab1c28326e2c5c675545f1b95b1727d/src/Pixie/ConnectionAdapters/Sqlite.php#L10-L17
Bacon/BaconQrCode
src/Renderer/Image/TransformationMatrix.php
TransformationMatrix.apply
public function apply(float $x, float $y) : array { return [ $x * $this->values[0] + $y * $this->values[2] + $this->values[4], $x * $this->values[2] + $x * $this->values[3] + $this->values[5], ]; }
php
public function apply(float $x, float $y) : array { return [ $x * $this->values[0] + $y * $this->values[2] + $this->values[4], $x * $this->values[2] + $x * $this->values[3] + $this->values[5], ]; }
[ "public", "function", "apply", "(", "float", "$", "x", ",", "float", "$", "y", ")", ":", "array", "{", "return", "[", "$", "x", "*", "$", "this", "->", "values", "[", "0", "]", "+", "$", "y", "*", "$", "this", "->", "values", "[", "2", "]", ...
Applies this matrix onto a point and returns the resulting viewport point. @return float[]
[ "Applies", "this", "matrix", "onto", "a", "point", "and", "returns", "the", "resulting", "viewport", "point", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Renderer/Image/TransformationMatrix.php#L60-L66
Bacon/BaconQrCode
src/Encoder/MaskUtil.php
MaskUtil.applyMaskPenaltyRule1
public static function applyMaskPenaltyRule1(ByteMatrix $matrix) : int { return ( self::applyMaskPenaltyRule1Internal($matrix, true) + self::applyMaskPenaltyRule1Internal($matrix, false) ); }
php
public static function applyMaskPenaltyRule1(ByteMatrix $matrix) : int { return ( self::applyMaskPenaltyRule1Internal($matrix, true) + self::applyMaskPenaltyRule1Internal($matrix, false) ); }
[ "public", "static", "function", "applyMaskPenaltyRule1", "(", "ByteMatrix", "$", "matrix", ")", ":", "int", "{", "return", "(", "self", "::", "applyMaskPenaltyRule1Internal", "(", "$", "matrix", ",", "true", ")", "+", "self", "::", "applyMaskPenaltyRule1Internal",...
Applies mask penalty rule 1 and returns the penalty. Finds repetitive cells with the same color and gives penalty to them. Example: 00000 or 11111.
[ "Applies", "mask", "penalty", "rule", "1", "and", "returns", "the", "penalty", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Encoder/MaskUtil.php#L33-L39
Bacon/BaconQrCode
src/Encoder/MaskUtil.php
MaskUtil.applyMaskPenaltyRule2
public static function applyMaskPenaltyRule2(ByteMatrix $matrix) : int { $penalty = 0; $array = $matrix->getArray(); $width = $matrix->getWidth(); $height = $matrix->getHeight(); for ($y = 0; $y < $height - 1; ++$y) { for ($x = 0; $x < $width - 1; ++$x) { ...
php
public static function applyMaskPenaltyRule2(ByteMatrix $matrix) : int { $penalty = 0; $array = $matrix->getArray(); $width = $matrix->getWidth(); $height = $matrix->getHeight(); for ($y = 0; $y < $height - 1; ++$y) { for ($x = 0; $x < $width - 1; ++$x) { ...
[ "public", "static", "function", "applyMaskPenaltyRule2", "(", "ByteMatrix", "$", "matrix", ")", ":", "int", "{", "$", "penalty", "=", "0", ";", "$", "array", "=", "$", "matrix", "->", "getArray", "(", ")", ";", "$", "width", "=", "$", "matrix", "->", ...
Applies mask penalty rule 2 and returns the penalty. Finds 2x2 blocks with the same color and gives penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
[ "Applies", "mask", "penalty", "rule", "2", "and", "returns", "the", "penalty", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Encoder/MaskUtil.php#L49-L70
Bacon/BaconQrCode
src/Encoder/MaskUtil.php
MaskUtil.applyMaskPenaltyRule3
public static function applyMaskPenaltyRule3(ByteMatrix $matrix) : int { $penalty = 0; $array = $matrix->getArray(); $width = $matrix->getWidth(); $height = $matrix->getHeight(); for ($y = 0; $y < $height; ++$y) { for ($x = 0; $x < $width; ++$x) { ...
php
public static function applyMaskPenaltyRule3(ByteMatrix $matrix) : int { $penalty = 0; $array = $matrix->getArray(); $width = $matrix->getWidth(); $height = $matrix->getHeight(); for ($y = 0; $y < $height; ++$y) { for ($x = 0; $x < $width; ++$x) { ...
[ "public", "static", "function", "applyMaskPenaltyRule3", "(", "ByteMatrix", "$", "matrix", ")", ":", "int", "{", "$", "penalty", "=", "0", ";", "$", "array", "=", "$", "matrix", "->", "getArray", "(", ")", ";", "$", "width", "=", "$", "matrix", "->", ...
Applies mask penalty rule 3 and returns the penalty. Finds consecutive cells of 00001011101 or 10111010000, and gives penalty to them. If we find patterns like 000010111010000, we give penalties twice (i.e. 40 * 2).
[ "Applies", "mask", "penalty", "rule", "3", "and", "returns", "the", "penalty", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Encoder/MaskUtil.php#L79-L147
Bacon/BaconQrCode
src/Encoder/MaskUtil.php
MaskUtil.applyMaskPenaltyRule4
public static function applyMaskPenaltyRule4(ByteMatrix $matrix) : int { $numDarkCells = 0; $array = $matrix->getArray(); $width = $matrix->getWidth(); $height = $matrix->getHeight(); for ($y = 0; $y < $height; ++$y) { $arrayY = $array[$y]; for ($x ...
php
public static function applyMaskPenaltyRule4(ByteMatrix $matrix) : int { $numDarkCells = 0; $array = $matrix->getArray(); $width = $matrix->getWidth(); $height = $matrix->getHeight(); for ($y = 0; $y < $height; ++$y) { $arrayY = $array[$y]; for ($x ...
[ "public", "static", "function", "applyMaskPenaltyRule4", "(", "ByteMatrix", "$", "matrix", ")", ":", "int", "{", "$", "numDarkCells", "=", "0", ";", "$", "array", "=", "$", "matrix", "->", "getArray", "(", ")", ";", "$", "width", "=", "$", "matrix", "-...
Applies mask penalty rule 4 and returns the penalty. Calculates the ratio of dark cells and gives penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
[ "Applies", "mask", "penalty", "rule", "4", "and", "returns", "the", "penalty", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Encoder/MaskUtil.php#L155-L178
Bacon/BaconQrCode
src/Encoder/MaskUtil.php
MaskUtil.getDataMaskBit
public static function getDataMaskBit(int $maskPattern, int $x, int $y) : bool { switch ($maskPattern) { case 0: $intermediate = ($y + $x) & 0x1; break; case 1: $intermediate = $y & 0x1; break; case 2: ...
php
public static function getDataMaskBit(int $maskPattern, int $x, int $y) : bool { switch ($maskPattern) { case 0: $intermediate = ($y + $x) & 0x1; break; case 1: $intermediate = $y & 0x1; break; case 2: ...
[ "public", "static", "function", "getDataMaskBit", "(", "int", "$", "maskPattern", ",", "int", "$", "x", ",", "int", "$", "y", ")", ":", "bool", "{", "switch", "(", "$", "maskPattern", ")", "{", "case", "0", ":", "$", "intermediate", "=", "(", "$", ...
Returns the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions. @throws InvalidArgumentException if an invalid mask pattern was supplied
[ "Returns", "the", "mask", "bit", "for", "getMaskPattern", "at", "x", "and", "y", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Encoder/MaskUtil.php#L187-L230
Bacon/BaconQrCode
src/Encoder/MaskUtil.php
MaskUtil.applyMaskPenaltyRule1Internal
private static function applyMaskPenaltyRule1Internal(ByteMatrix $matrix, bool $isHorizontal) : int { $penalty = 0; $iLimit = $isHorizontal ? $matrix->getHeight() : $matrix->getWidth(); $jLimit = $isHorizontal ? $matrix->getWidth() : $matrix->getHeight(); $array = $matrix->getArray()...
php
private static function applyMaskPenaltyRule1Internal(ByteMatrix $matrix, bool $isHorizontal) : int { $penalty = 0; $iLimit = $isHorizontal ? $matrix->getHeight() : $matrix->getWidth(); $jLimit = $isHorizontal ? $matrix->getWidth() : $matrix->getHeight(); $array = $matrix->getArray()...
[ "private", "static", "function", "applyMaskPenaltyRule1Internal", "(", "ByteMatrix", "$", "matrix", ",", "bool", "$", "isHorizontal", ")", ":", "int", "{", "$", "penalty", "=", "0", ";", "$", "iLimit", "=", "$", "isHorizontal", "?", "$", "matrix", "->", "g...
Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both vertical and horizontal orders respectively.
[ "Helper", "function", "for", "applyMaskPenaltyRule1", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Encoder/MaskUtil.php#L238-L270
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.ensureCapacity
public function ensureCapacity(int $size) : void { if ($size > count($this->bits) << 5) { $this->bits->setSize(($size + 31) >> 5); } }
php
public function ensureCapacity(int $size) : void { if ($size > count($this->bits) << 5) { $this->bits->setSize(($size + 31) >> 5); } }
[ "public", "function", "ensureCapacity", "(", "int", "$", "size", ")", ":", "void", "{", "if", "(", "$", "size", ">", "count", "(", "$", "this", "->", "bits", ")", "<<", "5", ")", "{", "$", "this", "->", "bits", "->", "setSize", "(", "(", "$", "...
Ensures that the array has a minimum capacity.
[ "Ensures", "that", "the", "array", "has", "a", "minimum", "capacity", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L56-L61
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.set
public function set(int $i) : void { $this->bits[$i >> 5] = $this->bits[$i >> 5] | 1 << ($i & 0x1f); }
php
public function set(int $i) : void { $this->bits[$i >> 5] = $this->bits[$i >> 5] | 1 << ($i & 0x1f); }
[ "public", "function", "set", "(", "int", "$", "i", ")", ":", "void", "{", "$", "this", "->", "bits", "[", "$", "i", ">>", "5", "]", "=", "$", "this", "->", "bits", "[", "$", "i", ">>", "5", "]", "|", "1", "<<", "(", "$", "i", "&", "0x1f",...
Sets a specific bit.
[ "Sets", "a", "specific", "bit", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L74-L77
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.getNextSet
public function getNextSet(int $from) : int { if ($from >= $this->size) { return $this->size; } $bitsOffset = $from >> 5; $currentBits = $this->bits[$bitsOffset]; $bitsLength = count($this->bits); $currentBits &= ~((1 << ($from & 0x1f)) - 1); whi...
php
public function getNextSet(int $from) : int { if ($from >= $this->size) { return $this->size; } $bitsOffset = $from >> 5; $currentBits = $this->bits[$bitsOffset]; $bitsLength = count($this->bits); $currentBits &= ~((1 << ($from & 0x1f)) - 1); whi...
[ "public", "function", "getNextSet", "(", "int", "$", "from", ")", ":", "int", "{", "if", "(", "$", "from", ">=", "$", "this", "->", "size", ")", "{", "return", "$", "this", "->", "size", ";", "}", "$", "bitsOffset", "=", "$", "from", ">>", "5", ...
Gets the next set bit position from a given position.
[ "Gets", "the", "next", "set", "bit", "position", "from", "a", "given", "position", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L90-L111
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.setBulk
public function setBulk(int $i, int $newBits) : void { $this->bits[$i >> 5] = $newBits; }
php
public function setBulk(int $i, int $newBits) : void { $this->bits[$i >> 5] = $newBits; }
[ "public", "function", "setBulk", "(", "int", "$", "i", ",", "int", "$", "newBits", ")", ":", "void", "{", "$", "this", "->", "bits", "[", "$", "i", ">>", "5", "]", "=", "$", "newBits", ";", "}" ]
Sets a bulk of bits.
[ "Sets", "a", "bulk", "of", "bits", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L142-L145
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.setRange
public function setRange(int $start, int $end) : void { if ($end < $start) { throw new InvalidArgumentException('End must be greater or equal to start'); } if ($end === $start) { return; } --$end; $firstInt = $start >> 5; $lastInt = ...
php
public function setRange(int $start, int $end) : void { if ($end < $start) { throw new InvalidArgumentException('End must be greater or equal to start'); } if ($end === $start) { return; } --$end; $firstInt = $start >> 5; $lastInt = ...
[ "public", "function", "setRange", "(", "int", "$", "start", ",", "int", "$", "end", ")", ":", "void", "{", "if", "(", "$", "end", "<", "$", "start", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'End must be greater or equal to start'", ")", ...
Sets a range of bits. @throws InvalidArgumentException if end is smaller than start
[ "Sets", "a", "range", "of", "bits", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L152-L183
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.clear
public function clear() : void { $bitsLength = count($this->bits); for ($i = 0; $i < $bitsLength; ++$i) { $this->bits[$i] = 0; } }
php
public function clear() : void { $bitsLength = count($this->bits); for ($i = 0; $i < $bitsLength; ++$i) { $this->bits[$i] = 0; } }
[ "public", "function", "clear", "(", ")", ":", "void", "{", "$", "bitsLength", "=", "count", "(", "$", "this", "->", "bits", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "bitsLength", ";", "++", "$", "i", ")", "{", "$", ...
Clears the bit array, unsetting every bit.
[ "Clears", "the", "bit", "array", "unsetting", "every", "bit", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L188-L195
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.isRange
public function isRange(int $start, int $end, bool $value) : bool { if ($end < $start) { throw new InvalidArgumentException('End must be greater or equal to start'); } if ($end === $start) { return true; } --$end; $firstInt = $start >> 5; ...
php
public function isRange(int $start, int $end, bool $value) : bool { if ($end < $start) { throw new InvalidArgumentException('End must be greater or equal to start'); } if ($end === $start) { return true; } --$end; $firstInt = $start >> 5; ...
[ "public", "function", "isRange", "(", "int", "$", "start", ",", "int", "$", "end", ",", "bool", "$", "value", ")", ":", "bool", "{", "if", "(", "$", "end", "<", "$", "start", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'End must be grea...
Checks if a range of bits is set or not set. @throws InvalidArgumentException if end is smaller than start
[ "Checks", "if", "a", "range", "of", "bits", "is", "set", "or", "not", "set", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L202-L237
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.appendBit
public function appendBit(bool $bit) : void { $this->ensureCapacity($this->size + 1); if ($bit) { $this->bits[$this->size >> 5] = $this->bits[$this->size >> 5] | (1 << ($this->size & 0x1f)); } ++$this->size; }
php
public function appendBit(bool $bit) : void { $this->ensureCapacity($this->size + 1); if ($bit) { $this->bits[$this->size >> 5] = $this->bits[$this->size >> 5] | (1 << ($this->size & 0x1f)); } ++$this->size; }
[ "public", "function", "appendBit", "(", "bool", "$", "bit", ")", ":", "void", "{", "$", "this", "->", "ensureCapacity", "(", "$", "this", "->", "size", "+", "1", ")", ";", "if", "(", "$", "bit", ")", "{", "$", "this", "->", "bits", "[", "$", "t...
Appends a bit to the array.
[ "Appends", "a", "bit", "to", "the", "array", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L242-L251
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.appendBits
public function appendBits(int $value, int $numBits) : void { if ($numBits < 0 || $numBits > 32) { throw new InvalidArgumentException('Num bits must be between 0 and 32'); } $this->ensureCapacity($this->size + $numBits); for ($numBitsLeft = $numBits; $numBitsLeft > 0; $...
php
public function appendBits(int $value, int $numBits) : void { if ($numBits < 0 || $numBits > 32) { throw new InvalidArgumentException('Num bits must be between 0 and 32'); } $this->ensureCapacity($this->size + $numBits); for ($numBitsLeft = $numBits; $numBitsLeft > 0; $...
[ "public", "function", "appendBits", "(", "int", "$", "value", ",", "int", "$", "numBits", ")", ":", "void", "{", "if", "(", "$", "numBits", "<", "0", "||", "$", "numBits", ">", "32", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Num bits...
Appends a number of bits (up to 32) to the array. @throws InvalidArgumentException if num bits is not between 0 and 32
[ "Appends", "a", "number", "of", "bits", "(", "up", "to", "32", ")", "to", "the", "array", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L258-L269
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.appendBitArray
public function appendBitArray(self $other) : void { $otherSize = $other->getSize(); $this->ensureCapacity($this->size + $other->getSize()); for ($i = 0; $i < $otherSize; ++$i) { $this->appendBit($other->get($i)); } }
php
public function appendBitArray(self $other) : void { $otherSize = $other->getSize(); $this->ensureCapacity($this->size + $other->getSize()); for ($i = 0; $i < $otherSize; ++$i) { $this->appendBit($other->get($i)); } }
[ "public", "function", "appendBitArray", "(", "self", "$", "other", ")", ":", "void", "{", "$", "otherSize", "=", "$", "other", "->", "getSize", "(", ")", ";", "$", "this", "->", "ensureCapacity", "(", "$", "this", "->", "size", "+", "$", "other", "->...
Appends another bit array to this array.
[ "Appends", "another", "bit", "array", "to", "this", "array", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L274-L282
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.xorBits
public function xorBits(self $other) : void { $bitsLength = count($this->bits); $otherBits = $other->getBitArray(); if ($bitsLength !== count($otherBits)) { throw new InvalidArgumentException('Sizes don\'t match'); } for ($i = 0; $i < $bitsLength; ++$i) { ...
php
public function xorBits(self $other) : void { $bitsLength = count($this->bits); $otherBits = $other->getBitArray(); if ($bitsLength !== count($otherBits)) { throw new InvalidArgumentException('Sizes don\'t match'); } for ($i = 0; $i < $bitsLength; ++$i) { ...
[ "public", "function", "xorBits", "(", "self", "$", "other", ")", ":", "void", "{", "$", "bitsLength", "=", "count", "(", "$", "this", "->", "bits", ")", ";", "$", "otherBits", "=", "$", "other", "->", "getBitArray", "(", ")", ";", "if", "(", "$", ...
Makes an exclusive-or comparision on the current bit array. @throws InvalidArgumentException if sizes don't match
[ "Makes", "an", "exclusive", "-", "or", "comparision", "on", "the", "current", "bit", "array", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L289-L301
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.toBytes
public function toBytes(int $bitOffset, int $numBytes) : SplFixedArray { $bytes = new SplFixedArray($numBytes); for ($i = 0; $i < $numBytes; ++$i) { $byte = 0; for ($j = 0; $j < 8; ++$j) { if ($this->get($bitOffset)) { $byte |= 1 << (7 - ...
php
public function toBytes(int $bitOffset, int $numBytes) : SplFixedArray { $bytes = new SplFixedArray($numBytes); for ($i = 0; $i < $numBytes; ++$i) { $byte = 0; for ($j = 0; $j < 8; ++$j) { if ($this->get($bitOffset)) { $byte |= 1 << (7 - ...
[ "public", "function", "toBytes", "(", "int", "$", "bitOffset", ",", "int", "$", "numBytes", ")", ":", "SplFixedArray", "{", "$", "bytes", "=", "new", "SplFixedArray", "(", "$", "numBytes", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<...
Converts the bit array to a byte array. @return SplFixedArray<int>
[ "Converts", "the", "bit", "array", "to", "a", "byte", "array", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L308-L327
Bacon/BaconQrCode
src/Common/BitArray.php
BitArray.reverse
public function reverse() : void { $newBits = new SplFixedArray(count($this->bits)); for ($i = 0; $i < $this->size; ++$i) { if ($this->get($this->size - $i - 1)) { $newBits[$i >> 5] = $newBits[$i >> 5] | (1 << ($i & 0x1f)); } } $this->bits = ...
php
public function reverse() : void { $newBits = new SplFixedArray(count($this->bits)); for ($i = 0; $i < $this->size; ++$i) { if ($this->get($this->size - $i - 1)) { $newBits[$i >> 5] = $newBits[$i >> 5] | (1 << ($i & 0x1f)); } } $this->bits = ...
[ "public", "function", "reverse", "(", ")", ":", "void", "{", "$", "newBits", "=", "new", "SplFixedArray", "(", "count", "(", "$", "this", "->", "bits", ")", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "this", "->", "size"...
Reverses the array.
[ "Reverses", "the", "array", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitArray.php#L342-L353
Bacon/BaconQrCode
src/Common/EcBlocks.php
EcBlocks.getNumBlocks
public function getNumBlocks() : int { $total = 0; foreach ($this->ecBlocks as $ecBlock) { $total += $ecBlock->getCount(); } return $total; }
php
public function getNumBlocks() : int { $total = 0; foreach ($this->ecBlocks as $ecBlock) { $total += $ecBlock->getCount(); } return $total; }
[ "public", "function", "getNumBlocks", "(", ")", ":", "int", "{", "$", "total", "=", "0", ";", "foreach", "(", "$", "this", "->", "ecBlocks", "as", "$", "ecBlock", ")", "{", "$", "total", "+=", "$", "ecBlock", "->", "getCount", "(", ")", ";", "}", ...
Returns the total number of EC block appearances.
[ "Returns", "the", "total", "number", "of", "EC", "block", "appearances", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/EcBlocks.php#L46-L55
Bacon/BaconQrCode
src/Common/CharacterSetEci.php
CharacterSetEci.getCharacterSetEciByValue
public static function getCharacterSetEciByValue(int $value) : ?self { if ($value < 0 || $value >= 900) { throw new InvalidArgumentException('Value must be between 0 and 900'); } $valueToEci = self::valueToEci(); if (! array_key_exists($value, $valueToEci)) { ...
php
public static function getCharacterSetEciByValue(int $value) : ?self { if ($value < 0 || $value >= 900) { throw new InvalidArgumentException('Value must be between 0 and 900'); } $valueToEci = self::valueToEci(); if (! array_key_exists($value, $valueToEci)) { ...
[ "public", "static", "function", "getCharacterSetEciByValue", "(", "int", "$", "value", ")", ":", "?", "self", "{", "if", "(", "$", "value", "<", "0", "||", "$", "value", ">=", "900", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Value must b...
Gets character set ECI by value. Returns the representing ECI of a given value, or null if it is legal but unsupported. @throws InvalidArgumentException if value is not between 0 and 900
[ "Gets", "character", "set", "ECI", "by", "value", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/CharacterSetEci.php#L113-L126
Bacon/BaconQrCode
src/Common/CharacterSetEci.php
CharacterSetEci.getCharacterSetEciByName
public static function getCharacterSetEciByName(string $name) : ?self { $nameToEci = self::nameToEci(); $name = strtolower($name); if (! array_key_exists($name, $nameToEci)) { return null; } return $nameToEci[$name]; }
php
public static function getCharacterSetEciByName(string $name) : ?self { $nameToEci = self::nameToEci(); $name = strtolower($name); if (! array_key_exists($name, $nameToEci)) { return null; } return $nameToEci[$name]; }
[ "public", "static", "function", "getCharacterSetEciByName", "(", "string", "$", "name", ")", ":", "?", "self", "{", "$", "nameToEci", "=", "self", "::", "nameToEci", "(", ")", ";", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", ...
Returns character set ECI by name. Returns the representing ECI of a given name, or null if it is legal but unsupported
[ "Returns", "character", "set", "ECI", "by", "name", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/CharacterSetEci.php#L133-L143
Bacon/BaconQrCode
src/Common/Version.php
Version.getProvisionalVersionForDimension
public static function getProvisionalVersionForDimension(int $dimension) : self { if (1 !== $dimension % 4) { throw new InvalidArgumentException('Dimension is not 1 mod 4'); } return self::getVersionForNumber(intdiv($dimension - 17, 4)); }
php
public static function getProvisionalVersionForDimension(int $dimension) : self { if (1 !== $dimension % 4) { throw new InvalidArgumentException('Dimension is not 1 mod 4'); } return self::getVersionForNumber(intdiv($dimension - 17, 4)); }
[ "public", "static", "function", "getProvisionalVersionForDimension", "(", "int", "$", "dimension", ")", ":", "self", "{", "if", "(", "1", "!==", "$", "dimension", "%", "4", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Dimension is not 1 mod 4'", ...
Gets a provisional version number for a specific dimension. @throws InvalidArgumentException if dimension is not 1 mod 4
[ "Gets", "a", "provisional", "version", "number", "for", "a", "specific", "dimension", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/Version.php#L155-L162
Bacon/BaconQrCode
src/Common/Version.php
Version.getVersionForNumber
public static function getVersionForNumber(int $versionNumber) : self { if ($versionNumber < 1 || $versionNumber > 40) { throw new InvalidArgumentException('Version number must be between 1 and 40'); } return self::versions()[$versionNumber - 1]; }
php
public static function getVersionForNumber(int $versionNumber) : self { if ($versionNumber < 1 || $versionNumber > 40) { throw new InvalidArgumentException('Version number must be between 1 and 40'); } return self::versions()[$versionNumber - 1]; }
[ "public", "static", "function", "getVersionForNumber", "(", "int", "$", "versionNumber", ")", ":", "self", "{", "if", "(", "$", "versionNumber", "<", "1", "||", "$", "versionNumber", ">", "40", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Ver...
Gets a version instance for a specific version number. @throws InvalidArgumentException if version number is out of range
[ "Gets", "a", "version", "instance", "for", "a", "specific", "version", "number", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/Version.php#L169-L176
Bacon/BaconQrCode
src/Common/Version.php
Version.decodeVersionInformation
public static function decodeVersionInformation(int $versionBits) : ?self { $bestDifference = PHP_INT_MAX; $bestVersion = 0; foreach (self::VERSION_DECODE_INFO as $i => $targetVersion) { if ($targetVersion === $versionBits) { return self::getVersionForNumber($i +...
php
public static function decodeVersionInformation(int $versionBits) : ?self { $bestDifference = PHP_INT_MAX; $bestVersion = 0; foreach (self::VERSION_DECODE_INFO as $i => $targetVersion) { if ($targetVersion === $versionBits) { return self::getVersionForNumber($i +...
[ "public", "static", "function", "decodeVersionInformation", "(", "int", "$", "versionBits", ")", ":", "?", "self", "{", "$", "bestDifference", "=", "PHP_INT_MAX", ";", "$", "bestVersion", "=", "0", ";", "foreach", "(", "self", "::", "VERSION_DECODE_INFO", "as"...
Decodes version information from an integer and returns the version.
[ "Decodes", "version", "information", "from", "an", "integer", "and", "returns", "the", "version", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/Version.php#L181-L204
Bacon/BaconQrCode
src/Common/Version.php
Version.buildFunctionPattern
public function buildFunctionPattern() : BitMatrix { $dimension = $this->getDimensionForVersion(); $bitMatrix = new BitMatrix($dimension); // Top left finder pattern + separator + format $bitMatrix->setRegion(0, 0, 9, 9); // Top right finder pattern + separator + format ...
php
public function buildFunctionPattern() : BitMatrix { $dimension = $this->getDimensionForVersion(); $bitMatrix = new BitMatrix($dimension); // Top left finder pattern + separator + format $bitMatrix->setRegion(0, 0, 9, 9); // Top right finder pattern + separator + format ...
[ "public", "function", "buildFunctionPattern", "(", ")", ":", "BitMatrix", "{", "$", "dimension", "=", "$", "this", "->", "getDimensionForVersion", "(", ")", ";", "$", "bitMatrix", "=", "new", "BitMatrix", "(", "$", "dimension", ")", ";", "// Top left finder pa...
Builds the function pattern for the current version.
[ "Builds", "the", "function", "pattern", "for", "the", "current", "version", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/Version.php#L209-L250
Bacon/BaconQrCode
src/Common/Version.php
Version.versions
private static function versions() : array { if (null !== self::$versions) { return self::$versions; } return self::$versions = [ new self( 1, [], new EcBlocks(7, new EcBlock(1, 19)), new EcBlocks(10, ne...
php
private static function versions() : array { if (null !== self::$versions) { return self::$versions; } return self::$versions = [ new self( 1, [], new EcBlocks(7, new EcBlock(1, 19)), new EcBlocks(10, ne...
[ "private", "static", "function", "versions", "(", ")", ":", "array", "{", "if", "(", "null", "!==", "self", "::", "$", "versions", ")", "{", "return", "self", "::", "$", "versions", ";", "}", "return", "self", "::", "$", "versions", "=", "[", "new", ...
Build and cache a specific version. See ISO 18004:2006 6.5.1 Table 9. @return array<int, self>
[ "Build", "and", "cache", "a", "specific", "version", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/Version.php#L267-L595
Bacon/BaconQrCode
src/Common/BitUtils.php
BitUtils.unsignedRightShift
public static function unsignedRightShift(int $a, int $b) : int { return ( $a >= 0 ? $a >> $b : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1)) ); }
php
public static function unsignedRightShift(int $a, int $b) : int { return ( $a >= 0 ? $a >> $b : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1)) ); }
[ "public", "static", "function", "unsignedRightShift", "(", "int", "$", "a", ",", "int", "$", "b", ")", ":", "int", "{", "return", "(", "$", "a", ">=", "0", "?", "$", "a", ">>", "$", "b", ":", "(", "(", "$", "a", "&", "0x7fffffff", ")", ">>", ...
Performs an unsigned right shift. This is the same as the unsigned right shift operator ">>>" in other languages.
[ "Performs", "an", "unsigned", "right", "shift", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitUtils.php#L24-L31
Bacon/BaconQrCode
src/Common/BitUtils.php
BitUtils.numberOfTrailingZeros
public static function numberOfTrailingZeros(int $i) : int { $lastPos = strrpos(str_pad(decbin($i), 32, '0', STR_PAD_LEFT), '1'); return $lastPos === false ? 32 : 31 - $lastPos; }
php
public static function numberOfTrailingZeros(int $i) : int { $lastPos = strrpos(str_pad(decbin($i), 32, '0', STR_PAD_LEFT), '1'); return $lastPos === false ? 32 : 31 - $lastPos; }
[ "public", "static", "function", "numberOfTrailingZeros", "(", "int", "$", "i", ")", ":", "int", "{", "$", "lastPos", "=", "strrpos", "(", "str_pad", "(", "decbin", "(", "$", "i", ")", ",", "32", ",", "'0'", ",", "STR_PAD_LEFT", ")", ",", "'1'", ")", ...
Gets the number of trailing zeros.
[ "Gets", "the", "number", "of", "trailing", "zeros", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitUtils.php#L36-L40
Bacon/BaconQrCode
src/Writer.php
Writer.writeString
public function writeString( string $content, string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, ?ErrorCorrectionLevel $ecLevel = null ) : string { if (strlen($content) === 0) { throw new InvalidArgumentException('Found empty contents'); } if (null ==...
php
public function writeString( string $content, string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, ?ErrorCorrectionLevel $ecLevel = null ) : string { if (strlen($content) === 0) { throw new InvalidArgumentException('Found empty contents'); } if (null ==...
[ "public", "function", "writeString", "(", "string", "$", "content", ",", "string", "$", "encoding", "=", "Encoder", "::", "DEFAULT_BYTE_MODE_ECODING", ",", "?", "ErrorCorrectionLevel", "$", "ecLevel", "=", "null", ")", ":", "string", "{", "if", "(", "strlen", ...
Writes QR code and returns it as string. Content is a string which *should* be encoded in UTF-8, in case there are non ASCII-characters present. @throws InvalidArgumentException if the content is empty
[ "Writes", "QR", "code", "and", "returns", "it", "as", "string", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Writer.php#L39-L53
Bacon/BaconQrCode
src/Writer.php
Writer.writeFile
public function writeFile( string $content, string $filename, string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, ?ErrorCorrectionLevel $ecLevel = null ) : void { file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel)); }
php
public function writeFile( string $content, string $filename, string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, ?ErrorCorrectionLevel $ecLevel = null ) : void { file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel)); }
[ "public", "function", "writeFile", "(", "string", "$", "content", ",", "string", "$", "filename", ",", "string", "$", "encoding", "=", "Encoder", "::", "DEFAULT_BYTE_MODE_ECODING", ",", "?", "ErrorCorrectionLevel", "$", "ecLevel", "=", "null", ")", ":", "void"...
Writes QR code to a file. @see Writer::writeString()
[ "Writes", "QR", "code", "to", "a", "file", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Writer.php#L60-L67
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.get
public function get(int $x, int $y) : bool { $offset = $y * $this->rowSize + ($x >> 5); return 0 !== (BitUtils::unsignedRightShift($this->bits[$offset], ($x & 0x1f)) & 1); }
php
public function get(int $x, int $y) : bool { $offset = $y * $this->rowSize + ($x >> 5); return 0 !== (BitUtils::unsignedRightShift($this->bits[$offset], ($x & 0x1f)) & 1); }
[ "public", "function", "get", "(", "int", "$", "x", ",", "int", "$", "y", ")", ":", "bool", "{", "$", "offset", "=", "$", "y", "*", "$", "this", "->", "rowSize", "+", "(", "$", "x", ">>", "5", ")", ";", "return", "0", "!==", "(", "BitUtils", ...
Gets the requested bit, where true means black.
[ "Gets", "the", "requested", "bit", "where", "true", "means", "black", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L68-L72
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.set
public function set(int $x, int $y) : void { $offset = $y * $this->rowSize + ($x >> 5); $this->bits[$offset] = $this->bits[$offset] | (1 << ($x & 0x1f)); }
php
public function set(int $x, int $y) : void { $offset = $y * $this->rowSize + ($x >> 5); $this->bits[$offset] = $this->bits[$offset] | (1 << ($x & 0x1f)); }
[ "public", "function", "set", "(", "int", "$", "x", ",", "int", "$", "y", ")", ":", "void", "{", "$", "offset", "=", "$", "y", "*", "$", "this", "->", "rowSize", "+", "(", "$", "x", ">>", "5", ")", ";", "$", "this", "->", "bits", "[", "$", ...
Sets the given bit to true.
[ "Sets", "the", "given", "bit", "to", "true", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L77-L81
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.clear
public function clear() : void { $max = count($this->bits); for ($i = 0; $i < $max; ++$i) { $this->bits[$i] = 0; } }
php
public function clear() : void { $max = count($this->bits); for ($i = 0; $i < $max; ++$i) { $this->bits[$i] = 0; } }
[ "public", "function", "clear", "(", ")", ":", "void", "{", "$", "max", "=", "count", "(", "$", "this", "->", "bits", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "max", ";", "++", "$", "i", ")", "{", "$", "this", "->...
Clears all bits (set to false).
[ "Clears", "all", "bits", "(", "set", "to", "false", ")", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L95-L102
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.setRegion
public function setRegion(int $left, int $top, int $width, int $height) : void { if ($top < 0 || $left < 0) { throw new InvalidArgumentException('Left and top must be non-negative'); } if ($height < 1 || $width < 1) { throw new InvalidArgumentException('Width and hei...
php
public function setRegion(int $left, int $top, int $width, int $height) : void { if ($top < 0 || $left < 0) { throw new InvalidArgumentException('Left and top must be non-negative'); } if ($height < 1 || $width < 1) { throw new InvalidArgumentException('Width and hei...
[ "public", "function", "setRegion", "(", "int", "$", "left", ",", "int", "$", "top", ",", "int", "$", "width", ",", "int", "$", "height", ")", ":", "void", "{", "if", "(", "$", "top", "<", "0", "||", "$", "left", "<", "0", ")", "{", "throw", "...
Sets a square region of the bit matrix to true. @throws InvalidArgumentException if left or top are negative @throws InvalidArgumentException if width or height are smaller than 1 @throws InvalidArgumentException if region does not fit into the matix
[ "Sets", "a", "square", "region", "of", "the", "bit", "matrix", "to", "true", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L111-L136
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.getRow
public function getRow(int $y, BitArray $row = null) : BitArray { if (null === $row || $row->getSize() < $this->width) { $row = new BitArray($this->width); } $offset = $y * $this->rowSize; for ($x = 0; $x < $this->rowSize; ++$x) { $row->setBulk($x << 5, $thi...
php
public function getRow(int $y, BitArray $row = null) : BitArray { if (null === $row || $row->getSize() < $this->width) { $row = new BitArray($this->width); } $offset = $y * $this->rowSize; for ($x = 0; $x < $this->rowSize; ++$x) { $row->setBulk($x << 5, $thi...
[ "public", "function", "getRow", "(", "int", "$", "y", ",", "BitArray", "$", "row", "=", "null", ")", ":", "BitArray", "{", "if", "(", "null", "===", "$", "row", "||", "$", "row", "->", "getSize", "(", ")", "<", "$", "this", "->", "width", ")", ...
A fast method to retrieve one row of data from the matrix as a BitArray.
[ "A", "fast", "method", "to", "retrieve", "one", "row", "of", "data", "from", "the", "matrix", "as", "a", "BitArray", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L141-L154
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.setRow
public function setRow(int $y, BitArray $row) : void { $bits = $row->getBitArray(); for ($i = 0; $i < $this->rowSize; ++$i) { $this->bits[$y * $this->rowSize + $i] = $bits[$i]; } }
php
public function setRow(int $y, BitArray $row) : void { $bits = $row->getBitArray(); for ($i = 0; $i < $this->rowSize; ++$i) { $this->bits[$y * $this->rowSize + $i] = $bits[$i]; } }
[ "public", "function", "setRow", "(", "int", "$", "y", ",", "BitArray", "$", "row", ")", ":", "void", "{", "$", "bits", "=", "$", "row", "->", "getBitArray", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "this", "->",...
Sets a row of data from a BitArray.
[ "Sets", "a", "row", "of", "data", "from", "a", "BitArray", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L159-L166
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.getEnclosingRectangle
public function getEnclosingRectangle() : ?array { $left = $this->width; $top = $this->height; $right = -1; $bottom = -1; for ($y = 0; $y < $this->height; ++$y) { for ($x32 = 0; $x32 < $this->rowSize; ++$x32) { $bits = $this->bits[$y * $this->rowS...
php
public function getEnclosingRectangle() : ?array { $left = $this->width; $top = $this->height; $right = -1; $bottom = -1; for ($y = 0; $y < $this->height; ++$y) { for ($x32 = 0; $x32 < $this->rowSize; ++$x32) { $bits = $this->bits[$y * $this->rowS...
[ "public", "function", "getEnclosingRectangle", "(", ")", ":", "?", "array", "{", "$", "left", "=", "$", "this", "->", "width", ";", "$", "top", "=", "$", "this", "->", "height", ";", "$", "right", "=", "-", "1", ";", "$", "bottom", "=", "-", "1",...
This is useful in detecting the enclosing rectangle of a 'pure' barcode. @return int[]|null
[ "This", "is", "useful", "in", "detecting", "the", "enclosing", "rectangle", "of", "a", "pure", "barcode", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L173-L228
Bacon/BaconQrCode
src/Common/BitMatrix.php
BitMatrix.getTopLeftOnBit
public function getTopLeftOnBit() : ?array { $bitsOffset = 0; while ($bitsOffset < count($this->bits) && 0 === $this->bits[$bitsOffset]) { ++$bitsOffset; } if (count($this->bits) === $bitsOffset) { return null; } $x = intdiv($bitsOffset, $th...
php
public function getTopLeftOnBit() : ?array { $bitsOffset = 0; while ($bitsOffset < count($this->bits) && 0 === $this->bits[$bitsOffset]) { ++$bitsOffset; } if (count($this->bits) === $bitsOffset) { return null; } $x = intdiv($bitsOffset, $th...
[ "public", "function", "getTopLeftOnBit", "(", ")", ":", "?", "array", "{", "$", "bitsOffset", "=", "0", ";", "while", "(", "$", "bitsOffset", "<", "count", "(", "$", "this", "->", "bits", ")", "&&", "0", "===", "$", "this", "->", "bits", "[", "$", ...
Gets the most top left set bit. This is useful in detecting a corner of a 'pure' barcode. @return int[]|null
[ "Gets", "the", "most", "top", "left", "set", "bit", "." ]
train
https://github.com/Bacon/BaconQrCode/blob/b08c713191f3c824c0db3b2fc5d8561e98fb1da4/src/Common/BitMatrix.php#L237-L262