From a0b2c2a53167082b868a7578e3315a21afc37d0d Mon Sep 17 00:00:00 2001 From: Hugo A Date: Mon, 15 Aug 2022 12:05:50 +0200 Subject: [PATCH] branche initiale --- vendor/autoload.php | 12 + vendor/bacon/bacon-qr-code/LICENSE | 22 + vendor/bacon/bacon-qr-code/README.md | 39 + vendor/bacon/bacon-qr-code/composer.json | 38 + .../bacon-qr-code/src/Common/BitArray.php | 372 +++ .../bacon-qr-code/src/Common/BitMatrix.php | 313 ++ .../bacon-qr-code/src/Common/BitUtils.php | 41 + .../src/Common/CharacterSetEci.php | 180 ++ .../bacon-qr-code/src/Common/EcBlock.php | 49 + .../bacon-qr-code/src/Common/EcBlocks.php | 74 + .../src/Common/ErrorCorrectionLevel.php | 63 + .../src/Common/FormatInformation.php | 203 ++ .../bacon/bacon-qr-code/src/Common/Mode.php | 76 + .../src/Common/ReedSolomonCodec.php | 468 +++ .../bacon-qr-code/src/Common/Version.php | 596 ++++ .../bacon-qr-code/src/Encoder/BlockPair.php | 58 + .../bacon-qr-code/src/Encoder/ByteMatrix.php | 150 + .../bacon-qr-code/src/Encoder/Encoder.php | 668 ++++ .../bacon-qr-code/src/Encoder/MaskUtil.php | 271 ++ .../bacon-qr-code/src/Encoder/MatrixUtil.php | 513 ++++ .../bacon-qr-code/src/Encoder/QrCode.php | 141 + .../src/Exception/ExceptionInterface.php | 10 + .../Exception/InvalidArgumentException.php | 8 + .../src/Exception/OutOfBoundsException.php | 8 + .../src/Exception/RuntimeException.php | 8 + .../Exception/UnexpectedValueException.php | 8 + .../src/Exception/WriterException.php | 8 + .../src/Renderer/Color/Alpha.php | 57 + .../bacon-qr-code/src/Renderer/Color/Cmyk.php | 103 + .../src/Renderer/Color/ColorInterface.php | 22 + .../bacon-qr-code/src/Renderer/Color/Gray.php | 46 + .../bacon-qr-code/src/Renderer/Color/Rgb.php | 88 + .../src/Renderer/Eye/CompositeEye.php | 38 + .../src/Renderer/Eye/EyeInterface.php | 26 + .../src/Renderer/Eye/ModuleEye.php | 54 + .../src/Renderer/Eye/SimpleCircleEye.php | 54 + .../src/Renderer/Eye/SquareEye.php | 53 + .../src/Renderer/Image/EpsImageBackEnd.php | 376 +++ .../Renderer/Image/ImageBackEndInterface.php | 87 + .../Renderer/Image/ImagickImageBackEnd.php | 336 ++ .../src/Renderer/Image/SvgImageBackEnd.php | 369 +++ .../Renderer/Image/TransformationMatrix.php | 68 + .../src/Renderer/ImageRenderer.php | 152 + .../src/Renderer/Module/DotsModule.php | 63 + .../src/Renderer/Module/EdgeIterator/Edge.php | 100 + .../Module/EdgeIterator/EdgeIterator.php | 169 ++ .../src/Renderer/Module/ModuleInterface.php | 18 + .../src/Renderer/Module/RoundnessModule.php | 129 + .../src/Renderer/Module/SquareModule.php | 47 + .../bacon-qr-code/src/Renderer/Path/Close.php | 29 + .../bacon-qr-code/src/Renderer/Path/Curve.php | 92 + .../src/Renderer/Path/EllipticArc.php | 278 ++ .../bacon-qr-code/src/Renderer/Path/Line.php | 41 + .../bacon-qr-code/src/Renderer/Path/Move.php | 41 + .../src/Renderer/Path/OperationInterface.php | 12 + .../bacon-qr-code/src/Renderer/Path/Path.php | 106 + .../src/Renderer/PlainTextRenderer.php | 86 + .../src/Renderer/RendererInterface.php | 11 + .../src/Renderer/RendererStyle/EyeFill.php | 74 + .../src/Renderer/RendererStyle/Fill.php | 168 + .../src/Renderer/RendererStyle/Gradient.php | 46 + .../Renderer/RendererStyle/GradientType.php | 22 + .../Renderer/RendererStyle/RendererStyle.php | 90 + vendor/bacon/bacon-qr-code/src/Writer.php | 71 + .../test/Common/BitArrayTest.php | 222 ++ .../test/Common/BitMatrixTest.php | 115 + .../test/Common/BitUtilsTest.php | 25 + .../test/Common/ErrorCorrectionLevelTest.php | 25 + .../test/Common/FormatInformationTest.php | 94 + .../bacon-qr-code/test/Common/ModeTest.php | 19 + .../test/Common/ReedSolomonCodecTest.php | 96 + .../bacon-qr-code/test/Common/VersionTest.php | 78 + .../test/Encoder/EncoderTest.php | 487 +++ .../test/Encoder/MaskUtilTest.php | 251 ++ .../test/Encoder/MatrixUtilTest.php | 335 ++ .../test/Integration/ImagickRenderingTest.php | 63 + ...ickRenderingTest__testGenericQrCode__1.png | Bin 0 -> 3111 bytes .../ImagickRenderingTest__testIssue79__1.png | Bin 0 -> 8366 bytes vendor/bin/lessc | 117 + vendor/composer/ClassLoader.php | 572 ++++ vendor/composer/InstalledVersions.php | 352 +++ vendor/composer/LICENSE | 21 + vendor/composer/autoload_classmap.php | 11 + vendor/composer/autoload_namespaces.php | 10 + vendor/composer/autoload_psr4.php | 12 + vendor/composer/autoload_real.php | 38 + vendor/composer/autoload_static.php | 64 + vendor/composer/installed.json | 260 ++ vendor/composer/installed.php | 59 + vendor/composer/platform_check.php | 26 + vendor/dasprid/enum/LICENSE | 22 + vendor/dasprid/enum/README.md | 164 + vendor/dasprid/enum/composer.json | 31 + vendor/dasprid/enum/phpunit.xml.dist | 17 + vendor/dasprid/enum/src/AbstractEnum.php | 241 ++ vendor/dasprid/enum/src/EnumMap.php | 375 +++ .../Exception/CloneNotSupportedException.php | 10 + .../enum/src/Exception/ExceptionInterface.php | 10 + .../src/Exception/ExpectationException.php | 10 + .../Exception/IllegalArgumentException.php | 10 + .../enum/src/Exception/MismatchException.php | 10 + .../SerializeNotSupportedException.php | 10 + .../UnserializeNotSupportedException.php | 10 + vendor/dasprid/enum/src/NullValue.php | 55 + vendor/dasprid/enum/test/AbstractEnumTest.php | 121 + vendor/dasprid/enum/test/EnumMapTest.php | 243 ++ vendor/dasprid/enum/test/NullValueTest.php | 31 + vendor/dasprid/enum/test/Planet.php | 73 + vendor/dasprid/enum/test/WeekDay.php | 26 + vendor/endroid/qr-code/.gitattributes | 2 + vendor/endroid/qr-code/.github/FUNDING.yml | 1 + vendor/endroid/qr-code/.gitignore | 4 + vendor/endroid/qr-code/LICENSE | 19 + vendor/endroid/qr-code/README.md | 178 ++ vendor/endroid/qr-code/assets/open_sans.ttf | Bin 0 -> 217360 bytes vendor/endroid/qr-code/composer.json | 51 + .../Bacon/ErrorCorrectionLevelConverter.php | 30 + .../qr-code/src/Bacon/MatrixFactory.php | 32 + .../endroid/qr-code/src/Builder/Builder.php | 278 ++ .../qr-code/src/Builder/BuilderInterface.php | 63 + .../qr-code/src/Builder/BuilderRegistry.php | 25 + .../src/Builder/BuilderRegistryInterface.php | 12 + vendor/endroid/qr-code/src/Color/Color.php | 56 + .../qr-code/src/Color/ColorInterface.php | 21 + .../endroid/qr-code/src/Encoding/Encoding.php | 24 + .../src/Encoding/EncodingInterface.php | 10 + .../ErrorCorrectionLevelHigh.php | 9 + .../ErrorCorrectionLevelInterface.php | 9 + .../ErrorCorrectionLevelLow.php | 9 + .../ErrorCorrectionLevelMedium.php | 9 + .../ErrorCorrectionLevelQuartile.php | 9 + .../qr-code/src/ImageData/LabelImageData.php | 51 + .../qr-code/src/ImageData/LogoImageData.php | 164 + .../Label/Alignment/LabelAlignmentCenter.php | 9 + .../Alignment/LabelAlignmentInterface.php | 9 + .../Label/Alignment/LabelAlignmentLeft.php | 9 + .../Label/Alignment/LabelAlignmentRight.php | 9 + .../endroid/qr-code/src/Label/Font/Font.php | 36 + .../qr-code/src/Label/Font/FontInterface.php | 12 + .../qr-code/src/Label/Font/NotoSans.php | 25 + .../qr-code/src/Label/Font/OpenSans.php | 25 + vendor/endroid/qr-code/src/Label/Label.php | 102 + .../qr-code/src/Label/LabelInterface.php | 23 + .../qr-code/src/Label/Margin/Margin.php | 52 + .../src/Label/Margin/MarginInterface.php | 19 + vendor/endroid/qr-code/src/Logo/Logo.php | 74 + .../qr-code/src/Logo/LogoInterface.php | 16 + vendor/endroid/qr-code/src/Matrix/Matrix.php | 87 + .../src/Matrix/MatrixFactoryInterface.php | 12 + .../qr-code/src/Matrix/MatrixInterface.php | 22 + vendor/endroid/qr-code/src/QrCode.php | 147 + .../endroid/qr-code/src/QrCodeInterface.php | 29 + .../RoundBlockSizeModeEnlarge.php | 9 + .../RoundBlockSizeModeInterface.php | 9 + .../RoundBlockSizeModeMargin.php | 9 + .../RoundBlockSizeModeNone.php | 9 + .../RoundBlockSizeModeShrink.php | 9 + .../endroid/qr-code/src/WritableInterface.php | 7 + .../qr-code/src/Writer/BinaryWriter.php | 23 + .../qr-code/src/Writer/DebugWriter.php | 28 + .../endroid/qr-code/src/Writer/EpsWriter.php | 44 + .../endroid/qr-code/src/Writer/PdfWriter.php | 133 + .../endroid/qr-code/src/Writer/PngWriter.php | 227 ++ .../src/Writer/Result/AbstractResult.php | 19 + .../src/Writer/Result/BinaryResult.php | 35 + .../qr-code/src/Writer/Result/DebugResult.php | 77 + .../qr-code/src/Writer/Result/EpsResult.php | 27 + .../qr-code/src/Writer/Result/PdfResult.php | 30 + .../qr-code/src/Writer/Result/PngResult.php | 36 + .../src/Writer/Result/ResultInterface.php | 16 + .../qr-code/src/Writer/Result/SvgResult.php | 42 + .../endroid/qr-code/src/Writer/SvgWriter.php | 107 + .../src/Writer/ValidatingWriterInterface.php | 12 + .../qr-code/src/Writer/WriterInterface.php | 16 + vendor/wikimedia/less.php/CHANGES.md | 70 + vendor/wikimedia/less.php/LICENSE | 178 ++ vendor/wikimedia/less.php/README.md | 315 ++ vendor/wikimedia/less.php/bin/lessc | 191 ++ vendor/wikimedia/less.php/composer.json | 49 + vendor/wikimedia/less.php/lessc.inc.php | 274 ++ .../lib/Less/.easymin/ignore_prefixes | 2 + .../less.php/lib/Less/Autoloader.php | 77 + vendor/wikimedia/less.php/lib/Less/Cache.php | 293 ++ vendor/wikimedia/less.php/lib/Less/Colors.php | 169 ++ .../less.php/lib/Less/Configurable.php | 66 + .../less.php/lib/Less/Environment.php | 157 + .../less.php/lib/Less/Exception/Chunk.php | 203 ++ .../less.php/lib/Less/Exception/Compiler.php | 11 + .../less.php/lib/Less/Exception/Parser.php | 116 + .../wikimedia/less.php/lib/Less/Functions.php | 1186 ++++++++ .../less.php/lib/Less/Less.php.combine | 17 + vendor/wikimedia/less.php/lib/Less/Mime.php | 41 + vendor/wikimedia/less.php/lib/Less/Output.php | 48 + .../less.php/lib/Less/Output/Mapped.php | 119 + vendor/wikimedia/less.php/lib/Less/Parser.php | 2691 +++++++++++++++++ .../less.php/lib/Less/SourceMap/Base64VLQ.php | 187 ++ .../less.php/lib/Less/SourceMap/Generator.php | 354 +++ vendor/wikimedia/less.php/lib/Less/Tree.php | 84 + .../less.php/lib/Less/Tree/Alpha.php | 48 + .../less.php/lib/Less/Tree/Anonymous.php | 58 + .../less.php/lib/Less/Tree/Assignment.php | 39 + .../less.php/lib/Less/Tree/Attribute.php | 53 + .../wikimedia/less.php/lib/Less/Tree/Call.php | 117 + .../less.php/lib/Less/Tree/Color.php | 230 ++ .../less.php/lib/Less/Tree/Comment.php | 51 + .../less.php/lib/Less/Tree/Condition.php | 72 + .../less.php/lib/Less/Tree/DefaultFunc.php | 34 + .../lib/Less/Tree/DetachedRuleset.php | 39 + .../less.php/lib/Less/Tree/Dimension.php | 198 ++ .../less.php/lib/Less/Tree/Directive.php | 96 + .../less.php/lib/Less/Tree/Element.php | 70 + .../less.php/lib/Less/Tree/Expression.php | 95 + .../less.php/lib/Less/Tree/Extend.php | 80 + .../less.php/lib/Less/Tree/Import.php | 291 ++ .../less.php/lib/Less/Tree/Javascript.php | 30 + .../less.php/lib/Less/Tree/Keyword.php | 43 + .../less.php/lib/Less/Tree/Media.php | 173 ++ .../less.php/lib/Less/Tree/Mixin/Call.php | 193 ++ .../lib/Less/Tree/Mixin/Definition.php | 233 ++ .../less.php/lib/Less/Tree/NameValue.php | 49 + .../less.php/lib/Less/Tree/Negative.php | 37 + .../less.php/lib/Less/Tree/Operation.php | 68 + .../less.php/lib/Less/Tree/Paren.php | 35 + .../less.php/lib/Less/Tree/Quoted.php | 79 + .../wikimedia/less.php/lib/Less/Tree/Rule.php | 112 + .../less.php/lib/Less/Tree/Ruleset.php | 621 ++++ .../less.php/lib/Less/Tree/RulesetCall.php | 26 + .../less.php/lib/Less/Tree/Selector.php | 165 + .../lib/Less/Tree/UnicodeDescriptor.php | 28 + .../wikimedia/less.php/lib/Less/Tree/Unit.php | 142 + .../lib/Less/Tree/UnitConversions.php | 35 + .../wikimedia/less.php/lib/Less/Tree/Url.php | 76 + .../less.php/lib/Less/Tree/Value.php | 47 + .../less.php/lib/Less/Tree/Variable.php | 51 + .../wikimedia/less.php/lib/Less/Version.php | 15 + .../wikimedia/less.php/lib/Less/Visitor.php | 46 + .../lib/Less/Visitor/extendFinder.php | 109 + .../less.php/lib/Less/Visitor/import.php | 137 + .../lib/Less/Visitor/joinSelector.php | 68 + .../lib/Less/Visitor/processExtends.php | 441 +++ .../less.php/lib/Less/Visitor/toCSS.php | 280 ++ .../less.php/lib/Less/VisitorReplacing.php | 70 + 242 files changed, 27425 insertions(+) create mode 100755 vendor/autoload.php create mode 100755 vendor/bacon/bacon-qr-code/LICENSE create mode 100755 vendor/bacon/bacon-qr-code/README.md create mode 100755 vendor/bacon/bacon-qr-code/composer.json create mode 100755 vendor/bacon/bacon-qr-code/src/Common/BitArray.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/BitUtils.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/EcBlock.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/Mode.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php create mode 100755 vendor/bacon/bacon-qr-code/src/Common/Version.php create mode 100755 vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php create mode 100755 vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php create mode 100755 vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php create mode 100755 vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php create mode 100755 vendor/bacon/bacon-qr-code/src/Encoder/MatrixUtil.php create mode 100755 vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php create mode 100755 vendor/bacon/bacon-qr-code/src/Exception/ExceptionInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Exception/InvalidArgumentException.php create mode 100755 vendor/bacon/bacon-qr-code/src/Exception/OutOfBoundsException.php create mode 100755 vendor/bacon/bacon-qr-code/src/Exception/RuntimeException.php create mode 100755 vendor/bacon/bacon-qr-code/src/Exception/UnexpectedValueException.php create mode 100755 vendor/bacon/bacon-qr-code/src/Exception/WriterException.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Color/Alpha.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Color/ColorInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Color/Gray.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Eye/EyeInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Eye/ModuleEye.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Image/ImageBackEndInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Image/ImagickImageBackEnd.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Module/ModuleInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Module/RoundnessModule.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/Curve.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/Path/Path.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/RendererInterface.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/EyeFill.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/GradientType.php create mode 100755 vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/RendererStyle.php create mode 100755 vendor/bacon/bacon-qr-code/src/Writer.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/ModeTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Common/VersionTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php create mode 100755 vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testGenericQrCode__1.png create mode 100755 vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testIssue79__1.png create mode 100755 vendor/bin/lessc create mode 100755 vendor/composer/ClassLoader.php create mode 100755 vendor/composer/InstalledVersions.php create mode 100755 vendor/composer/LICENSE create mode 100755 vendor/composer/autoload_classmap.php create mode 100755 vendor/composer/autoload_namespaces.php create mode 100755 vendor/composer/autoload_psr4.php create mode 100755 vendor/composer/autoload_real.php create mode 100755 vendor/composer/autoload_static.php create mode 100755 vendor/composer/installed.json create mode 100755 vendor/composer/installed.php create mode 100755 vendor/composer/platform_check.php create mode 100755 vendor/dasprid/enum/LICENSE create mode 100755 vendor/dasprid/enum/README.md create mode 100755 vendor/dasprid/enum/composer.json create mode 100755 vendor/dasprid/enum/phpunit.xml.dist create mode 100755 vendor/dasprid/enum/src/AbstractEnum.php create mode 100755 vendor/dasprid/enum/src/EnumMap.php create mode 100755 vendor/dasprid/enum/src/Exception/CloneNotSupportedException.php create mode 100755 vendor/dasprid/enum/src/Exception/ExceptionInterface.php create mode 100755 vendor/dasprid/enum/src/Exception/ExpectationException.php create mode 100755 vendor/dasprid/enum/src/Exception/IllegalArgumentException.php create mode 100755 vendor/dasprid/enum/src/Exception/MismatchException.php create mode 100755 vendor/dasprid/enum/src/Exception/SerializeNotSupportedException.php create mode 100755 vendor/dasprid/enum/src/Exception/UnserializeNotSupportedException.php create mode 100755 vendor/dasprid/enum/src/NullValue.php create mode 100755 vendor/dasprid/enum/test/AbstractEnumTest.php create mode 100755 vendor/dasprid/enum/test/EnumMapTest.php create mode 100755 vendor/dasprid/enum/test/NullValueTest.php create mode 100755 vendor/dasprid/enum/test/Planet.php create mode 100755 vendor/dasprid/enum/test/WeekDay.php create mode 100755 vendor/endroid/qr-code/.gitattributes create mode 100755 vendor/endroid/qr-code/.github/FUNDING.yml create mode 100755 vendor/endroid/qr-code/.gitignore create mode 100755 vendor/endroid/qr-code/LICENSE create mode 100755 vendor/endroid/qr-code/README.md create mode 100755 vendor/endroid/qr-code/assets/open_sans.ttf create mode 100755 vendor/endroid/qr-code/composer.json create mode 100755 vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php create mode 100755 vendor/endroid/qr-code/src/Bacon/MatrixFactory.php create mode 100755 vendor/endroid/qr-code/src/Builder/Builder.php create mode 100755 vendor/endroid/qr-code/src/Builder/BuilderInterface.php create mode 100755 vendor/endroid/qr-code/src/Builder/BuilderRegistry.php create mode 100755 vendor/endroid/qr-code/src/Builder/BuilderRegistryInterface.php create mode 100755 vendor/endroid/qr-code/src/Color/Color.php create mode 100755 vendor/endroid/qr-code/src/Color/ColorInterface.php create mode 100755 vendor/endroid/qr-code/src/Encoding/Encoding.php create mode 100755 vendor/endroid/qr-code/src/Encoding/EncodingInterface.php create mode 100755 vendor/endroid/qr-code/src/ErrorCorrectionLevel/ErrorCorrectionLevelHigh.php create mode 100755 vendor/endroid/qr-code/src/ErrorCorrectionLevel/ErrorCorrectionLevelInterface.php create mode 100755 vendor/endroid/qr-code/src/ErrorCorrectionLevel/ErrorCorrectionLevelLow.php create mode 100755 vendor/endroid/qr-code/src/ErrorCorrectionLevel/ErrorCorrectionLevelMedium.php create mode 100755 vendor/endroid/qr-code/src/ErrorCorrectionLevel/ErrorCorrectionLevelQuartile.php create mode 100755 vendor/endroid/qr-code/src/ImageData/LabelImageData.php create mode 100755 vendor/endroid/qr-code/src/ImageData/LogoImageData.php create mode 100755 vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentCenter.php create mode 100755 vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentInterface.php create mode 100755 vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentLeft.php create mode 100755 vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentRight.php create mode 100755 vendor/endroid/qr-code/src/Label/Font/Font.php create mode 100755 vendor/endroid/qr-code/src/Label/Font/FontInterface.php create mode 100755 vendor/endroid/qr-code/src/Label/Font/NotoSans.php create mode 100755 vendor/endroid/qr-code/src/Label/Font/OpenSans.php create mode 100755 vendor/endroid/qr-code/src/Label/Label.php create mode 100755 vendor/endroid/qr-code/src/Label/LabelInterface.php create mode 100755 vendor/endroid/qr-code/src/Label/Margin/Margin.php create mode 100755 vendor/endroid/qr-code/src/Label/Margin/MarginInterface.php create mode 100755 vendor/endroid/qr-code/src/Logo/Logo.php create mode 100755 vendor/endroid/qr-code/src/Logo/LogoInterface.php create mode 100755 vendor/endroid/qr-code/src/Matrix/Matrix.php create mode 100755 vendor/endroid/qr-code/src/Matrix/MatrixFactoryInterface.php create mode 100755 vendor/endroid/qr-code/src/Matrix/MatrixInterface.php create mode 100755 vendor/endroid/qr-code/src/QrCode.php create mode 100755 vendor/endroid/qr-code/src/QrCodeInterface.php create mode 100755 vendor/endroid/qr-code/src/RoundBlockSizeMode/RoundBlockSizeModeEnlarge.php create mode 100755 vendor/endroid/qr-code/src/RoundBlockSizeMode/RoundBlockSizeModeInterface.php create mode 100755 vendor/endroid/qr-code/src/RoundBlockSizeMode/RoundBlockSizeModeMargin.php create mode 100755 vendor/endroid/qr-code/src/RoundBlockSizeMode/RoundBlockSizeModeNone.php create mode 100755 vendor/endroid/qr-code/src/RoundBlockSizeMode/RoundBlockSizeModeShrink.php create mode 100755 vendor/endroid/qr-code/src/WritableInterface.php create mode 100755 vendor/endroid/qr-code/src/Writer/BinaryWriter.php create mode 100755 vendor/endroid/qr-code/src/Writer/DebugWriter.php create mode 100755 vendor/endroid/qr-code/src/Writer/EpsWriter.php create mode 100755 vendor/endroid/qr-code/src/Writer/PdfWriter.php create mode 100755 vendor/endroid/qr-code/src/Writer/PngWriter.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/AbstractResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/BinaryResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/DebugResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/EpsResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/PdfResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/PngResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/ResultInterface.php create mode 100755 vendor/endroid/qr-code/src/Writer/Result/SvgResult.php create mode 100755 vendor/endroid/qr-code/src/Writer/SvgWriter.php create mode 100755 vendor/endroid/qr-code/src/Writer/ValidatingWriterInterface.php create mode 100755 vendor/endroid/qr-code/src/Writer/WriterInterface.php create mode 100755 vendor/wikimedia/less.php/CHANGES.md create mode 100755 vendor/wikimedia/less.php/LICENSE create mode 100755 vendor/wikimedia/less.php/README.md create mode 100755 vendor/wikimedia/less.php/bin/lessc create mode 100755 vendor/wikimedia/less.php/composer.json create mode 100755 vendor/wikimedia/less.php/lessc.inc.php create mode 100755 vendor/wikimedia/less.php/lib/Less/.easymin/ignore_prefixes create mode 100755 vendor/wikimedia/less.php/lib/Less/Autoloader.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Cache.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Colors.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Configurable.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Environment.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Exception/Parser.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Functions.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Less.php.combine create mode 100755 vendor/wikimedia/less.php/lib/Less/Mime.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Output.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Output/Mapped.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Parser.php create mode 100755 vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php create mode 100755 vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Call.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Color.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Comment.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Condition.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/DetachedRuleset.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Directive.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Element.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Expression.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Extend.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Import.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Media.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Negative.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Operation.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Paren.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Rule.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Selector.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Unit.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Url.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Value.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Tree/Variable.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Version.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Visitor.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Visitor/import.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php create mode 100755 vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php create mode 100755 vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100755 index 0000000..79bfa69 --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,12 @@ +writeFile('Hello World!', 'qrcode.png'); +``` + +## Available image renderer back ends +BaconQrCode comes with multiple back ends for rendering images. Currently included are the following: + +- `ImagickImageBackEnd`: renders raster images using the Imagick library +- `SvgImageBackEnd`: renders SVG files using XMLWriter +- `EpsImageBackEnd`: renders EPS files diff --git a/vendor/bacon/bacon-qr-code/composer.json b/vendor/bacon/bacon-qr-code/composer.json new file mode 100755 index 0000000..1440cc3 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/composer.json @@ -0,0 +1,38 @@ +{ + "name": "bacon/bacon-qr-code", + "description": "BaconQrCode is a QR code generator for PHP.", + "license" : "BSD-2-Clause", + "homepage": "https://github.com/Bacon/BaconQrCode", + "require": { + "php": "^7.1 || ^8.0", + "ext-iconv": "*", + "dasprid/enum": "^1.0.3" + }, + "suggest": { + "ext-imagick": "to generate QR code images" + }, + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "autoload": { + "psr-4": { + "BaconQrCode\\": "src/" + } + }, + "require-dev": { + "phpunit/phpunit": "^7 | ^8 | ^9", + "spatie/phpunit-snapshot-assertions": "^4.2.9", + "squizlabs/php_codesniffer": "^3.4", + "phly/keep-a-changelog": "^2.1" + }, + "config": { + "allow-plugins": { + "ocramius/package-versions": true + } + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/BitArray.php b/vendor/bacon/bacon-qr-code/src/Common/BitArray.php new file mode 100755 index 0000000..158384f --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/BitArray.php @@ -0,0 +1,372 @@ + + */ + private $bits; + + /** + * Size of the bit array in bits. + * + * @var int + */ + private $size; + + /** + * Creates a new bit array with a given size. + */ + public function __construct(int $size = 0) + { + $this->size = $size; + $this->bits = SplFixedArray::fromArray(array_fill(0, ($this->size + 31) >> 3, 0)); + } + + /** + * Gets the size in bits. + */ + public function getSize() : int + { + return $this->size; + } + + /** + * Gets the size in bytes. + */ + public function getSizeInBytes() : int + { + return ($this->size + 7) >> 3; + } + + /** + * Ensures that the array has a minimum capacity. + */ + public function ensureCapacity(int $size) : void + { + if ($size > count($this->bits) << 5) { + $this->bits->setSize(($size + 31) >> 5); + } + } + + /** + * Gets a specific bit. + */ + public function get(int $i) : bool + { + return 0 !== ($this->bits[$i >> 5] & (1 << ($i & 0x1f))); + } + + /** + * Sets a specific bit. + */ + public function set(int $i) : void + { + $this->bits[$i >> 5] = $this->bits[$i >> 5] | 1 << ($i & 0x1f); + } + + /** + * Flips a specific bit. + */ + public function flip(int $i) : void + { + $this->bits[$i >> 5] ^= 1 << ($i & 0x1f); + } + + /** + * Gets the next set bit position from a given position. + */ + 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); + + while (0 === $currentBits) { + if (++$bitsOffset === $bitsLength) { + return $this->size; + } + + $currentBits = $this->bits[$bitsOffset]; + } + + $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits); + return $result > $this->size ? $this->size : $result; + } + + /** + * Gets the next unset bit position from a given position. + */ + public function getNextUnset(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); + + while (0 === $currentBits) { + if (++$bitsOffset === $bitsLength) { + return $this->size; + } + + $currentBits = ~$this->bits[$bitsOffset]; + } + + $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits); + return $result > $this->size ? $this->size : $result; + } + + /** + * Sets a bulk of bits. + */ + public function setBulk(int $i, int $newBits) : void + { + $this->bits[$i >> 5] = $newBits; + } + + /** + * Sets a range of bits. + * + * @throws InvalidArgumentException if end is smaller than start + */ + 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 = $end >> 5; + + for ($i = $firstInt; $i <= $lastInt; ++$i) { + $firstBit = $i > $firstInt ? 0 : $start & 0x1f; + $lastBit = $i < $lastInt ? 31 : $end & 0x1f; + + if (0 === $firstBit && 31 === $lastBit) { + $mask = 0x7fffffff; + } else { + $mask = 0; + + for ($j = $firstBit; $j < $lastBit; ++$j) { + $mask |= 1 << $j; + } + } + + $this->bits[$i] = $this->bits[$i] | $mask; + } + } + + /** + * Clears the bit array, unsetting every bit. + */ + public function clear() : void + { + $bitsLength = count($this->bits); + + for ($i = 0; $i < $bitsLength; ++$i) { + $this->bits[$i] = 0; + } + } + + /** + * Checks if a range of bits is set or not set. + + * @throws InvalidArgumentException if end is smaller than start + */ + 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; + $lastInt = $end >> 5; + + for ($i = $firstInt; $i <= $lastInt; ++$i) { + $firstBit = $i > $firstInt ? 0 : $start & 0x1f; + $lastBit = $i < $lastInt ? 31 : $end & 0x1f; + + if (0 === $firstBit && 31 === $lastBit) { + $mask = 0x7fffffff; + } else { + $mask = 0; + + for ($j = $firstBit; $j <= $lastBit; ++$j) { + $mask |= 1 << $j; + } + } + + if (($this->bits[$i] & $mask) !== ($value ? $mask : 0)) { + return false; + } + } + + return true; + } + + /** + * Appends a bit to the array. + */ + 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; + } + + /** + * Appends a number of bits (up to 32) to the array. + + * @throws InvalidArgumentException if num bits is not between 0 and 32 + */ + 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; $numBitsLeft--) { + $this->appendBit((($value >> ($numBitsLeft - 1)) & 0x01) === 1); + } + } + + /** + * Appends another bit array to this array. + */ + 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)); + } + } + + /** + * Makes an exclusive-or comparision on the current bit array. + * + * @throws InvalidArgumentException if sizes don't match + */ + 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) { + $this->bits[$i] = $this->bits[$i] ^ $otherBits[$i]; + } + } + + /** + * Converts the bit array to a byte array. + * + * @return SplFixedArray + */ + 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 - $j); + } + + ++$bitOffset; + } + + $bytes[$i] = $byte; + } + + return $bytes; + } + + /** + * Gets the internal bit array. + * + * @return SplFixedArray + */ + public function getBitArray() : SplFixedArray + { + return $this->bits; + } + + /** + * Reverses the array. + */ + 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 = $newBits; + } + + /** + * Returns a string representation of the bit array. + */ + public function __toString() : string + { + $result = ''; + + for ($i = 0; $i < $this->size; ++$i) { + if (0 === ($i & 0x07)) { + $result .= ' '; + } + + $result .= $this->get($i) ? 'X' : '.'; + } + + return $result; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php b/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php new file mode 100755 index 0000000..10bf8fe --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php @@ -0,0 +1,313 @@ + + */ + private $bits; + + /** + * @throws InvalidArgumentException if a dimension is smaller than zero + */ + public function __construct(int $width, int $height = null) + { + if (null === $height) { + $height = $width; + } + + if ($width < 1 || $height < 1) { + throw new InvalidArgumentException('Both dimensions must be greater than zero'); + } + + $this->width = $width; + $this->height = $height; + $this->rowSize = ($width + 31) >> 5; + $this->bits = SplFixedArray::fromArray(array_fill(0, $this->rowSize * $height, 0)); + } + + /** + * Gets the requested bit, where true means black. + */ + public function get(int $x, int $y) : bool + { + $offset = $y * $this->rowSize + ($x >> 5); + return 0 !== (BitUtils::unsignedRightShift($this->bits[$offset], ($x & 0x1f)) & 1); + } + + /** + * Sets the given bit to true. + */ + public function set(int $x, int $y) : void + { + $offset = $y * $this->rowSize + ($x >> 5); + $this->bits[$offset] = $this->bits[$offset] | (1 << ($x & 0x1f)); + } + + /** + * Flips the given bit. + */ + public function flip(int $x, int $y) : void + { + $offset = $y * $this->rowSize + ($x >> 5); + $this->bits[$offset] = $this->bits[$offset] ^ (1 << ($x & 0x1f)); + } + + /** + * Clears all bits (set to false). + */ + public function clear() : void + { + $max = count($this->bits); + + for ($i = 0; $i < $max; ++$i) { + $this->bits[$i] = 0; + } + } + + /** + * 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 + */ + 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 height must be at least 1'); + } + + $right = $left + $width; + $bottom = $top + $height; + + if ($bottom > $this->height || $right > $this->width) { + throw new InvalidArgumentException('The region must fit inside the matrix'); + } + + for ($y = $top; $y < $bottom; ++$y) { + $offset = $y * $this->rowSize; + + for ($x = $left; $x < $right; ++$x) { + $index = $offset + ($x >> 5); + $this->bits[$index] = $this->bits[$index] | (1 << ($x & 0x1f)); + } + } + } + + /** + * A fast method to retrieve one row of data from the matrix as a BitArray. + */ + 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, $this->bits[$offset + $x]); + } + + return $row; + } + + /** + * Sets a row of data from a BitArray. + */ + 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]; + } + } + + /** + * This is useful in detecting the enclosing rectangle of a 'pure' barcode. + * + * @return int[]|null + */ + 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->rowSize + $x32]; + + if (0 !== $bits) { + if ($y < $top) { + $top = $y; + } + + if ($y > $bottom) { + $bottom = $y; + } + + if ($x32 * 32 < $left) { + $bit = 0; + + while (($bits << (31 - $bit)) === 0) { + $bit++; + } + + if (($x32 * 32 + $bit) < $left) { + $left = $x32 * 32 + $bit; + } + } + } + + if ($x32 * 32 + 31 > $right) { + $bit = 31; + + while (0 === BitUtils::unsignedRightShift($bits, $bit)) { + --$bit; + } + + if (($x32 * 32 + $bit) > $right) { + $right = $x32 * 32 + $bit; + } + } + } + } + + $width = $right - $left; + $height = $bottom - $top; + + if ($width < 0 || $height < 0) { + return null; + } + + return [$left, $top, $width, $height]; + } + + /** + * Gets the most top left set bit. + * + * This is useful in detecting a corner of a 'pure' barcode. + * + * @return int[]|null + */ + 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, $this->rowSize); + $y = ($bitsOffset % $this->rowSize) << 5; + + $bits = $this->bits[$bitsOffset]; + $bit = 0; + + while (0 === ($bits << (31 - $bit))) { + ++$bit; + } + + $x += $bit; + + return [$x, $y]; + } + + /** + * Gets the most bottom right set bit. + * + * This is useful in detecting a corner of a 'pure' barcode. + * + * @return int[]|null + */ + public function getBottomRightOnBit() : ?array + { + $bitsOffset = count($this->bits) - 1; + + while ($bitsOffset >= 0 && 0 === $this->bits[$bitsOffset]) { + --$bitsOffset; + } + + if ($bitsOffset < 0) { + return null; + } + + $x = intdiv($bitsOffset, $this->rowSize); + $y = ($bitsOffset % $this->rowSize) << 5; + + $bits = $this->bits[$bitsOffset]; + $bit = 0; + + while (0 === BitUtils::unsignedRightShift($bits, $bit)) { + --$bit; + } + + $x += $bit; + + return [$x, $y]; + } + + /** + * Gets the width of the matrix, + */ + public function getWidth() : int + { + return $this->width; + } + + /** + * Gets the height of the matrix. + */ + public function getHeight() : int + { + return $this->height; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/BitUtils.php b/vendor/bacon/bacon-qr-code/src/Common/BitUtils.php new file mode 100755 index 0000000..0c575b4 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/BitUtils.php @@ -0,0 +1,41 @@ +>>" in other + * languages. + */ + public static function unsignedRightShift(int $a, int $b) : int + { + return ( + $a >= 0 + ? $a >> $b + : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1)) + ); + } + + /** + * Gets the number of trailing zeros. + */ + 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; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php b/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php new file mode 100755 index 0000000..6dfff17 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php @@ -0,0 +1,180 @@ +|null + */ + private static $valueToEci; + + /** + * @var array|null + */ + private static $nameToEci; + + public function __construct(array $values, string ...$otherEncodingNames) + { + $this->values = $values; + $this->otherEncodingNames = $otherEncodingNames; + } + + /** + * Returns the primary value. + */ + public function getValue() : int + { + return $this->values[0]; + } + + /** + * 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 + */ + 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)) { + return null; + } + + return $valueToEci[$value]; + } + + /** + * Returns character set ECI by name. + * + * Returns the representing ECI of a given name, or null if it is legal but unsupported + */ + public static function getCharacterSetEciByName(string $name) : ?self + { + $nameToEci = self::nameToEci(); + $name = strtolower($name); + + if (! array_key_exists($name, $nameToEci)) { + return null; + } + + return $nameToEci[$name]; + } + + private static function valueToEci() : array + { + if (null !== self::$valueToEci) { + return self::$valueToEci; + } + + self::$valueToEci = []; + + foreach (self::values() as $eci) { + foreach ($eci->values as $value) { + self::$valueToEci[$value] = $eci; + } + } + + return self::$valueToEci; + } + + private static function nameToEci() : array + { + if (null !== self::$nameToEci) { + return self::$nameToEci; + } + + self::$nameToEci = []; + + foreach (self::values() as $eci) { + self::$nameToEci[strtolower($eci->name())] = $eci; + + foreach ($eci->otherEncodingNames as $name) { + self::$nameToEci[strtolower($name)] = $eci; + } + } + + return self::$nameToEci; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php b/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php new file mode 100755 index 0000000..a9a1d07 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php @@ -0,0 +1,49 @@ +count = $count; + $this->dataCodewords = $dataCodewords; + } + + /** + * Returns how many times the block is used. + */ + public function getCount() : int + { + return $this->count; + } + + /** + * Returns the number of data codewords. + */ + public function getDataCodewords() : int + { + return $this->dataCodewords; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php b/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php new file mode 100755 index 0000000..172b5f2 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php @@ -0,0 +1,74 @@ +ecCodewordsPerBlock = $ecCodewordsPerBlock; + $this->ecBlocks = $ecBlocks; + } + + /** + * Returns the number of EC codewords per block. + */ + public function getEcCodewordsPerBlock() : int + { + return $this->ecCodewordsPerBlock; + } + + /** + * Returns the total number of EC block appearances. + */ + public function getNumBlocks() : int + { + $total = 0; + + foreach ($this->ecBlocks as $ecBlock) { + $total += $ecBlock->getCount(); + } + + return $total; + } + + /** + * Returns the total count of EC codewords. + */ + public function getTotalEcCodewords() : int + { + return $this->ecCodewordsPerBlock * $this->getNumBlocks(); + } + + /** + * Returns the EC blocks included in this collection. + * + * @return EcBlock[] + */ + public function getEcBlocks() : array + { + return $this->ecBlocks; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php b/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php new file mode 100755 index 0000000..9bbf440 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php @@ -0,0 +1,63 @@ +bits = $bits; + } + + /** + * @throws OutOfBoundsException if number of bits is invalid + */ + public static function forBits(int $bits) : self + { + switch ($bits) { + case 0: + return self::M(); + + case 1: + return self::L(); + + case 2: + return self::H(); + + case 3: + return self::Q(); + } + + throw new OutOfBoundsException('Invalid number of bits'); + } + + /** + * Returns the two bits used to encode this error correction level. + */ + public function getBits() : int + { + return $this->bits; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php b/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php new file mode 100755 index 0000000..53e3541 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php @@ -0,0 +1,203 @@ +ecLevel = ErrorCorrectionLevel::forBits(($formatInfo >> 3) & 0x3); + $this->dataMask = $formatInfo & 0x7; + } + + /** + * Checks how many bits are different between two integers. + */ + public static function numBitsDiffering(int $a, int $b) : int + { + $a ^= $b; + + return ( + self::BITS_SET_IN_HALF_BYTE[$a & 0xf] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 4) & 0xf)] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 8) & 0xf)] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 12) & 0xf)] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 16) & 0xf)] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 20) & 0xf)] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 24) & 0xf)] + + self::BITS_SET_IN_HALF_BYTE[(BitUtils::unsignedRightShift($a, 28) & 0xf)] + ); + } + + /** + * Decodes format information. + */ + public static function decodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2) : ?self + { + $formatInfo = self::doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2); + + if (null !== $formatInfo) { + return $formatInfo; + } + + // Should return null, but, some QR codes apparently do not mask this info. Try again by actually masking the + // pattern first. + return self::doDecodeFormatInformation( + $maskedFormatInfo1 ^ self::FORMAT_INFO_MASK_QR, + $maskedFormatInfo2 ^ self::FORMAT_INFO_MASK_QR + ); + } + + /** + * Internal method for decoding format information. + */ + private static function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2) : ?self + { + $bestDifference = PHP_INT_MAX; + $bestFormatInfo = 0; + + foreach (self::FORMAT_INFO_DECODE_LOOKUP as $decodeInfo) { + $targetInfo = $decodeInfo[0]; + + if ($targetInfo === $maskedFormatInfo1 || $targetInfo === $maskedFormatInfo2) { + // Found an exact match + return new self($decodeInfo[1]); + } + + $bitsDifference = self::numBitsDiffering($maskedFormatInfo1, $targetInfo); + + if ($bitsDifference < $bestDifference) { + $bestFormatInfo = $decodeInfo[1]; + $bestDifference = $bitsDifference; + } + + if ($maskedFormatInfo1 !== $maskedFormatInfo2) { + // Also try the other option + $bitsDifference = self::numBitsDiffering($maskedFormatInfo2, $targetInfo); + + if ($bitsDifference < $bestDifference) { + $bestFormatInfo = $decodeInfo[1]; + $bestDifference = $bitsDifference; + } + } + } + + // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits differing means we found a match. + if ($bestDifference <= 3) { + return new self($bestFormatInfo); + } + + return null; + } + + /** + * Returns the error correction level. + */ + public function getErrorCorrectionLevel() : ErrorCorrectionLevel + { + return $this->ecLevel; + } + + /** + * Returns the data mask. + */ + public function getDataMask() : int + { + return $this->dataMask; + } + + /** + * Hashes the code of the EC level. + */ + public function hashCode() : int + { + return ($this->ecLevel->getBits() << 3) | $this->dataMask; + } + + /** + * Verifies if this instance equals another one. + */ + public function equals(self $other) : bool + { + return ( + $this->ecLevel === $other->ecLevel + && $this->dataMask === $other->dataMask + ); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/Mode.php b/vendor/bacon/bacon-qr-code/src/Common/Mode.php new file mode 100755 index 0000000..51e6c9a --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/Mode.php @@ -0,0 +1,76 @@ +characterCountBitsForVersions = $characterCountBitsForVersions; + $this->bits = $bits; + } + + /** + * Returns the number of bits used in a specific QR code version. + */ + public function getCharacterCountBits(Version $version) : int + { + $number = $version->getVersionNumber(); + + if ($number <= 9) { + $offset = 0; + } elseif ($number <= 26) { + $offset = 1; + } else { + $offset = 2; + } + + return $this->characterCountBitsForVersions[$offset]; + } + + /** + * Returns the four bits used to encode this mode. + */ + public function getBits() : int + { + return $this->bits; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php b/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php new file mode 100755 index 0000000..a5aad0b --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php @@ -0,0 +1,468 @@ + 8) { + throw new InvalidArgumentException('Symbol size must be between 0 and 8'); + } + + if ($firstRoot < 0 || $firstRoot >= (1 << $symbolSize)) { + throw new InvalidArgumentException('First root must be between 0 and ' . (1 << $symbolSize)); + } + + if ($numRoots < 0 || $numRoots >= (1 << $symbolSize)) { + throw new InvalidArgumentException('Num roots must be between 0 and ' . (1 << $symbolSize)); + } + + if ($padding < 0 || $padding >= ((1 << $symbolSize) - 1 - $numRoots)) { + throw new InvalidArgumentException( + 'Padding must be between 0 and ' . ((1 << $symbolSize) - 1 - $numRoots) + ); + } + + $this->symbolSize = $symbolSize; + $this->blockSize = (1 << $symbolSize) - 1; + $this->padding = $padding; + $this->alphaTo = SplFixedArray::fromArray(array_fill(0, $this->blockSize + 1, 0), false); + $this->indexOf = SplFixedArray::fromArray(array_fill(0, $this->blockSize + 1, 0), false); + + // Generate galous field lookup table + $this->indexOf[0] = $this->blockSize; + $this->alphaTo[$this->blockSize] = 0; + + $sr = 1; + + for ($i = 0; $i < $this->blockSize; ++$i) { + $this->indexOf[$sr] = $i; + $this->alphaTo[$i] = $sr; + + $sr <<= 1; + + if ($sr & (1 << $symbolSize)) { + $sr ^= $gfPoly; + } + + $sr &= $this->blockSize; + } + + if (1 !== $sr) { + throw new RuntimeException('Field generator polynomial is not primitive'); + } + + // Form RS code generator polynomial from its roots + $this->generatorPoly = SplFixedArray::fromArray(array_fill(0, $numRoots + 1, 0), false); + $this->firstRoot = $firstRoot; + $this->primitive = $primitive; + $this->numRoots = $numRoots; + + // Find prim-th root of 1, used in decoding + for ($iPrimitive = 1; ($iPrimitive % $primitive) !== 0; $iPrimitive += $this->blockSize) { + } + + $this->iPrimitive = intdiv($iPrimitive, $primitive); + + $this->generatorPoly[0] = 1; + + for ($i = 0, $root = $firstRoot * $primitive; $i < $numRoots; ++$i, $root += $primitive) { + $this->generatorPoly[$i + 1] = 1; + + for ($j = $i; $j > 0; $j--) { + if ($this->generatorPoly[$j] !== 0) { + $this->generatorPoly[$j] = $this->generatorPoly[$j - 1] ^ $this->alphaTo[ + $this->modNn($this->indexOf[$this->generatorPoly[$j]] + $root) + ]; + } else { + $this->generatorPoly[$j] = $this->generatorPoly[$j - 1]; + } + } + + $this->generatorPoly[$j] = $this->alphaTo[$this->modNn($this->indexOf[$this->generatorPoly[0]] + $root)]; + } + + // Convert generator poly to index form for quicker encoding + for ($i = 0; $i <= $numRoots; ++$i) { + $this->generatorPoly[$i] = $this->indexOf[$this->generatorPoly[$i]]; + } + } + + /** + * Encodes data and writes result back into parity array. + */ + public function encode(SplFixedArray $data, SplFixedArray $parity) : void + { + for ($i = 0; $i < $this->numRoots; ++$i) { + $parity[$i] = 0; + } + + $iterations = $this->blockSize - $this->numRoots - $this->padding; + + for ($i = 0; $i < $iterations; ++$i) { + $feedback = $this->indexOf[$data[$i] ^ $parity[0]]; + + if ($feedback !== $this->blockSize) { + // Feedback term is non-zero + $feedback = $this->modNn($this->blockSize - $this->generatorPoly[$this->numRoots] + $feedback); + + for ($j = 1; $j < $this->numRoots; ++$j) { + $parity[$j] = $parity[$j] ^ $this->alphaTo[ + $this->modNn($feedback + $this->generatorPoly[$this->numRoots - $j]) + ]; + } + } + + for ($j = 0; $j < $this->numRoots - 1; ++$j) { + $parity[$j] = $parity[$j + 1]; + } + + if ($feedback !== $this->blockSize) { + $parity[$this->numRoots - 1] = $this->alphaTo[$this->modNn($feedback + $this->generatorPoly[0])]; + } else { + $parity[$this->numRoots - 1] = 0; + } + } + } + + /** + * Decodes received data. + */ + public function decode(SplFixedArray $data, SplFixedArray $erasures = null) : ?int + { + // This speeds up the initialization a bit. + $numRootsPlusOne = SplFixedArray::fromArray(array_fill(0, $this->numRoots + 1, 0), false); + $numRoots = SplFixedArray::fromArray(array_fill(0, $this->numRoots, 0), false); + + $lambda = clone $numRootsPlusOne; + $b = clone $numRootsPlusOne; + $t = clone $numRootsPlusOne; + $omega = clone $numRootsPlusOne; + $root = clone $numRoots; + $loc = clone $numRoots; + + $numErasures = (null !== $erasures ? count($erasures) : 0); + + // Form the Syndromes; i.e., evaluate data(x) at roots of g(x) + $syndromes = SplFixedArray::fromArray(array_fill(0, $this->numRoots, $data[0]), false); + + for ($i = 1; $i < $this->blockSize - $this->padding; ++$i) { + for ($j = 0; $j < $this->numRoots; ++$j) { + if ($syndromes[$j] === 0) { + $syndromes[$j] = $data[$i]; + } else { + $syndromes[$j] = $data[$i] ^ $this->alphaTo[ + $this->modNn($this->indexOf[$syndromes[$j]] + ($this->firstRoot + $j) * $this->primitive) + ]; + } + } + } + + // Convert syndromes to index form, checking for nonzero conditions + $syndromeError = 0; + + for ($i = 0; $i < $this->numRoots; ++$i) { + $syndromeError |= $syndromes[$i]; + $syndromes[$i] = $this->indexOf[$syndromes[$i]]; + } + + if (! $syndromeError) { + // If syndrome is zero, data[] is a codeword and there are no errors to correct, so return data[] + // unmodified. + return 0; + } + + $lambda[0] = 1; + + if ($numErasures > 0) { + // Init lambda to be the erasure locator polynomial + $lambda[1] = $this->alphaTo[$this->modNn($this->primitive * ($this->blockSize - 1 - $erasures[0]))]; + + for ($i = 1; $i < $numErasures; ++$i) { + $u = $this->modNn($this->primitive * ($this->blockSize - 1 - $erasures[$i])); + + for ($j = $i + 1; $j > 0; --$j) { + $tmp = $this->indexOf[$lambda[$j - 1]]; + + if ($tmp !== $this->blockSize) { + $lambda[$j] = $lambda[$j] ^ $this->alphaTo[$this->modNn($u + $tmp)]; + } + } + } + } + + for ($i = 0; $i <= $this->numRoots; ++$i) { + $b[$i] = $this->indexOf[$lambda[$i]]; + } + + // Begin Berlekamp-Massey algorithm to determine error+erasure locator polynomial + $r = $numErasures; + $el = $numErasures; + + while (++$r <= $this->numRoots) { + // Compute discrepancy at the r-th step in poly form + $discrepancyR = 0; + + for ($i = 0; $i < $r; ++$i) { + if ($lambda[$i] !== 0 && $syndromes[$r - $i - 1] !== $this->blockSize) { + $discrepancyR ^= $this->alphaTo[ + $this->modNn($this->indexOf[$lambda[$i]] + $syndromes[$r - $i - 1]) + ]; + } + } + + $discrepancyR = $this->indexOf[$discrepancyR]; + + if ($discrepancyR === $this->blockSize) { + $tmp = $b->toArray(); + array_unshift($tmp, $this->blockSize); + array_pop($tmp); + $b = SplFixedArray::fromArray($tmp, false); + continue; + } + + $t[0] = $lambda[0]; + + for ($i = 0; $i < $this->numRoots; ++$i) { + if ($b[$i] !== $this->blockSize) { + $t[$i + 1] = $lambda[$i + 1] ^ $this->alphaTo[$this->modNn($discrepancyR + $b[$i])]; + } else { + $t[$i + 1] = $lambda[$i + 1]; + } + } + + if (2 * $el <= $r + $numErasures - 1) { + $el = $r + $numErasures - $el; + + for ($i = 0; $i <= $this->numRoots; ++$i) { + $b[$i] = ( + $lambda[$i] === 0 + ? $this->blockSize + : $this->modNn($this->indexOf[$lambda[$i]] - $discrepancyR + $this->blockSize) + ); + } + } else { + $tmp = $b->toArray(); + array_unshift($tmp, $this->blockSize); + array_pop($tmp); + $b = SplFixedArray::fromArray($tmp, false); + } + + $lambda = clone $t; + } + + // Convert lambda to index form and compute deg(lambda(x)) + $degLambda = 0; + + for ($i = 0; $i <= $this->numRoots; ++$i) { + $lambda[$i] = $this->indexOf[$lambda[$i]]; + + if ($lambda[$i] !== $this->blockSize) { + $degLambda = $i; + } + } + + // Find roots of the error+erasure locator polynomial by Chien search. + $reg = clone $lambda; + $reg[0] = 0; + $count = 0; + $i = 1; + + for ($k = $this->iPrimitive - 1; $i <= $this->blockSize; ++$i, $k = $this->modNn($k + $this->iPrimitive)) { + $q = 1; + + for ($j = $degLambda; $j > 0; $j--) { + if ($reg[$j] !== $this->blockSize) { + $reg[$j] = $this->modNn($reg[$j] + $j); + $q ^= $this->alphaTo[$reg[$j]]; + } + } + + if ($q !== 0) { + // Not a root + continue; + } + + // Store root (index-form) and error location number + $root[$count] = $i; + $loc[$count] = $k; + + if (++$count === $degLambda) { + break; + } + } + + if ($degLambda !== $count) { + // deg(lambda) unequal to number of roots: uncorrectable error detected + return null; + } + + // Compute err+eras evaluate poly omega(x) = s(x)*lambda(x) (modulo x**numRoots). In index form. Also find + // deg(omega). + $degOmega = $degLambda - 1; + + for ($i = 0; $i <= $degOmega; ++$i) { + $tmp = 0; + + for ($j = $i; $j >= 0; --$j) { + if ($syndromes[$i - $j] !== $this->blockSize && $lambda[$j] !== $this->blockSize) { + $tmp ^= $this->alphaTo[$this->modNn($syndromes[$i - $j] + $lambda[$j])]; + } + } + + $omega[$i] = $this->indexOf[$tmp]; + } + + // Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = inv(X(l))**(firstRoot-1) and + // den = lambda_pr(inv(X(l))) all in poly form. + for ($j = $count - 1; $j >= 0; --$j) { + $num1 = 0; + + for ($i = $degOmega; $i >= 0; $i--) { + if ($omega[$i] !== $this->blockSize) { + $num1 ^= $this->alphaTo[$this->modNn($omega[$i] + $i * $root[$j])]; + } + } + + $num2 = $this->alphaTo[$this->modNn($root[$j] * ($this->firstRoot - 1) + $this->blockSize)]; + $den = 0; + + // lambda[i+1] for i even is the formal derivativelambda_pr of lambda[i] + for ($i = min($degLambda, $this->numRoots - 1) & ~1; $i >= 0; $i -= 2) { + if ($lambda[$i + 1] !== $this->blockSize) { + $den ^= $this->alphaTo[$this->modNn($lambda[$i + 1] + $i * $root[$j])]; + } + } + + // Apply error to data + if ($num1 !== 0 && $loc[$j] >= $this->padding) { + $data[$loc[$j] - $this->padding] = $data[$loc[$j] - $this->padding] ^ ( + $this->alphaTo[ + $this->modNn( + $this->indexOf[$num1] + $this->indexOf[$num2] + $this->blockSize - $this->indexOf[$den] + ) + ] + ); + } + } + + if (null !== $erasures) { + if (count($erasures) < $count) { + $erasures->setSize($count); + } + + for ($i = 0; $i < $count; $i++) { + $erasures[$i] = $loc[$i]; + } + } + + return $count; + } + + /** + * Computes $x % GF_SIZE, where GF_SIZE is 2**GF_BITS - 1, without a slow divide. + */ + private function modNn(int $x) : int + { + while ($x >= $this->blockSize) { + $x -= $this->blockSize; + $x = ($x >> $this->symbolSize) + ($x & $this->blockSize); + } + + return $x; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Common/Version.php b/vendor/bacon/bacon-qr-code/src/Common/Version.php new file mode 100755 index 0000000..917d048 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Common/Version.php @@ -0,0 +1,596 @@ +|null + */ + private static $versions; + + /** + * @param int[] $alignmentPatternCenters + */ + private function __construct( + int $versionNumber, + array $alignmentPatternCenters, + EcBlocks ...$ecBlocks + ) { + $this->versionNumber = $versionNumber; + $this->alignmentPatternCenters = $alignmentPatternCenters; + $this->ecBlocks = $ecBlocks; + + $totalCodewords = 0; + $ecCodewords = $ecBlocks[0]->getEcCodewordsPerBlock(); + + foreach ($ecBlocks[0]->getEcBlocks() as $ecBlock) { + $totalCodewords += $ecBlock->getCount() * ($ecBlock->getDataCodewords() + $ecCodewords); + } + + $this->totalCodewords = $totalCodewords; + } + + /** + * Returns the version number. + */ + public function getVersionNumber() : int + { + return $this->versionNumber; + } + + /** + * Returns the alignment pattern centers. + * + * @return int[] + */ + public function getAlignmentPatternCenters() : array + { + return $this->alignmentPatternCenters; + } + + /** + * Returns the total number of codewords. + */ + public function getTotalCodewords() : int + { + return $this->totalCodewords; + } + + /** + * Calculates the dimension for the current version. + */ + public function getDimensionForVersion() : int + { + return 17 + 4 * $this->versionNumber; + } + + /** + * Returns the number of EC blocks for a specific EC level. + */ + public function getEcBlocksForLevel(ErrorCorrectionLevel $ecLevel) : EcBlocks + { + return $this->ecBlocks[$ecLevel->ordinal()]; + } + + /** + * Gets a provisional version number for a specific dimension. + * + * @throws InvalidArgumentException if dimension is not 1 mod 4 + */ + 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)); + } + + /** + * Gets a version instance for a specific version number. + * + * @throws InvalidArgumentException if version number is out of range + */ + 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]; + } + + /** + * Decodes version information from an integer and returns the version. + */ + 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 + 7); + } + + $bitsDifference = FormatInformation::numBitsDiffering($versionBits, $targetVersion); + + if ($bitsDifference < $bestDifference) { + $bestVersion = $i + 7; + $bestDifference = $bitsDifference; + } + } + + if ($bestDifference <= 3) { + return self::getVersionForNumber($bestVersion); + } + + return null; + } + + /** + * Builds the function pattern for the current version. + */ + 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 + $bitMatrix->setRegion($dimension - 8, 0, 8, 9); + // Bottom left finder pattern + separator + format + $bitMatrix->setRegion(0, $dimension - 8, 9, 8); + + // Alignment patterns + $max = count($this->alignmentPatternCenters); + + for ($x = 0; $x < $max; ++$x) { + $i = $this->alignmentPatternCenters[$x] - 2; + + for ($y = 0; $y < $max; ++$y) { + if (($x === 0 && ($y === 0 || $y === $max - 1)) || ($x === $max - 1 && $y === 0)) { + // No alignment patterns near the three finder paterns + continue; + } + + $bitMatrix->setRegion($this->alignmentPatternCenters[$y] - 2, $i, 5, 5); + } + } + + // Vertical timing pattern + $bitMatrix->setRegion(6, 9, 1, $dimension - 17); + // Horizontal timing pattern + $bitMatrix->setRegion(9, 6, $dimension - 17, 1); + + if ($this->versionNumber > 6) { + // Version info, top right + $bitMatrix->setRegion($dimension - 11, 0, 3, 6); + // Version info, bottom left + $bitMatrix->setRegion(0, $dimension - 11, 6, 3); + } + + return $bitMatrix; + } + + /** + * Returns a string representation for the version. + */ + public function __toString() : string + { + return (string) $this->versionNumber; + } + + /** + * Build and cache a specific version. + * + * See ISO 18004:2006 6.5.1 Table 9. + * + * @return array + */ + 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, new EcBlock(1, 16)), + new EcBlocks(13, new EcBlock(1, 13)), + new EcBlocks(17, new EcBlock(1, 9)) + ), + new self( + 2, + [6, 18], + new EcBlocks(10, new EcBlock(1, 34)), + new EcBlocks(16, new EcBlock(1, 28)), + new EcBlocks(22, new EcBlock(1, 22)), + new EcBlocks(28, new EcBlock(1, 16)) + ), + new self( + 3, + [6, 22], + new EcBlocks(15, new EcBlock(1, 55)), + new EcBlocks(26, new EcBlock(1, 44)), + new EcBlocks(18, new EcBlock(2, 17)), + new EcBlocks(22, new EcBlock(2, 13)) + ), + new self( + 4, + [6, 26], + new EcBlocks(20, new EcBlock(1, 80)), + new EcBlocks(18, new EcBlock(2, 32)), + new EcBlocks(26, new EcBlock(3, 24)), + new EcBlocks(16, new EcBlock(4, 9)) + ), + new self( + 5, + [6, 30], + new EcBlocks(26, new EcBlock(1, 108)), + new EcBlocks(24, new EcBlock(2, 43)), + new EcBlocks(18, new EcBlock(2, 15), new EcBlock(2, 16)), + new EcBlocks(22, new EcBlock(2, 11), new EcBlock(2, 12)) + ), + new self( + 6, + [6, 34], + new EcBlocks(18, new EcBlock(2, 68)), + new EcBlocks(16, new EcBlock(4, 27)), + new EcBlocks(24, new EcBlock(4, 19)), + new EcBlocks(28, new EcBlock(4, 15)) + ), + new self( + 7, + [6, 22, 38], + new EcBlocks(20, new EcBlock(2, 78)), + new EcBlocks(18, new EcBlock(4, 31)), + new EcBlocks(18, new EcBlock(2, 14), new EcBlock(4, 15)), + new EcBlocks(26, new EcBlock(4, 13), new EcBlock(1, 14)) + ), + new self( + 8, + [6, 24, 42], + new EcBlocks(24, new EcBlock(2, 97)), + new EcBlocks(22, new EcBlock(2, 38), new EcBlock(2, 39)), + new EcBlocks(22, new EcBlock(4, 18), new EcBlock(2, 19)), + new EcBlocks(26, new EcBlock(4, 14), new EcBlock(2, 15)) + ), + new self( + 9, + [6, 26, 46], + new EcBlocks(30, new EcBlock(2, 116)), + new EcBlocks(22, new EcBlock(3, 36), new EcBlock(2, 37)), + new EcBlocks(20, new EcBlock(4, 16), new EcBlock(4, 17)), + new EcBlocks(24, new EcBlock(4, 12), new EcBlock(4, 13)) + ), + new self( + 10, + [6, 28, 50], + new EcBlocks(18, new EcBlock(2, 68), new EcBlock(2, 69)), + new EcBlocks(26, new EcBlock(4, 43), new EcBlock(1, 44)), + new EcBlocks(24, new EcBlock(6, 19), new EcBlock(2, 20)), + new EcBlocks(28, new EcBlock(6, 15), new EcBlock(2, 16)) + ), + new self( + 11, + [6, 30, 54], + new EcBlocks(20, new EcBlock(4, 81)), + new EcBlocks(30, new EcBlock(1, 50), new EcBlock(4, 51)), + new EcBlocks(28, new EcBlock(4, 22), new EcBlock(4, 23)), + new EcBlocks(24, new EcBlock(3, 12), new EcBlock(8, 13)) + ), + new self( + 12, + [6, 32, 58], + new EcBlocks(24, new EcBlock(2, 92), new EcBlock(2, 93)), + new EcBlocks(22, new EcBlock(6, 36), new EcBlock(2, 37)), + new EcBlocks(26, new EcBlock(4, 20), new EcBlock(6, 21)), + new EcBlocks(28, new EcBlock(7, 14), new EcBlock(4, 15)) + ), + new self( + 13, + [6, 34, 62], + new EcBlocks(26, new EcBlock(4, 107)), + new EcBlocks(22, new EcBlock(8, 37), new EcBlock(1, 38)), + new EcBlocks(24, new EcBlock(8, 20), new EcBlock(4, 21)), + new EcBlocks(22, new EcBlock(12, 11), new EcBlock(4, 12)) + ), + new self( + 14, + [6, 26, 46, 66], + new EcBlocks(30, new EcBlock(3, 115), new EcBlock(1, 116)), + new EcBlocks(24, new EcBlock(4, 40), new EcBlock(5, 41)), + new EcBlocks(20, new EcBlock(11, 16), new EcBlock(5, 17)), + new EcBlocks(24, new EcBlock(11, 12), new EcBlock(5, 13)) + ), + new self( + 15, + [6, 26, 48, 70], + new EcBlocks(22, new EcBlock(5, 87), new EcBlock(1, 88)), + new EcBlocks(24, new EcBlock(5, 41), new EcBlock(5, 42)), + new EcBlocks(30, new EcBlock(5, 24), new EcBlock(7, 25)), + new EcBlocks(24, new EcBlock(11, 12), new EcBlock(7, 13)) + ), + new self( + 16, + [6, 26, 50, 74], + new EcBlocks(24, new EcBlock(5, 98), new EcBlock(1, 99)), + new EcBlocks(28, new EcBlock(7, 45), new EcBlock(3, 46)), + new EcBlocks(24, new EcBlock(15, 19), new EcBlock(2, 20)), + new EcBlocks(30, new EcBlock(3, 15), new EcBlock(13, 16)) + ), + new self( + 17, + [6, 30, 54, 78], + new EcBlocks(28, new EcBlock(1, 107), new EcBlock(5, 108)), + new EcBlocks(28, new EcBlock(10, 46), new EcBlock(1, 47)), + new EcBlocks(28, new EcBlock(1, 22), new EcBlock(15, 23)), + new EcBlocks(28, new EcBlock(2, 14), new EcBlock(17, 15)) + ), + new self( + 18, + [6, 30, 56, 82], + new EcBlocks(30, new EcBlock(5, 120), new EcBlock(1, 121)), + new EcBlocks(26, new EcBlock(9, 43), new EcBlock(4, 44)), + new EcBlocks(28, new EcBlock(17, 22), new EcBlock(1, 23)), + new EcBlocks(28, new EcBlock(2, 14), new EcBlock(19, 15)) + ), + new self( + 19, + [6, 30, 58, 86], + new EcBlocks(28, new EcBlock(3, 113), new EcBlock(4, 114)), + new EcBlocks(26, new EcBlock(3, 44), new EcBlock(11, 45)), + new EcBlocks(26, new EcBlock(17, 21), new EcBlock(4, 22)), + new EcBlocks(26, new EcBlock(9, 13), new EcBlock(16, 14)) + ), + new self( + 20, + [6, 34, 62, 90], + new EcBlocks(28, new EcBlock(3, 107), new EcBlock(5, 108)), + new EcBlocks(26, new EcBlock(3, 41), new EcBlock(13, 42)), + new EcBlocks(30, new EcBlock(15, 24), new EcBlock(5, 25)), + new EcBlocks(28, new EcBlock(15, 15), new EcBlock(10, 16)) + ), + new self( + 21, + [6, 28, 50, 72, 94], + new EcBlocks(28, new EcBlock(4, 116), new EcBlock(4, 117)), + new EcBlocks(26, new EcBlock(17, 42)), + new EcBlocks(28, new EcBlock(17, 22), new EcBlock(6, 23)), + new EcBlocks(30, new EcBlock(19, 16), new EcBlock(6, 17)) + ), + new self( + 22, + [6, 26, 50, 74, 98], + new EcBlocks(28, new EcBlock(2, 111), new EcBlock(7, 112)), + new EcBlocks(28, new EcBlock(17, 46)), + new EcBlocks(30, new EcBlock(7, 24), new EcBlock(16, 25)), + new EcBlocks(24, new EcBlock(34, 13)) + ), + new self( + 23, + [6, 30, 54, 78, 102], + new EcBlocks(30, new EcBlock(4, 121), new EcBlock(5, 122)), + new EcBlocks(28, new EcBlock(4, 47), new EcBlock(14, 48)), + new EcBlocks(30, new EcBlock(11, 24), new EcBlock(14, 25)), + new EcBlocks(30, new EcBlock(16, 15), new EcBlock(14, 16)) + ), + new self( + 24, + [6, 28, 54, 80, 106], + new EcBlocks(30, new EcBlock(6, 117), new EcBlock(4, 118)), + new EcBlocks(28, new EcBlock(6, 45), new EcBlock(14, 46)), + new EcBlocks(30, new EcBlock(11, 24), new EcBlock(16, 25)), + new EcBlocks(30, new EcBlock(30, 16), new EcBlock(2, 17)) + ), + new self( + 25, + [6, 32, 58, 84, 110], + new EcBlocks(26, new EcBlock(8, 106), new EcBlock(4, 107)), + new EcBlocks(28, new EcBlock(8, 47), new EcBlock(13, 48)), + new EcBlocks(30, new EcBlock(7, 24), new EcBlock(22, 25)), + new EcBlocks(30, new EcBlock(22, 15), new EcBlock(13, 16)) + ), + new self( + 26, + [6, 30, 58, 86, 114], + new EcBlocks(28, new EcBlock(10, 114), new EcBlock(2, 115)), + new EcBlocks(28, new EcBlock(19, 46), new EcBlock(4, 47)), + new EcBlocks(28, new EcBlock(28, 22), new EcBlock(6, 23)), + new EcBlocks(30, new EcBlock(33, 16), new EcBlock(4, 17)) + ), + new self( + 27, + [6, 34, 62, 90, 118], + new EcBlocks(30, new EcBlock(8, 122), new EcBlock(4, 123)), + new EcBlocks(28, new EcBlock(22, 45), new EcBlock(3, 46)), + new EcBlocks(30, new EcBlock(8, 23), new EcBlock(26, 24)), + new EcBlocks(30, new EcBlock(12, 15), new EcBlock(28, 16)) + ), + new self( + 28, + [6, 26, 50, 74, 98, 122], + new EcBlocks(30, new EcBlock(3, 117), new EcBlock(10, 118)), + new EcBlocks(28, new EcBlock(3, 45), new EcBlock(23, 46)), + new EcBlocks(30, new EcBlock(4, 24), new EcBlock(31, 25)), + new EcBlocks(30, new EcBlock(11, 15), new EcBlock(31, 16)) + ), + new self( + 29, + [6, 30, 54, 78, 102, 126], + new EcBlocks(30, new EcBlock(7, 116), new EcBlock(7, 117)), + new EcBlocks(28, new EcBlock(21, 45), new EcBlock(7, 46)), + new EcBlocks(30, new EcBlock(1, 23), new EcBlock(37, 24)), + new EcBlocks(30, new EcBlock(19, 15), new EcBlock(26, 16)) + ), + new self( + 30, + [6, 26, 52, 78, 104, 130], + new EcBlocks(30, new EcBlock(5, 115), new EcBlock(10, 116)), + new EcBlocks(28, new EcBlock(19, 47), new EcBlock(10, 48)), + new EcBlocks(30, new EcBlock(15, 24), new EcBlock(25, 25)), + new EcBlocks(30, new EcBlock(23, 15), new EcBlock(25, 16)) + ), + new self( + 31, + [6, 30, 56, 82, 108, 134], + new EcBlocks(30, new EcBlock(13, 115), new EcBlock(3, 116)), + new EcBlocks(28, new EcBlock(2, 46), new EcBlock(29, 47)), + new EcBlocks(30, new EcBlock(42, 24), new EcBlock(1, 25)), + new EcBlocks(30, new EcBlock(23, 15), new EcBlock(28, 16)) + ), + new self( + 32, + [6, 34, 60, 86, 112, 138], + new EcBlocks(30, new EcBlock(17, 115)), + new EcBlocks(28, new EcBlock(10, 46), new EcBlock(23, 47)), + new EcBlocks(30, new EcBlock(10, 24), new EcBlock(35, 25)), + new EcBlocks(30, new EcBlock(19, 15), new EcBlock(35, 16)) + ), + new self( + 33, + [6, 30, 58, 86, 114, 142], + new EcBlocks(30, new EcBlock(17, 115), new EcBlock(1, 116)), + new EcBlocks(28, new EcBlock(14, 46), new EcBlock(21, 47)), + new EcBlocks(30, new EcBlock(29, 24), new EcBlock(19, 25)), + new EcBlocks(30, new EcBlock(11, 15), new EcBlock(46, 16)) + ), + new self( + 34, + [6, 34, 62, 90, 118, 146], + new EcBlocks(30, new EcBlock(13, 115), new EcBlock(6, 116)), + new EcBlocks(28, new EcBlock(14, 46), new EcBlock(23, 47)), + new EcBlocks(30, new EcBlock(44, 24), new EcBlock(7, 25)), + new EcBlocks(30, new EcBlock(59, 16), new EcBlock(1, 17)) + ), + new self( + 35, + [6, 30, 54, 78, 102, 126, 150], + new EcBlocks(30, new EcBlock(12, 121), new EcBlock(7, 122)), + new EcBlocks(28, new EcBlock(12, 47), new EcBlock(26, 48)), + new EcBlocks(30, new EcBlock(39, 24), new EcBlock(14, 25)), + new EcBlocks(30, new EcBlock(22, 15), new EcBlock(41, 16)) + ), + new self( + 36, + [6, 24, 50, 76, 102, 128, 154], + new EcBlocks(30, new EcBlock(6, 121), new EcBlock(14, 122)), + new EcBlocks(28, new EcBlock(6, 47), new EcBlock(34, 48)), + new EcBlocks(30, new EcBlock(46, 24), new EcBlock(10, 25)), + new EcBlocks(30, new EcBlock(2, 15), new EcBlock(64, 16)) + ), + new self( + 37, + [6, 28, 54, 80, 106, 132, 158], + new EcBlocks(30, new EcBlock(17, 122), new EcBlock(4, 123)), + new EcBlocks(28, new EcBlock(29, 46), new EcBlock(14, 47)), + new EcBlocks(30, new EcBlock(49, 24), new EcBlock(10, 25)), + new EcBlocks(30, new EcBlock(24, 15), new EcBlock(46, 16)) + ), + new self( + 38, + [6, 32, 58, 84, 110, 136, 162], + new EcBlocks(30, new EcBlock(4, 122), new EcBlock(18, 123)), + new EcBlocks(28, new EcBlock(13, 46), new EcBlock(32, 47)), + new EcBlocks(30, new EcBlock(48, 24), new EcBlock(14, 25)), + new EcBlocks(30, new EcBlock(42, 15), new EcBlock(32, 16)) + ), + new self( + 39, + [6, 26, 54, 82, 110, 138, 166], + new EcBlocks(30, new EcBlock(20, 117), new EcBlock(4, 118)), + new EcBlocks(28, new EcBlock(40, 47), new EcBlock(7, 48)), + new EcBlocks(30, new EcBlock(43, 24), new EcBlock(22, 25)), + new EcBlocks(30, new EcBlock(10, 15), new EcBlock(67, 16)) + ), + new self( + 40, + [6, 30, 58, 86, 114, 142, 170], + new EcBlocks(30, new EcBlock(19, 118), new EcBlock(6, 119)), + new EcBlocks(28, new EcBlock(18, 47), new EcBlock(31, 48)), + new EcBlocks(30, new EcBlock(34, 24), new EcBlock(34, 25)), + new EcBlocks(30, new EcBlock(20, 15), new EcBlock(61, 16)) + ), + ]; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php b/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php new file mode 100755 index 0000000..be54afa --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php @@ -0,0 +1,58 @@ + + */ + private $dataBytes; + + /** + * Error correction bytes in the block. + * + * @var SplFixedArray + */ + private $errorCorrectionBytes; + + /** + * Creates a new block pair. + * + * @param SplFixedArray $data + * @param SplFixedArray $errorCorrection + */ + public function __construct(SplFixedArray $data, SplFixedArray $errorCorrection) + { + $this->dataBytes = $data; + $this->errorCorrectionBytes = $errorCorrection; + } + + /** + * Gets the data bytes. + * + * @return SplFixedArray + */ + public function getDataBytes() : SplFixedArray + { + return $this->dataBytes; + } + + /** + * Gets the error correction bytes. + * + * @return SplFixedArray + */ + public function getErrorCorrectionBytes() : SplFixedArray + { + return $this->errorCorrectionBytes; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php b/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php new file mode 100755 index 0000000..b58cc0a --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php @@ -0,0 +1,150 @@ +> + */ + private $bytes; + + /** + * Width of the matrix. + * + * @var int + */ + private $width; + + /** + * Height of the matrix. + * + * @var int + */ + private $height; + + public function __construct(int $width, int $height) + { + $this->height = $height; + $this->width = $width; + $this->bytes = new SplFixedArray($height); + + for ($y = 0; $y < $height; ++$y) { + $this->bytes[$y] = SplFixedArray::fromArray(array_fill(0, $width, 0)); + } + } + + /** + * Gets the width of the matrix. + */ + public function getWidth() : int + { + return $this->width; + } + + /** + * Gets the height of the matrix. + */ + public function getHeight() : int + { + return $this->height; + } + + /** + * Gets the internal representation of the matrix. + * + * @return SplFixedArray> + */ + public function getArray() : SplFixedArray + { + return $this->bytes; + } + + /** + * @return Traversable + */ + public function getBytes() : Traversable + { + foreach ($this->bytes as $row) { + foreach ($row as $byte) { + yield $byte; + } + } + } + + /** + * Gets the byte for a specific position. + */ + public function get(int $x, int $y) : int + { + return $this->bytes[$y][$x]; + } + + /** + * Sets the byte for a specific position. + */ + public function set(int $x, int $y, int $value) : void + { + $this->bytes[$y][$x] = $value; + } + + /** + * Clears the matrix with a specific value. + */ + public function clear(int $value) : void + { + for ($y = 0; $y < $this->height; ++$y) { + for ($x = 0; $x < $this->width; ++$x) { + $this->bytes[$y][$x] = $value; + } + } + } + + public function __clone() + { + $this->bytes = clone $this->bytes; + + foreach ($this->bytes as $index => $row) { + $this->bytes[$index] = clone $row; + } + } + + /** + * Returns a string representation of the matrix. + */ + public function __toString() : string + { + $result = ''; + + for ($y = 0; $y < $this->height; $y++) { + for ($x = 0; $x < $this->width; $x++) { + switch ($this->bytes[$y][$x]) { + case 0: + $result .= ' 0'; + break; + + case 1: + $result .= ' 1'; + break; + + default: + $result .= ' '; + break; + } + } + + $result .= "\n"; + } + + return $result; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php b/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php new file mode 100755 index 0000000..cf4fde0 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php @@ -0,0 +1,668 @@ +getSize() + + $mode->getCharacterCountBits(Version::getVersionForNumber(1)) + + $dataBits->getSize(); + $provisionalVersion = self::chooseVersion($provisionalBitsNeeded, $ecLevel); + + // Use that guess to calculate the right version. I am still not sure + // this works in 100% of cases. + $bitsNeeded = $headerBits->getSize() + + $mode->getCharacterCountBits($provisionalVersion) + + $dataBits->getSize(); + $version = self::chooseVersion($bitsNeeded, $ecLevel); + + if (null !== $forcedVersion) { + // Forced version check + if ($version->getVersionNumber() <= $forcedVersion->getVersionNumber()) { + // Calculated minimum version is same or equal as forced version + $version = $forcedVersion; + } else { + throw new WriterException( + 'Invalid version! Calculated version: ' + . $version->getVersionNumber() + . ', requested version: ' + . $forcedVersion->getVersionNumber() + ); + } + } + + $headerAndDataBits = new BitArray(); + $headerAndDataBits->appendBitArray($headerBits); + + // Find "length" of main segment and write it. + $numLetters = (Mode::BYTE() === $mode ? $dataBits->getSizeInBytes() : strlen($content)); + self::appendLengthInfo($numLetters, $version, $mode, $headerAndDataBits); + + // Put data together into the overall payload. + $headerAndDataBits->appendBitArray($dataBits); + $ecBlocks = $version->getEcBlocksForLevel($ecLevel); + $numDataBytes = $version->getTotalCodewords() - $ecBlocks->getTotalEcCodewords(); + + // Terminate the bits properly. + self::terminateBits($numDataBytes, $headerAndDataBits); + + // Interleave data bits with error correction code. + $finalBits = self::interleaveWithEcBytes( + $headerAndDataBits, + $version->getTotalCodewords(), + $numDataBytes, + $ecBlocks->getNumBlocks() + ); + + // Choose the mask pattern. + $dimension = $version->getDimensionForVersion(); + $matrix = new ByteMatrix($dimension, $dimension); + $maskPattern = self::chooseMaskPattern($finalBits, $ecLevel, $version, $matrix); + + // Build the matrix. + MatrixUtil::buildMatrix($finalBits, $ecLevel, $version, $maskPattern, $matrix); + + return new QrCode($mode, $ecLevel, $version, $maskPattern, $matrix); + } + + /** + * Gets the alphanumeric code for a byte. + */ + private static function getAlphanumericCode(int $code) : int + { + if (isset(self::ALPHANUMERIC_TABLE[$code])) { + return self::ALPHANUMERIC_TABLE[$code]; + } + + return -1; + } + + /** + * Chooses the best mode for a given content. + */ + private static function chooseMode(string $content, string $encoding = null) : Mode + { + if (null !== $encoding && 0 === strcasecmp($encoding, 'SHIFT-JIS')) { + return self::isOnlyDoubleByteKanji($content) ? Mode::KANJI() : Mode::BYTE(); + } + + $hasNumeric = false; + $hasAlphanumeric = false; + $contentLength = strlen($content); + + for ($i = 0; $i < $contentLength; ++$i) { + $char = $content[$i]; + + if (ctype_digit($char)) { + $hasNumeric = true; + } elseif (-1 !== self::getAlphanumericCode(ord($char))) { + $hasAlphanumeric = true; + } else { + return Mode::BYTE(); + } + } + + if ($hasAlphanumeric) { + return Mode::ALPHANUMERIC(); + } elseif ($hasNumeric) { + return Mode::NUMERIC(); + } + + return Mode::BYTE(); + } + + /** + * Calculates the mask penalty for a matrix. + */ + private static function calculateMaskPenalty(ByteMatrix $matrix) : int + { + return ( + MaskUtil::applyMaskPenaltyRule1($matrix) + + MaskUtil::applyMaskPenaltyRule2($matrix) + + MaskUtil::applyMaskPenaltyRule3($matrix) + + MaskUtil::applyMaskPenaltyRule4($matrix) + ); + } + + /** + * Checks if content only consists of double-byte kanji characters. + */ + private static function isOnlyDoubleByteKanji(string $content) : bool + { + $bytes = @iconv('utf-8', 'SHIFT-JIS', $content); + + if (false === $bytes) { + return false; + } + + $length = strlen($bytes); + + if (0 !== $length % 2) { + return false; + } + + for ($i = 0; $i < $length; $i += 2) { + $byte = $bytes[$i] & 0xff; + + if (($byte < 0x81 || $byte > 0x9f) && $byte < 0xe0 || $byte > 0xeb) { + return false; + } + } + + return true; + } + + /** + * Chooses the best mask pattern for a matrix. + */ + private static function chooseMaskPattern( + BitArray $bits, + ErrorCorrectionLevel $ecLevel, + Version $version, + ByteMatrix $matrix + ) : int { + $minPenalty = PHP_INT_MAX; + $bestMaskPattern = -1; + + for ($maskPattern = 0; $maskPattern < QrCode::NUM_MASK_PATTERNS; ++$maskPattern) { + MatrixUtil::buildMatrix($bits, $ecLevel, $version, $maskPattern, $matrix); + $penalty = self::calculateMaskPenalty($matrix); + + if ($penalty < $minPenalty) { + $minPenalty = $penalty; + $bestMaskPattern = $maskPattern; + } + } + + return $bestMaskPattern; + } + + /** + * Chooses the best version for the input. + * + * @throws WriterException if data is too big + */ + private static function chooseVersion(int $numInputBits, ErrorCorrectionLevel $ecLevel) : Version + { + for ($versionNum = 1; $versionNum <= 40; ++$versionNum) { + $version = Version::getVersionForNumber($versionNum); + $numBytes = $version->getTotalCodewords(); + + $ecBlocks = $version->getEcBlocksForLevel($ecLevel); + $numEcBytes = $ecBlocks->getTotalEcCodewords(); + + $numDataBytes = $numBytes - $numEcBytes; + $totalInputBytes = intdiv($numInputBits + 8, 8); + + if ($numDataBytes >= $totalInputBytes) { + return $version; + } + } + + throw new WriterException('Data too big'); + } + + /** + * Terminates the bits in a bit array. + * + * @throws WriterException if data bits cannot fit in the QR code + * @throws WriterException if bits size does not equal the capacity + */ + private static function terminateBits(int $numDataBytes, BitArray $bits) : void + { + $capacity = $numDataBytes << 3; + + if ($bits->getSize() > $capacity) { + throw new WriterException('Data bits cannot fit in the QR code'); + } + + for ($i = 0; $i < 4 && $bits->getSize() < $capacity; ++$i) { + $bits->appendBit(false); + } + + $numBitsInLastByte = $bits->getSize() & 0x7; + + if ($numBitsInLastByte > 0) { + for ($i = $numBitsInLastByte; $i < 8; ++$i) { + $bits->appendBit(false); + } + } + + $numPaddingBytes = $numDataBytes - $bits->getSizeInBytes(); + + for ($i = 0; $i < $numPaddingBytes; ++$i) { + $bits->appendBits(0 === ($i & 0x1) ? 0xec : 0x11, 8); + } + + if ($bits->getSize() !== $capacity) { + throw new WriterException('Bits size does not equal capacity'); + } + } + + /** + * Gets number of data- and EC bytes for a block ID. + * + * @return int[] + * @throws WriterException if block ID is too large + * @throws WriterException if EC bytes mismatch + * @throws WriterException if RS blocks mismatch + * @throws WriterException if total bytes mismatch + */ + private static function getNumDataBytesAndNumEcBytesForBlockId( + int $numTotalBytes, + int $numDataBytes, + int $numRsBlocks, + int $blockId + ) : array { + if ($blockId >= $numRsBlocks) { + throw new WriterException('Block ID too large'); + } + + $numRsBlocksInGroup2 = $numTotalBytes % $numRsBlocks; + $numRsBlocksInGroup1 = $numRsBlocks - $numRsBlocksInGroup2; + $numTotalBytesInGroup1 = intdiv($numTotalBytes, $numRsBlocks); + $numTotalBytesInGroup2 = $numTotalBytesInGroup1 + 1; + $numDataBytesInGroup1 = intdiv($numDataBytes, $numRsBlocks); + $numDataBytesInGroup2 = $numDataBytesInGroup1 + 1; + $numEcBytesInGroup1 = $numTotalBytesInGroup1 - $numDataBytesInGroup1; + $numEcBytesInGroup2 = $numTotalBytesInGroup2 - $numDataBytesInGroup2; + + if ($numEcBytesInGroup1 !== $numEcBytesInGroup2) { + throw new WriterException('EC bytes mismatch'); + } + + if ($numRsBlocks !== $numRsBlocksInGroup1 + $numRsBlocksInGroup2) { + throw new WriterException('RS blocks mismatch'); + } + + if ($numTotalBytes !== + (($numDataBytesInGroup1 + $numEcBytesInGroup1) * $numRsBlocksInGroup1) + + (($numDataBytesInGroup2 + $numEcBytesInGroup2) * $numRsBlocksInGroup2) + ) { + throw new WriterException('Total bytes mismatch'); + } + + if ($blockId < $numRsBlocksInGroup1) { + return [$numDataBytesInGroup1, $numEcBytesInGroup1]; + } else { + return [$numDataBytesInGroup2, $numEcBytesInGroup2]; + } + } + + /** + * Interleaves data with EC bytes. + * + * @throws WriterException if number of bits and data bytes does not match + * @throws WriterException if data bytes does not match offset + * @throws WriterException if an interleaving error occurs + */ + private static function interleaveWithEcBytes( + BitArray $bits, + int $numTotalBytes, + int $numDataBytes, + int $numRsBlocks + ) : BitArray { + if ($bits->getSizeInBytes() !== $numDataBytes) { + throw new WriterException('Number of bits and data bytes does not match'); + } + + $dataBytesOffset = 0; + $maxNumDataBytes = 0; + $maxNumEcBytes = 0; + + $blocks = new SplFixedArray($numRsBlocks); + + for ($i = 0; $i < $numRsBlocks; ++$i) { + list($numDataBytesInBlock, $numEcBytesInBlock) = self::getNumDataBytesAndNumEcBytesForBlockId( + $numTotalBytes, + $numDataBytes, + $numRsBlocks, + $i + ); + + $size = $numDataBytesInBlock; + $dataBytes = $bits->toBytes(8 * $dataBytesOffset, $size); + $ecBytes = self::generateEcBytes($dataBytes, $numEcBytesInBlock); + $blocks[$i] = new BlockPair($dataBytes, $ecBytes); + + $maxNumDataBytes = max($maxNumDataBytes, $size); + $maxNumEcBytes = max($maxNumEcBytes, count($ecBytes)); + $dataBytesOffset += $numDataBytesInBlock; + } + + if ($numDataBytes !== $dataBytesOffset) { + throw new WriterException('Data bytes does not match offset'); + } + + $result = new BitArray(); + + for ($i = 0; $i < $maxNumDataBytes; ++$i) { + foreach ($blocks as $block) { + $dataBytes = $block->getDataBytes(); + + if ($i < count($dataBytes)) { + $result->appendBits($dataBytes[$i], 8); + } + } + } + + for ($i = 0; $i < $maxNumEcBytes; ++$i) { + foreach ($blocks as $block) { + $ecBytes = $block->getErrorCorrectionBytes(); + + if ($i < count($ecBytes)) { + $result->appendBits($ecBytes[$i], 8); + } + } + } + + if ($numTotalBytes !== $result->getSizeInBytes()) { + throw new WriterException( + 'Interleaving error: ' . $numTotalBytes . ' and ' . $result->getSizeInBytes() . ' differ' + ); + } + + return $result; + } + + /** + * Generates EC bytes for given data. + * + * @param SplFixedArray $dataBytes + * @return SplFixedArray + */ + private static function generateEcBytes(SplFixedArray $dataBytes, int $numEcBytesInBlock) : SplFixedArray + { + $numDataBytes = count($dataBytes); + $toEncode = new SplFixedArray($numDataBytes + $numEcBytesInBlock); + + for ($i = 0; $i < $numDataBytes; $i++) { + $toEncode[$i] = $dataBytes[$i] & 0xff; + } + + $ecBytes = new SplFixedArray($numEcBytesInBlock); + $codec = self::getCodec($numDataBytes, $numEcBytesInBlock); + $codec->encode($toEncode, $ecBytes); + + return $ecBytes; + } + + /** + * Gets an RS codec and caches it. + */ + private static function getCodec(int $numDataBytes, int $numEcBytesInBlock) : ReedSolomonCodec + { + $cacheId = $numDataBytes . '-' . $numEcBytesInBlock; + + if (isset(self::$codecs[$cacheId])) { + return self::$codecs[$cacheId]; + } + + return self::$codecs[$cacheId] = new ReedSolomonCodec( + 8, + 0x11d, + 0, + 1, + $numEcBytesInBlock, + 255 - $numDataBytes - $numEcBytesInBlock + ); + } + + /** + * Appends mode information to a bit array. + */ + private static function appendModeInfo(Mode $mode, BitArray $bits) : void + { + $bits->appendBits($mode->getBits(), 4); + } + + /** + * Appends length information to a bit array. + * + * @throws WriterException if num letters is bigger than expected + */ + private static function appendLengthInfo(int $numLetters, Version $version, Mode $mode, BitArray $bits) : void + { + $numBits = $mode->getCharacterCountBits($version); + + if ($numLetters >= (1 << $numBits)) { + throw new WriterException($numLetters . ' is bigger than ' . ((1 << $numBits) - 1)); + } + + $bits->appendBits($numLetters, $numBits); + } + + /** + * Appends bytes to a bit array in a specific mode. + * + * @throws WriterException if an invalid mode was supplied + */ + private static function appendBytes(string $content, Mode $mode, BitArray $bits, string $encoding) : void + { + switch ($mode) { + case Mode::NUMERIC(): + self::appendNumericBytes($content, $bits); + break; + + case Mode::ALPHANUMERIC(): + self::appendAlphanumericBytes($content, $bits); + break; + + case Mode::BYTE(): + self::append8BitBytes($content, $bits, $encoding); + break; + + case Mode::KANJI(): + self::appendKanjiBytes($content, $bits); + break; + + default: + throw new WriterException('Invalid mode: ' . $mode); + } + } + + /** + * Appends numeric bytes to a bit array. + */ + private static function appendNumericBytes(string $content, BitArray $bits) : void + { + $length = strlen($content); + $i = 0; + + while ($i < $length) { + $num1 = (int) $content[$i]; + + if ($i + 2 < $length) { + // Encode three numeric letters in ten bits. + $num2 = (int) $content[$i + 1]; + $num3 = (int) $content[$i + 2]; + $bits->appendBits($num1 * 100 + $num2 * 10 + $num3, 10); + $i += 3; + } elseif ($i + 1 < $length) { + // Encode two numeric letters in seven bits. + $num2 = (int) $content[$i + 1]; + $bits->appendBits($num1 * 10 + $num2, 7); + $i += 2; + } else { + // Encode one numeric letter in four bits. + $bits->appendBits($num1, 4); + ++$i; + } + } + } + + /** + * Appends alpha-numeric bytes to a bit array. + * + * @throws WriterException if an invalid alphanumeric code was found + */ + private static function appendAlphanumericBytes(string $content, BitArray $bits) : void + { + $length = strlen($content); + $i = 0; + + while ($i < $length) { + $code1 = self::getAlphanumericCode(ord($content[$i])); + + if (-1 === $code1) { + throw new WriterException('Invalid alphanumeric code'); + } + + if ($i + 1 < $length) { + $code2 = self::getAlphanumericCode(ord($content[$i + 1])); + + if (-1 === $code2) { + throw new WriterException('Invalid alphanumeric code'); + } + + // Encode two alphanumeric letters in 11 bits. + $bits->appendBits($code1 * 45 + $code2, 11); + $i += 2; + } else { + // Encode one alphanumeric letter in six bits. + $bits->appendBits($code1, 6); + ++$i; + } + } + } + + /** + * Appends regular 8-bit bytes to a bit array. + * + * @throws WriterException if content cannot be encoded to target encoding + */ + private static function append8BitBytes(string $content, BitArray $bits, string $encoding) : void + { + $bytes = @iconv('utf-8', $encoding, $content); + + if (false === $bytes) { + throw new WriterException('Could not encode content to ' . $encoding); + } + + $length = strlen($bytes); + + for ($i = 0; $i < $length; $i++) { + $bits->appendBits(ord($bytes[$i]), 8); + } + } + + /** + * Appends KANJI bytes to a bit array. + * + * @throws WriterException if content does not seem to be encoded in SHIFT-JIS + * @throws WriterException if an invalid byte sequence occurs + */ + private static function appendKanjiBytes(string $content, BitArray $bits) : void + { + if (strlen($content) % 2 > 0) { + // We just do a simple length check here. The for loop will check + // individual characters. + throw new WriterException('Content does not seem to be encoded in SHIFT-JIS'); + } + + $length = strlen($content); + + for ($i = 0; $i < $length; $i += 2) { + $byte1 = ord($content[$i]) & 0xff; + $byte2 = ord($content[$i + 1]) & 0xff; + $code = ($byte1 << 8) | $byte2; + + if ($code >= 0x8140 && $code <= 0x9ffc) { + $subtracted = $code - 0x8140; + } elseif ($code >= 0xe040 && $code <= 0xebbf) { + $subtracted = $code - 0xc140; + } else { + throw new WriterException('Invalid byte sequence'); + } + + $encoded = (($subtracted >> 8) * 0xc0) + ($subtracted & 0xff); + + $bits->appendBits($encoded, 13); + } + } + + /** + * Appends ECI information to a bit array. + */ + private static function appendEci(CharacterSetEci $eci, BitArray $bits) : void + { + $mode = Mode::ECI(); + $bits->appendBits($mode->getBits(), 4); + $bits->appendBits($eci->getValue(), 8); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php b/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php new file mode 100755 index 0000000..ba97dfb --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php @@ -0,0 +1,271 @@ +getArray(); + $width = $matrix->getWidth(); + $height = $matrix->getHeight(); + + for ($y = 0; $y < $height - 1; ++$y) { + for ($x = 0; $x < $width - 1; ++$x) { + $value = $array[$y][$x]; + + if ($value === $array[$y][$x + 1] + && $value === $array[$y + 1][$x] + && $value === $array[$y + 1][$x + 1] + ) { + ++$penalty; + } + } + } + + return self::N2 * $penalty; + } + + /** + * 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). + */ + 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) { + if ($x + 6 < $width + && 1 === $array[$y][$x] + && 0 === $array[$y][$x + 1] + && 1 === $array[$y][$x + 2] + && 1 === $array[$y][$x + 3] + && 1 === $array[$y][$x + 4] + && 0 === $array[$y][$x + 5] + && 1 === $array[$y][$x + 6] + && ( + ( + $x + 10 < $width + && 0 === $array[$y][$x + 7] + && 0 === $array[$y][$x + 8] + && 0 === $array[$y][$x + 9] + && 0 === $array[$y][$x + 10] + ) + || ( + $x - 4 >= 0 + && 0 === $array[$y][$x - 1] + && 0 === $array[$y][$x - 2] + && 0 === $array[$y][$x - 3] + && 0 === $array[$y][$x - 4] + ) + ) + ) { + $penalty += self::N3; + } + + if ($y + 6 < $height + && 1 === $array[$y][$x] + && 0 === $array[$y + 1][$x] + && 1 === $array[$y + 2][$x] + && 1 === $array[$y + 3][$x] + && 1 === $array[$y + 4][$x] + && 0 === $array[$y + 5][$x] + && 1 === $array[$y + 6][$x] + && ( + ( + $y + 10 < $height + && 0 === $array[$y + 7][$x] + && 0 === $array[$y + 8][$x] + && 0 === $array[$y + 9][$x] + && 0 === $array[$y + 10][$x] + ) + || ( + $y - 4 >= 0 + && 0 === $array[$y - 1][$x] + && 0 === $array[$y - 2][$x] + && 0 === $array[$y - 3][$x] + && 0 === $array[$y - 4][$x] + ) + ) + ) { + $penalty += self::N3; + } + } + } + + return $penalty; + } + + /** + * 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. + */ + 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 = 0; $x < $width; ++$x) { + if (1 === $arrayY[$x]) { + ++$numDarkCells; + } + } + } + + $numTotalCells = $height * $width; + $darkRatio = $numDarkCells / $numTotalCells; + $fixedPercentVariances = (int) (abs($darkRatio - 0.5) * 20); + + return $fixedPercentVariances * self::N4; + } + + /** + * 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 + */ + 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: + $intermediate = $x % 3; + break; + + case 3: + $intermediate = ($y + $x) % 3; + break; + + case 4: + $intermediate = (BitUtils::unsignedRightShift($y, 1) + (int) ($x / 3)) & 0x1; + break; + + case 5: + $temp = $y * $x; + $intermediate = ($temp & 0x1) + ($temp % 3); + break; + + case 6: + $temp = $y * $x; + $intermediate = (($temp & 0x1) + ($temp % 3)) & 0x1; + break; + + case 7: + $temp = $y * $x; + $intermediate = (($temp % 3) + (($y + $x) & 0x1)) & 0x1; + break; + + default: + throw new InvalidArgumentException('Invalid mask pattern: ' . $maskPattern); + } + + return 0 == $intermediate; + } + + /** + * Helper function for applyMaskPenaltyRule1. + * + * We need this for doing this calculation in both vertical and horizontal + * orders respectively. + */ + 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(); + + for ($i = 0; $i < $iLimit; ++$i) { + $numSameBitCells = 0; + $prevBit = -1; + + for ($j = 0; $j < $jLimit; $j++) { + $bit = $isHorizontal ? $array[$i][$j] : $array[$j][$i]; + + if ($bit === $prevBit) { + ++$numSameBitCells; + } else { + if ($numSameBitCells >= 5) { + $penalty += self::N1 + ($numSameBitCells - 5); + } + + $numSameBitCells = 1; + $prevBit = $bit; + } + } + + if ($numSameBitCells >= 5) { + $penalty += self::N1 + ($numSameBitCells - 5); + } + } + + return $penalty; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Encoder/MatrixUtil.php b/vendor/bacon/bacon-qr-code/src/Encoder/MatrixUtil.php new file mode 100755 index 0000000..0967e29 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Encoder/MatrixUtil.php @@ -0,0 +1,513 @@ +clear(-1); + } + + /** + * Builds a complete matrix. + */ + public static function buildMatrix( + BitArray $dataBits, + ErrorCorrectionLevel $level, + Version $version, + int $maskPattern, + ByteMatrix $matrix + ) : void { + self::clearMatrix($matrix); + self::embedBasicPatterns($version, $matrix); + self::embedTypeInfo($level, $maskPattern, $matrix); + self::maybeEmbedVersionInfo($version, $matrix); + self::embedDataBits($dataBits, $maskPattern, $matrix); + } + + /** + * Removes the position detection patterns from a matrix. + * + * This can be useful if you need to render those patterns separately. + */ + public static function removePositionDetectionPatterns(ByteMatrix $matrix) : void + { + $pdpWidth = count(self::POSITION_DETECTION_PATTERN[0]); + + self::removePositionDetectionPattern(0, 0, $matrix); + self::removePositionDetectionPattern($matrix->getWidth() - $pdpWidth, 0, $matrix); + self::removePositionDetectionPattern(0, $matrix->getWidth() - $pdpWidth, $matrix); + } + + /** + * Embeds type information into a matrix. + */ + private static function embedTypeInfo(ErrorCorrectionLevel $level, int $maskPattern, ByteMatrix $matrix) : void + { + $typeInfoBits = new BitArray(); + self::makeTypeInfoBits($level, $maskPattern, $typeInfoBits); + + $typeInfoBitsSize = $typeInfoBits->getSize(); + + for ($i = 0; $i < $typeInfoBitsSize; ++$i) { + $bit = $typeInfoBits->get($typeInfoBitsSize - 1 - $i); + + $x1 = self::TYPE_INFO_COORDINATES[$i][0]; + $y1 = self::TYPE_INFO_COORDINATES[$i][1]; + + $matrix->set($x1, $y1, (int) $bit); + + if ($i < 8) { + $x2 = $matrix->getWidth() - $i - 1; + $y2 = 8; + } else { + $x2 = 8; + $y2 = $matrix->getHeight() - 7 + ($i - 8); + } + + $matrix->set($x2, $y2, (int) $bit); + } + } + + /** + * Generates type information bits and appends them to a bit array. + * + * @throws RuntimeException if bit array resulted in invalid size + */ + private static function makeTypeInfoBits(ErrorCorrectionLevel $level, int $maskPattern, BitArray $bits) : void + { + $typeInfo = ($level->getBits() << 3) | $maskPattern; + $bits->appendBits($typeInfo, 5); + + $bchCode = self::calculateBchCode($typeInfo, self::TYPE_INFO_POLY); + $bits->appendBits($bchCode, 10); + + $maskBits = new BitArray(); + $maskBits->appendBits(self::TYPE_INFO_MASK_PATTERN, 15); + $bits->xorBits($maskBits); + + if (15 !== $bits->getSize()) { + throw new RuntimeException('Bit array resulted in invalid size: ' . $bits->getSize()); + } + } + + /** + * Embeds version information if required. + */ + private static function maybeEmbedVersionInfo(Version $version, ByteMatrix $matrix) : void + { + if ($version->getVersionNumber() < 7) { + return; + } + + $versionInfoBits = new BitArray(); + self::makeVersionInfoBits($version, $versionInfoBits); + + $bitIndex = 6 * 3 - 1; + + for ($i = 0; $i < 6; ++$i) { + for ($j = 0; $j < 3; ++$j) { + $bit = $versionInfoBits->get($bitIndex); + --$bitIndex; + + $matrix->set($i, $matrix->getHeight() - 11 + $j, (int) $bit); + $matrix->set($matrix->getHeight() - 11 + $j, $i, (int) $bit); + } + } + } + + /** + * Generates version information bits and appends them to a bit array. + * + * @throws RuntimeException if bit array resulted in invalid size + */ + private static function makeVersionInfoBits(Version $version, BitArray $bits) : void + { + $bits->appendBits($version->getVersionNumber(), 6); + + $bchCode = self::calculateBchCode($version->getVersionNumber(), self::VERSION_INFO_POLY); + $bits->appendBits($bchCode, 12); + + if (18 !== $bits->getSize()) { + throw new RuntimeException('Bit array resulted in invalid size: ' . $bits->getSize()); + } + } + + /** + * Calculates the BCH code for a value and a polynomial. + */ + private static function calculateBchCode(int $value, int $poly) : int + { + $msbSetInPoly = self::findMsbSet($poly); + $value <<= $msbSetInPoly - 1; + + while (self::findMsbSet($value) >= $msbSetInPoly) { + $value ^= $poly << (self::findMsbSet($value) - $msbSetInPoly); + } + + return $value; + } + + /** + * Finds and MSB set. + */ + private static function findMsbSet(int $value) : int + { + $numDigits = 0; + + while (0 !== $value) { + $value >>= 1; + ++$numDigits; + } + + return $numDigits; + } + + /** + * Embeds basic patterns into a matrix. + */ + private static function embedBasicPatterns(Version $version, ByteMatrix $matrix) : void + { + self::embedPositionDetectionPatternsAndSeparators($matrix); + self::embedDarkDotAtLeftBottomCorner($matrix); + self::maybeEmbedPositionAdjustmentPatterns($version, $matrix); + self::embedTimingPatterns($matrix); + } + + /** + * Embeds position detection patterns and separators into a byte matrix. + */ + private static function embedPositionDetectionPatternsAndSeparators(ByteMatrix $matrix) : void + { + $pdpWidth = count(self::POSITION_DETECTION_PATTERN[0]); + + self::embedPositionDetectionPattern(0, 0, $matrix); + self::embedPositionDetectionPattern($matrix->getWidth() - $pdpWidth, 0, $matrix); + self::embedPositionDetectionPattern(0, $matrix->getWidth() - $pdpWidth, $matrix); + + $hspWidth = 8; + + self::embedHorizontalSeparationPattern(0, $hspWidth - 1, $matrix); + self::embedHorizontalSeparationPattern($matrix->getWidth() - $hspWidth, $hspWidth - 1, $matrix); + self::embedHorizontalSeparationPattern(0, $matrix->getWidth() - $hspWidth, $matrix); + + $vspSize = 7; + + self::embedVerticalSeparationPattern($vspSize, 0, $matrix); + self::embedVerticalSeparationPattern($matrix->getHeight() - $vspSize - 1, 0, $matrix); + self::embedVerticalSeparationPattern($vspSize, $matrix->getHeight() - $vspSize, $matrix); + } + + /** + * Embeds a single position detection pattern into a byte matrix. + */ + private static function embedPositionDetectionPattern(int $xStart, int $yStart, ByteMatrix $matrix) : void + { + for ($y = 0; $y < 7; ++$y) { + for ($x = 0; $x < 7; ++$x) { + $matrix->set($xStart + $x, $yStart + $y, self::POSITION_DETECTION_PATTERN[$y][$x]); + } + } + } + + private static function removePositionDetectionPattern(int $xStart, int $yStart, ByteMatrix $matrix) : void + { + for ($y = 0; $y < 7; ++$y) { + for ($x = 0; $x < 7; ++$x) { + $matrix->set($xStart + $x, $yStart + $y, 0); + } + } + } + + /** + * Embeds a single horizontal separation pattern. + * + * @throws RuntimeException if a byte was already set + */ + private static function embedHorizontalSeparationPattern(int $xStart, int $yStart, ByteMatrix $matrix) : void + { + for ($x = 0; $x < 8; $x++) { + if (-1 !== $matrix->get($xStart + $x, $yStart)) { + throw new RuntimeException('Byte already set'); + } + + $matrix->set($xStart + $x, $yStart, 0); + } + } + + /** + * Embeds a single vertical separation pattern. + * + * @throws RuntimeException if a byte was already set + */ + private static function embedVerticalSeparationPattern(int $xStart, int $yStart, ByteMatrix $matrix) : void + { + for ($y = 0; $y < 7; $y++) { + if (-1 !== $matrix->get($xStart, $yStart + $y)) { + throw new RuntimeException('Byte already set'); + } + + $matrix->set($xStart, $yStart + $y, 0); + } + } + + /** + * Embeds a dot at the left bottom corner. + * + * @throws RuntimeException if a byte was already set to 0 + */ + private static function embedDarkDotAtLeftBottomCorner(ByteMatrix $matrix) : void + { + if (0 === $matrix->get(8, $matrix->getHeight() - 8)) { + throw new RuntimeException('Byte already set to 0'); + } + + $matrix->set(8, $matrix->getHeight() - 8, 1); + } + + /** + * Embeds position adjustment patterns if required. + */ + private static function maybeEmbedPositionAdjustmentPatterns(Version $version, ByteMatrix $matrix) : void + { + if ($version->getVersionNumber() < 2) { + return; + } + + $index = $version->getVersionNumber() - 1; + + $coordinates = self::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[$index]; + $numCoordinates = count($coordinates); + + for ($i = 0; $i < $numCoordinates; ++$i) { + for ($j = 0; $j < $numCoordinates; ++$j) { + $y = $coordinates[$i]; + $x = $coordinates[$j]; + + if (null === $x || null === $y) { + continue; + } + + if (-1 === $matrix->get($x, $y)) { + self::embedPositionAdjustmentPattern($x - 2, $y - 2, $matrix); + } + } + } + } + + /** + * Embeds a single position adjustment pattern. + */ + private static function embedPositionAdjustmentPattern(int $xStart, int $yStart, ByteMatrix $matrix) : void + { + for ($y = 0; $y < 5; $y++) { + for ($x = 0; $x < 5; $x++) { + $matrix->set($xStart + $x, $yStart + $y, self::POSITION_ADJUSTMENT_PATTERN[$y][$x]); + } + } + } + + /** + * Embeds timing patterns into a matrix. + */ + private static function embedTimingPatterns(ByteMatrix $matrix) : void + { + $matrixWidth = $matrix->getWidth(); + + for ($i = 8; $i < $matrixWidth - 8; ++$i) { + $bit = ($i + 1) % 2; + + if (-1 === $matrix->get($i, 6)) { + $matrix->set($i, 6, $bit); + } + + if (-1 === $matrix->get(6, $i)) { + $matrix->set(6, $i, $bit); + } + } + } + + /** + * Embeds "dataBits" using "getMaskPattern". + * + * For debugging purposes, it skips masking process if "getMaskPattern" is -1. See 8.7 of JISX0510:2004 (p.38) for + * how to embed data bits. + * + * @throws WriterException if not all bits could be consumed + */ + private static function embedDataBits(BitArray $dataBits, int $maskPattern, ByteMatrix $matrix) : void + { + $bitIndex = 0; + $direction = -1; + + // Start from the right bottom cell. + $x = $matrix->getWidth() - 1; + $y = $matrix->getHeight() - 1; + + while ($x > 0) { + // Skip vertical timing pattern. + if (6 === $x) { + --$x; + } + + while ($y >= 0 && $y < $matrix->getHeight()) { + for ($i = 0; $i < 2; $i++) { + $xx = $x - $i; + + // Skip the cell if it's not empty. + if (-1 !== $matrix->get($xx, $y)) { + continue; + } + + if ($bitIndex < $dataBits->getSize()) { + $bit = $dataBits->get($bitIndex); + ++$bitIndex; + } else { + // Padding bit. If there is no bit left, we'll fill the + // left cells with 0, as described in 8.4.9 of + // JISX0510:2004 (p. 24). + $bit = false; + } + + // Skip masking if maskPattern is -1. + if (-1 !== $maskPattern && MaskUtil::getDataMaskBit($maskPattern, $xx, $y)) { + $bit = ! $bit; + } + + $matrix->set($xx, $y, (int) $bit); + } + + $y += $direction; + } + + $direction = -$direction; + $y += $direction; + $x -= 2; + } + + // All bits should be consumed + if ($dataBits->getSize() !== $bitIndex) { + throw new WriterException('Not all bits consumed (' . $bitIndex . ' out of ' . $dataBits->getSize() .')'); + } + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php b/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php new file mode 100755 index 0000000..f568e88 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php @@ -0,0 +1,141 @@ +mode = $mode; + $this->errorCorrectionLevel = $errorCorrectionLevel; + $this->version = $version; + $this->maskPattern = $maskPattern; + $this->matrix = $matrix; + } + + /** + * Gets the mode. + */ + public function getMode() : Mode + { + return $this->mode; + } + + /** + * Gets the EC level. + */ + public function getErrorCorrectionLevel() : ErrorCorrectionLevel + { + return $this->errorCorrectionLevel; + } + + /** + * Gets the version. + */ + public function getVersion() : Version + { + return $this->version; + } + + /** + * Gets the mask pattern. + */ + public function getMaskPattern() : int + { + return $this->maskPattern; + } + + /** + * Gets the matrix. + * + * @return ByteMatrix + */ + public function getMatrix() + { + return $this->matrix; + } + + /** + * Validates whether a mask pattern is valid. + */ + public static function isValidMaskPattern(int $maskPattern) : bool + { + return $maskPattern > 0 && $maskPattern < self::NUM_MASK_PATTERNS; + } + + /** + * Returns a string representation of the QR code. + */ + public function __toString() : string + { + $result = "<<\n" + . ' mode: ' . $this->mode . "\n" + . ' ecLevel: ' . $this->errorCorrectionLevel . "\n" + . ' version: ' . $this->version . "\n" + . ' maskPattern: ' . $this->maskPattern . "\n"; + + if ($this->matrix === null) { + $result .= " matrix: null\n"; + } else { + $result .= " matrix:\n"; + $result .= $this->matrix; + } + + $result .= ">>\n"; + + return $result; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Exception/ExceptionInterface.php b/vendor/bacon/bacon-qr-code/src/Exception/ExceptionInterface.php new file mode 100755 index 0000000..6f70c20 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Exception/ExceptionInterface.php @@ -0,0 +1,10 @@ + 100) { + throw new Exception\InvalidArgumentException('Alpha must be between 0 and 100'); + } + + $this->alpha = $alpha; + $this->baseColor = $baseColor; + } + + public function getAlpha() : int + { + return $this->alpha; + } + + public function getBaseColor() : ColorInterface + { + return $this->baseColor; + } + + public function toRgb() : Rgb + { + return $this->baseColor->toRgb(); + } + + public function toCmyk() : Cmyk + { + return $this->baseColor->toCmyk(); + } + + public function toGray() : Gray + { + return $this->baseColor->toGray(); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php b/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php new file mode 100755 index 0000000..d6de390 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php @@ -0,0 +1,103 @@ + 100) { + throw new Exception\InvalidArgumentException('Cyan must be between 0 and 100'); + } + + if ($magenta < 0 || $magenta > 100) { + throw new Exception\InvalidArgumentException('Magenta must be between 0 and 100'); + } + + if ($yellow < 0 || $yellow > 100) { + throw new Exception\InvalidArgumentException('Yellow must be between 0 and 100'); + } + + if ($black < 0 || $black > 100) { + throw new Exception\InvalidArgumentException('Black must be between 0 and 100'); + } + + $this->cyan = $cyan; + $this->magenta = $magenta; + $this->yellow = $yellow; + $this->black = $black; + } + + public function getCyan() : int + { + return $this->cyan; + } + + public function getMagenta() : int + { + return $this->magenta; + } + + public function getYellow() : int + { + return $this->yellow; + } + + public function getBlack() : int + { + return $this->black; + } + + public function toRgb() : Rgb + { + $k = $this->black / 100; + $c = (-$k * $this->cyan + $k * 100 + $this->cyan) / 100; + $m = (-$k * $this->magenta + $k * 100 + $this->magenta) / 100; + $y = (-$k * $this->yellow + $k * 100 + $this->yellow) / 100; + + return new Rgb( + (int) (-$c * 255 + 255), + (int) (-$m * 255 + 255), + (int) (-$y * 255 + 255) + ); + } + + public function toCmyk() : Cmyk + { + return $this; + } + + public function toGray() : Gray + { + return $this->toRgb()->toGray(); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Color/ColorInterface.php b/vendor/bacon/bacon-qr-code/src/Renderer/Color/ColorInterface.php new file mode 100755 index 0000000..b50d1ca --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Color/ColorInterface.php @@ -0,0 +1,22 @@ + 100) { + throw new Exception\InvalidArgumentException('Gray must be between 0 and 100'); + } + + $this->gray = (int) $gray; + } + + public function getGray() : int + { + return $this->gray; + } + + public function toRgb() : Rgb + { + return new Rgb((int) ($this->gray * 2.55), (int) ($this->gray * 2.55), (int) ($this->gray * 2.55)); + } + + public function toCmyk() : Cmyk + { + return new Cmyk(0, 0, 0, 100 - $this->gray); + } + + public function toGray() : Gray + { + return $this; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php b/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php new file mode 100755 index 0000000..7935406 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php @@ -0,0 +1,88 @@ + 255) { + throw new Exception\InvalidArgumentException('Red must be between 0 and 255'); + } + + if ($green < 0 || $green > 255) { + throw new Exception\InvalidArgumentException('Green must be between 0 and 255'); + } + + if ($blue < 0 || $blue > 255) { + throw new Exception\InvalidArgumentException('Blue must be between 0 and 255'); + } + + $this->red = $red; + $this->green = $green; + $this->blue = $blue; + } + + public function getRed() : int + { + return $this->red; + } + + public function getGreen() : int + { + return $this->green; + } + + public function getBlue() : int + { + return $this->blue; + } + + public function toRgb() : Rgb + { + return $this; + } + + public function toCmyk() : Cmyk + { + $c = 1 - ($this->red / 255); + $m = 1 - ($this->green / 255); + $y = 1 - ($this->blue / 255); + $k = min($c, $m, $y); + + return new Cmyk( + (int) (100 * ($c - $k) / (1 - $k)), + (int) (100 * ($m - $k) / (1 - $k)), + (int) (100 * ($y - $k) / (1 - $k)), + (int) (100 * $k) + ); + } + + public function toGray() : Gray + { + return new Gray((int) (($this->red * 0.21 + $this->green * 0.71 + $this->blue * 0.07) / 2.55)); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php new file mode 100755 index 0000000..0d03125 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php @@ -0,0 +1,38 @@ +externalEye = $externalEye; + $this->internalEye = $internalEye; + } + + public function getExternalPath() : Path + { + return $this->externalEye->getExternalPath(); + } + + public function getInternalPath() : Path + { + return $this->internalEye->getInternalPath(); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Eye/EyeInterface.php b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/EyeInterface.php new file mode 100755 index 0000000..ab68f3c --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/EyeInterface.php @@ -0,0 +1,26 @@ +module = $module; + } + + public function getExternalPath() : Path + { + $matrix = new ByteMatrix(7, 7); + + for ($x = 0; $x < 7; ++$x) { + $matrix->set($x, 0, 1); + $matrix->set($x, 6, 1); + } + + for ($y = 1; $y < 6; ++$y) { + $matrix->set(0, $y, 1); + $matrix->set(6, $y, 1); + } + + return $this->module->createPath($matrix)->translate(-3.5, -3.5); + } + + public function getInternalPath() : Path + { + $matrix = new ByteMatrix(3, 3); + + for ($x = 0; $x < 3; ++$x) { + for ($y = 0; $y < 3; ++$y) { + $matrix->set($x, $y, 1); + } + } + + return $this->module->createPath($matrix)->translate(-1.5, -1.5); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php new file mode 100755 index 0000000..64d54ee --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php @@ -0,0 +1,54 @@ +move(-3.5, -3.5) + ->line(3.5, -3.5) + ->line(3.5, 3.5) + ->line(-3.5, 3.5) + ->close() + ->move(-2.5, -2.5) + ->line(-2.5, 2.5) + ->line(2.5, 2.5) + ->line(2.5, -2.5) + ->close() + ; + } + + public function getInternalPath() : Path + { + return (new Path()) + ->move(1.5, 0) + ->ellipticArc(1.5, 1.5, 0., false, true, 0., 1.5) + ->ellipticArc(1.5, 1.5, 0., false, true, -1.5, 0.) + ->ellipticArc(1.5, 1.5, 0., false, true, 0., -1.5) + ->ellipticArc(1.5, 1.5, 0., false, true, 1.5, 0.) + ->close() + ; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php new file mode 100755 index 0000000..a3892b4 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php @@ -0,0 +1,53 @@ +move(-3.5, -3.5) + ->line(3.5, -3.5) + ->line(3.5, 3.5) + ->line(-3.5, 3.5) + ->close() + ->move(-2.5, -2.5) + ->line(-2.5, 2.5) + ->line(2.5, 2.5) + ->line(2.5, -2.5) + ->close() + ; + } + + public function getInternalPath() : Path + { + return (new Path()) + ->move(-1.5, -1.5) + ->line(1.5, -1.5) + ->line(1.5, 1.5) + ->line(-1.5, 1.5) + ->close() + ; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php b/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php new file mode 100755 index 0000000..b581b54 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php @@ -0,0 +1,376 @@ +eps = "%!PS-Adobe-3.0 EPSF-3.0\n" + . "%%Creator: BaconQrCode\n" + . sprintf("%%%%BoundingBox: 0 0 %d %d \n", $size, $size) + . "%%BeginProlog\n" + . "save\n" + . "50 dict begin\n" + . "/q { gsave } bind def\n" + . "/Q { grestore } bind def\n" + . "/s { scale } bind def\n" + . "/t { translate } bind def\n" + . "/r { rotate } bind def\n" + . "/n { newpath } bind def\n" + . "/m { moveto } bind def\n" + . "/l { lineto } bind def\n" + . "/c { curveto } bind def\n" + . "/z { closepath } bind def\n" + . "/f { eofill } bind def\n" + . "/rgb { setrgbcolor } bind def\n" + . "/cmyk { setcmykcolor } bind def\n" + . "/gray { setgray } bind def\n" + . "%%EndProlog\n" + . "1 -1 s\n" + . sprintf("0 -%d t\n", $size); + + if ($backgroundColor instanceof Alpha && 0 === $backgroundColor->getAlpha()) { + return; + } + + $this->eps .= wordwrap( + '0 0 m' + . sprintf(' %s 0 l', (string) $size) + . sprintf(' %s %s l', (string) $size, (string) $size) + . sprintf(' 0 %s l', (string) $size) + . ' z' + . ' ' .$this->getColorSetString($backgroundColor) . " f\n", + 75, + "\n " + ); + } + + public function scale(float $size) : void + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $this->eps .= sprintf("%1\$s %1\$s s\n", round($size, self::PRECISION)); + } + + public function translate(float $x, float $y) : void + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $this->eps .= sprintf("%s %s t\n", round($x, self::PRECISION), round($y, self::PRECISION)); + } + + public function rotate(int $degrees) : void + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $this->eps .= sprintf("%d r\n", $degrees); + } + + public function push() : void + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $this->eps .= "q\n"; + } + + public function pop() : void + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $this->eps .= "Q\n"; + } + + public function drawPathWithColor(Path $path, ColorInterface $color) : void + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $fromX = 0; + $fromY = 0; + $this->eps .= wordwrap( + 'n ' + . $this->drawPathOperations($path, $fromX, $fromY) + . ' ' . $this->getColorSetString($color) . " f\n", + 75, + "\n " + ); + } + + public function drawPathWithGradient( + Path $path, + Gradient $gradient, + float $x, + float $y, + float $width, + float $height + ) : void { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $fromX = 0; + $fromY = 0; + $this->eps .= wordwrap( + 'q n ' . $this->drawPathOperations($path, $fromX, $fromY) . "\n", + 75, + "\n " + ); + + $this->createGradientFill($gradient, $x, $y, $width, $height); + } + + public function done() : string + { + if (null === $this->eps) { + throw new RuntimeException('No image has been started'); + } + + $this->eps .= "%%TRAILER\nend restore\n%%EOF"; + $blob = $this->eps; + $this->eps = null; + + return $blob; + } + + private function drawPathOperations(Iterable $ops, &$fromX, &$fromY) : string + { + $pathData = []; + + foreach ($ops as $op) { + switch (true) { + case $op instanceof Move: + $fromX = $toX = round($op->getX(), self::PRECISION); + $fromY = $toY = round($op->getY(), self::PRECISION); + $pathData[] = sprintf('%s %s m', $toX, $toY); + break; + + case $op instanceof Line: + $fromX = $toX = round($op->getX(), self::PRECISION); + $fromY = $toY = round($op->getY(), self::PRECISION); + $pathData[] = sprintf('%s %s l', $toX, $toY); + break; + + case $op instanceof EllipticArc: + $pathData[] = $this->drawPathOperations($op->toCurves($fromX, $fromY), $fromX, $fromY); + break; + + case $op instanceof Curve: + $x1 = round($op->getX1(), self::PRECISION); + $y1 = round($op->getY1(), self::PRECISION); + $x2 = round($op->getX2(), self::PRECISION); + $y2 = round($op->getY2(), self::PRECISION); + $fromX = $x3 = round($op->getX3(), self::PRECISION); + $fromY = $y3 = round($op->getY3(), self::PRECISION); + $pathData[] = sprintf('%s %s %s %s %s %s c', $x1, $y1, $x2, $y2, $x3, $y3); + break; + + case $op instanceof Close: + $pathData[] = 'z'; + break; + + default: + throw new RuntimeException('Unexpected draw operation: ' . get_class($op)); + } + } + + return implode(' ', $pathData); + } + + private function createGradientFill(Gradient $gradient, float $x, float $y, float $width, float $height) : void + { + $startColor = $gradient->getStartColor(); + $endColor = $gradient->getEndColor(); + + if ($startColor instanceof Alpha) { + $startColor = $startColor->getBaseColor(); + } + + $startColorType = get_class($startColor); + + if (! in_array($startColorType, [Rgb::class, Cmyk::class, Gray::class])) { + $startColorType = Cmyk::class; + $startColor = $startColor->toCmyk(); + } + + if (get_class($endColor) !== $startColorType) { + switch ($startColorType) { + case Cmyk::class: + $endColor = $endColor->toCmyk(); + break; + + case Rgb::class: + $endColor = $endColor->toRgb(); + break; + + case Gray::class: + $endColor = $endColor->toGray(); + break; + } + } + + $this->eps .= "eoclip\n<<\n"; + + if ($gradient->getType() === GradientType::RADIAL()) { + $this->eps .= " /ShadingType 3\n"; + } else { + $this->eps .= " /ShadingType 2\n"; + } + + $this->eps .= " /Extend [ true true ]\n" + . " /AntiAlias true\n"; + + switch ($startColorType) { + case Cmyk::class: + $this->eps .= " /ColorSpace /DeviceCMYK\n"; + break; + + case Rgb::class: + $this->eps .= " /ColorSpace /DeviceRGB\n"; + break; + + case Gray::class: + $this->eps .= " /ColorSpace /DeviceGray\n"; + break; + } + + switch ($gradient->getType()) { + case GradientType::HORIZONTAL(): + $this->eps .= sprintf( + " /Coords [ %s %s %s %s ]\n", + round($x, self::PRECISION), + round($y, self::PRECISION), + round($x + $width, self::PRECISION), + round($y, self::PRECISION) + ); + break; + + case GradientType::VERTICAL(): + $this->eps .= sprintf( + " /Coords [ %s %s %s %s ]\n", + round($x, self::PRECISION), + round($y, self::PRECISION), + round($x, self::PRECISION), + round($y + $height, self::PRECISION) + ); + break; + + case GradientType::DIAGONAL(): + $this->eps .= sprintf( + " /Coords [ %s %s %s %s ]\n", + round($x, self::PRECISION), + round($y, self::PRECISION), + round($x + $width, self::PRECISION), + round($y + $height, self::PRECISION) + ); + break; + + case GradientType::INVERSE_DIAGONAL(): + $this->eps .= sprintf( + " /Coords [ %s %s %s %s ]\n", + round($x, self::PRECISION), + round($y + $height, self::PRECISION), + round($x + $width, self::PRECISION), + round($y, self::PRECISION) + ); + break; + + case GradientType::RADIAL(): + $centerX = ($x + $width) / 2; + $centerY = ($y + $height) / 2; + + $this->eps .= sprintf( + " /Coords [ %s %s 0 %s %s %s ]\n", + round($centerX, self::PRECISION), + round($centerY, self::PRECISION), + round($centerX, self::PRECISION), + round($centerY, self::PRECISION), + round(max($width, $height) / 2, self::PRECISION) + ); + break; + } + + $this->eps .= " /Function\n" + . " <<\n" + . " /FunctionType 2\n" + . " /Domain [ 0 1 ]\n" + . sprintf(" /C0 [ %s ]\n", $this->getColorString($startColor)) + . sprintf(" /C1 [ %s ]\n", $this->getColorString($endColor)) + . " /N 1\n" + . " >>\n>>\nshfill\nQ\n"; + } + + private function getColorSetString(ColorInterface $color) : string + { + if ($color instanceof Rgb) { + return $this->getColorString($color) . ' rgb'; + } + + if ($color instanceof Cmyk) { + return $this->getColorString($color) . ' cmyk'; + } + + if ($color instanceof Gray) { + return $this->getColorString($color) . ' gray'; + } + + return $this->getColorSetString($color->toCmyk()); + } + + private function getColorString(ColorInterface $color) : string + { + if ($color instanceof Rgb) { + return sprintf('%s %s %s', $color->getRed() / 255, $color->getGreen() / 255, $color->getBlue() / 255); + } + + if ($color instanceof Cmyk) { + return sprintf( + '%s %s %s %s', + $color->getCyan() / 100, + $color->getMagenta() / 100, + $color->getYellow() / 100, + $color->getBlack() / 100 + ); + } + + if ($color instanceof Gray) { + return sprintf('%s', $color->getGray() / 100); + } + + return $this->getColorString($color->toCmyk()); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImageBackEndInterface.php b/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImageBackEndInterface.php new file mode 100755 index 0000000..0935819 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImageBackEndInterface.php @@ -0,0 +1,87 @@ +imageFormat = $imageFormat; + $this->compressionQuality = $compressionQuality; + } + + public function new(int $size, ColorInterface $backgroundColor) : void + { + $this->image = new Imagick(); + $this->image->newImage($size, $size, $this->getColorPixel($backgroundColor)); + $this->image->setImageFormat($this->imageFormat); + $this->image->setCompressionQuality($this->compressionQuality); + $this->draw = new ImagickDraw(); + $this->gradientCount = 0; + $this->matrices = [new TransformationMatrix()]; + $this->matrixIndex = 0; + } + + public function scale(float $size) : void + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->scale($size, $size); + $this->matrices[$this->matrixIndex] = $this->matrices[$this->matrixIndex] + ->multiply(TransformationMatrix::scale($size)); + } + + public function translate(float $x, float $y) : void + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->translate($x, $y); + $this->matrices[$this->matrixIndex] = $this->matrices[$this->matrixIndex] + ->multiply(TransformationMatrix::translate($x, $y)); + } + + public function rotate(int $degrees) : void + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->rotate($degrees); + $this->matrices[$this->matrixIndex] = $this->matrices[$this->matrixIndex] + ->multiply(TransformationMatrix::rotate($degrees)); + } + + public function push() : void + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->push(); + $this->matrices[++$this->matrixIndex] = $this->matrices[$this->matrixIndex - 1]; + } + + public function pop() : void + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->pop(); + unset($this->matrices[$this->matrixIndex--]); + } + + public function drawPathWithColor(Path $path, ColorInterface $color) : void + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->setFillColor($this->getColorPixel($color)); + $this->drawPath($path); + } + + public function drawPathWithGradient( + Path $path, + Gradient $gradient, + float $x, + float $y, + float $width, + float $height + ) : void { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->draw->setFillPatternURL('#' . $this->createGradientFill($gradient, $x, $y, $width, $height)); + $this->drawPath($path); + } + + public function done() : string + { + if (null === $this->draw) { + throw new RuntimeException('No image has been started'); + } + + $this->image->drawImage($this->draw); + $blob = $this->image->getImageBlob(); + $this->draw->clear(); + $this->image->clear(); + $this->draw = null; + $this->image = null; + $this->gradientCount = null; + + return $blob; + } + + private function drawPath(Path $path) : void + { + $this->draw->pathStart(); + + foreach ($path as $op) { + switch (true) { + case $op instanceof Move: + $this->draw->pathMoveToAbsolute($op->getX(), $op->getY()); + break; + + case $op instanceof Line: + $this->draw->pathLineToAbsolute($op->getX(), $op->getY()); + break; + + case $op instanceof EllipticArc: + $this->draw->pathEllipticArcAbsolute( + $op->getXRadius(), + $op->getYRadius(), + $op->getXAxisAngle(), + $op->isLargeArc(), + $op->isSweep(), + $op->getX(), + $op->getY() + ); + break; + + case $op instanceof Curve: + $this->draw->pathCurveToAbsolute( + $op->getX1(), + $op->getY1(), + $op->getX2(), + $op->getY2(), + $op->getX3(), + $op->getY3() + ); + break; + + case $op instanceof Close: + $this->draw->pathClose(); + break; + + default: + throw new RuntimeException('Unexpected draw operation: ' . get_class($op)); + } + } + + $this->draw->pathFinish(); + } + + private function createGradientFill(Gradient $gradient, float $x, float $y, float $width, float $height) : string + { + list($width, $height) = $this->matrices[$this->matrixIndex]->apply($width, $height); + + $startColor = $this->getColorPixel($gradient->getStartColor())->getColorAsString(); + $endColor = $this->getColorPixel($gradient->getEndColor())->getColorAsString(); + $gradientImage = new Imagick(); + + switch ($gradient->getType()) { + case GradientType::HORIZONTAL(): + $gradientImage->newPseudoImage((int) $height, (int) $width, sprintf( + 'gradient:%s-%s', + $startColor, + $endColor + )); + $gradientImage->rotateImage('transparent', -90); + break; + + case GradientType::VERTICAL(): + $gradientImage->newPseudoImage((int) $width, (int) $height, sprintf( + 'gradient:%s-%s', + $startColor, + $endColor + )); + break; + + case GradientType::DIAGONAL(): + case GradientType::INVERSE_DIAGONAL(): + $gradientImage->newPseudoImage((int) ($width * sqrt(2)), (int) ($height * sqrt(2)), sprintf( + 'gradient:%s-%s', + $startColor, + $endColor + )); + + if (GradientType::DIAGONAL() === $gradient->getType()) { + $gradientImage->rotateImage('transparent', -45); + } else { + $gradientImage->rotateImage('transparent', -135); + } + + $rotatedWidth = $gradientImage->getImageWidth(); + $rotatedHeight = $gradientImage->getImageHeight(); + + $gradientImage->setImagePage($rotatedWidth, $rotatedHeight, 0, 0); + $gradientImage->cropImage( + intdiv($rotatedWidth, 2) - 2, + intdiv($rotatedHeight, 2) - 2, + intdiv($rotatedWidth, 4) + 1, + intdiv($rotatedWidth, 4) + 1 + ); + break; + + case GradientType::RADIAL(): + $gradientImage->newPseudoImage((int) $width, (int) $height, sprintf( + 'radial-gradient:%s-%s', + $startColor, + $endColor + )); + break; + } + + $id = sprintf('g%d', ++$this->gradientCount); + $this->draw->pushPattern($id, 0, 0, $width, $height); + $this->draw->composite(Imagick::COMPOSITE_COPY, 0, 0, $width, $height, $gradientImage); + $this->draw->popPattern(); + return $id; + } + + private function getColorPixel(ColorInterface $color) : ImagickPixel + { + $alpha = 100; + + if ($color instanceof Alpha) { + $alpha = $color->getAlpha(); + $color = $color->getBaseColor(); + } + + if ($color instanceof Rgb) { + return new ImagickPixel(sprintf( + 'rgba(%d, %d, %d, %F)', + $color->getRed(), + $color->getGreen(), + $color->getBlue(), + $alpha / 100 + )); + } + + if ($color instanceof Cmyk) { + return new ImagickPixel(sprintf( + 'cmyka(%d, %d, %d, %d, %F)', + $color->getCyan(), + $color->getMagenta(), + $color->getYellow(), + $color->getBlack(), + $alpha / 100 + )); + } + + if ($color instanceof Gray) { + return new ImagickPixel(sprintf( + 'graya(%d%%, %F)', + $color->getGray(), + $alpha / 100 + )); + } + + return $this->getColorPixel(new Alpha($alpha, $color->toRgb())); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php b/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php new file mode 100755 index 0000000..714da6e --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php @@ -0,0 +1,369 @@ +xmlWriter = new XMLWriter(); + $this->xmlWriter->openMemory(); + + $this->xmlWriter->startDocument('1.0', 'UTF-8'); + $this->xmlWriter->startElement('svg'); + $this->xmlWriter->writeAttribute('xmlns', 'http://www.w3.org/2000/svg'); + $this->xmlWriter->writeAttribute('version', '1.1'); + $this->xmlWriter->writeAttribute('width', (string) $size); + $this->xmlWriter->writeAttribute('height', (string) $size); + $this->xmlWriter->writeAttribute('viewBox', '0 0 '. $size . ' ' . $size); + + $this->gradientCount = 0; + $this->currentStack = 0; + $this->stack[0] = 0; + + $alpha = 1; + + if ($backgroundColor instanceof Alpha) { + $alpha = $backgroundColor->getAlpha() / 100; + } + + if (0 === $alpha) { + return; + } + + $this->xmlWriter->startElement('rect'); + $this->xmlWriter->writeAttribute('x', '0'); + $this->xmlWriter->writeAttribute('y', '0'); + $this->xmlWriter->writeAttribute('width', (string) $size); + $this->xmlWriter->writeAttribute('height', (string) $size); + $this->xmlWriter->writeAttribute('fill', $this->getColorString($backgroundColor)); + + if ($alpha < 1) { + $this->xmlWriter->writeAttribute('fill-opacity', (string) $alpha); + } + + $this->xmlWriter->endElement(); + } + + public function scale(float $size) : void + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + $this->xmlWriter->startElement('g'); + $this->xmlWriter->writeAttribute( + 'transform', + sprintf('scale(%s)', round($size, self::PRECISION)) + ); + ++$this->stack[$this->currentStack]; + } + + public function translate(float $x, float $y) : void + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + $this->xmlWriter->startElement('g'); + $this->xmlWriter->writeAttribute( + 'transform', + sprintf('translate(%s,%s)', round($x, self::PRECISION), round($y, self::PRECISION)) + ); + ++$this->stack[$this->currentStack]; + } + + public function rotate(int $degrees) : void + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + $this->xmlWriter->startElement('g'); + $this->xmlWriter->writeAttribute('transform', sprintf('rotate(%d)', $degrees)); + ++$this->stack[$this->currentStack]; + } + + public function push() : void + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + $this->xmlWriter->startElement('g'); + $this->stack[] = 1; + ++$this->currentStack; + } + + public function pop() : void + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + for ($i = 0; $i < $this->stack[$this->currentStack]; ++$i) { + $this->xmlWriter->endElement(); + } + + array_pop($this->stack); + --$this->currentStack; + } + + public function drawPathWithColor(Path $path, ColorInterface $color) : void + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + $alpha = 1; + + if ($color instanceof Alpha) { + $alpha = $color->getAlpha() / 100; + } + + $this->startPathElement($path); + $this->xmlWriter->writeAttribute('fill', $this->getColorString($color)); + + if ($alpha < 1) { + $this->xmlWriter->writeAttribute('fill-opacity', (string) $alpha); + } + + $this->xmlWriter->endElement(); + } + + public function drawPathWithGradient( + Path $path, + Gradient $gradient, + float $x, + float $y, + float $width, + float $height + ) : void { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + $gradientId = $this->createGradientFill($gradient, $x, $y, $width, $height); + $this->startPathElement($path); + $this->xmlWriter->writeAttribute('fill', 'url(#' . $gradientId . ')'); + $this->xmlWriter->endElement(); + } + + public function done() : string + { + if (null === $this->xmlWriter) { + throw new RuntimeException('No image has been started'); + } + + foreach ($this->stack as $openElements) { + for ($i = $openElements; $i > 0; --$i) { + $this->xmlWriter->endElement(); + } + } + + $this->xmlWriter->endDocument(); + $blob = $this->xmlWriter->outputMemory(true); + $this->xmlWriter = null; + $this->stack = null; + $this->currentStack = null; + $this->gradientCount = null; + + return $blob; + } + + private function startPathElement(Path $path) : void + { + $pathData = []; + + foreach ($path as $op) { + switch (true) { + case $op instanceof Move: + $pathData[] = sprintf( + 'M%s %s', + round($op->getX(), self::PRECISION), + round($op->getY(), self::PRECISION) + ); + break; + + case $op instanceof Line: + $pathData[] = sprintf( + 'L%s %s', + round($op->getX(), self::PRECISION), + round($op->getY(), self::PRECISION) + ); + break; + + case $op instanceof EllipticArc: + $pathData[] = sprintf( + 'A%s %s %s %u %u %s %s', + round($op->getXRadius(), self::PRECISION), + round($op->getYRadius(), self::PRECISION), + round($op->getXAxisAngle(), self::PRECISION), + $op->isLargeArc(), + $op->isSweep(), + round($op->getX(), self::PRECISION), + round($op->getY(), self::PRECISION) + ); + break; + + case $op instanceof Curve: + $pathData[] = sprintf( + 'C%s %s %s %s %s %s', + round($op->getX1(), self::PRECISION), + round($op->getY1(), self::PRECISION), + round($op->getX2(), self::PRECISION), + round($op->getY2(), self::PRECISION), + round($op->getX3(), self::PRECISION), + round($op->getY3(), self::PRECISION) + ); + break; + + case $op instanceof Close: + $pathData[] = 'Z'; + break; + + default: + throw new RuntimeException('Unexpected draw operation: ' . get_class($op)); + } + } + + $this->xmlWriter->startElement('path'); + $this->xmlWriter->writeAttribute('fill-rule', 'evenodd'); + $this->xmlWriter->writeAttribute('d', implode('', $pathData)); + } + + private function createGradientFill(Gradient $gradient, float $x, float $y, float $width, float $height) : string + { + $this->xmlWriter->startElement('defs'); + + $startColor = $gradient->getStartColor(); + $endColor = $gradient->getEndColor(); + + if ($gradient->getType() === GradientType::RADIAL()) { + $this->xmlWriter->startElement('radialGradient'); + } else { + $this->xmlWriter->startElement('linearGradient'); + } + + $this->xmlWriter->writeAttribute('gradientUnits', 'userSpaceOnUse'); + + switch ($gradient->getType()) { + case GradientType::HORIZONTAL(): + $this->xmlWriter->writeAttribute('x1', (string) round($x, self::PRECISION)); + $this->xmlWriter->writeAttribute('y1', (string) round($y, self::PRECISION)); + $this->xmlWriter->writeAttribute('x2', (string) round($x + $width, self::PRECISION)); + $this->xmlWriter->writeAttribute('y2', (string) round($y, self::PRECISION)); + break; + + case GradientType::VERTICAL(): + $this->xmlWriter->writeAttribute('x1', (string) round($x, self::PRECISION)); + $this->xmlWriter->writeAttribute('y1', (string) round($y, self::PRECISION)); + $this->xmlWriter->writeAttribute('x2', (string) round($x, self::PRECISION)); + $this->xmlWriter->writeAttribute('y2', (string) round($y + $height, self::PRECISION)); + break; + + case GradientType::DIAGONAL(): + $this->xmlWriter->writeAttribute('x1', (string) round($x, self::PRECISION)); + $this->xmlWriter->writeAttribute('y1', (string) round($y, self::PRECISION)); + $this->xmlWriter->writeAttribute('x2', (string) round($x + $width, self::PRECISION)); + $this->xmlWriter->writeAttribute('y2', (string) round($y + $height, self::PRECISION)); + break; + + case GradientType::INVERSE_DIAGONAL(): + $this->xmlWriter->writeAttribute('x1', (string) round($x, self::PRECISION)); + $this->xmlWriter->writeAttribute('y1', (string) round($y + $height, self::PRECISION)); + $this->xmlWriter->writeAttribute('x2', (string) round($x + $width, self::PRECISION)); + $this->xmlWriter->writeAttribute('y2', (string) round($y, self::PRECISION)); + break; + + case GradientType::RADIAL(): + $this->xmlWriter->writeAttribute('cx', (string) round(($x + $width) / 2, self::PRECISION)); + $this->xmlWriter->writeAttribute('cy', (string) round(($y + $height) / 2, self::PRECISION)); + $this->xmlWriter->writeAttribute('r', (string) round(max($width, $height) / 2, self::PRECISION)); + break; + } + + $id = sprintf('g%d', ++$this->gradientCount); + $this->xmlWriter->writeAttribute('id', $id); + + $this->xmlWriter->startElement('stop'); + $this->xmlWriter->writeAttribute('offset', '0%'); + $this->xmlWriter->writeAttribute('stop-color', $this->getColorString($startColor)); + + if ($startColor instanceof Alpha) { + $this->xmlWriter->writeAttribute('stop-opacity', $startColor->getAlpha()); + } + + $this->xmlWriter->endElement(); + + $this->xmlWriter->startElement('stop'); + $this->xmlWriter->writeAttribute('offset', '100%'); + $this->xmlWriter->writeAttribute('stop-color', $this->getColorString($endColor)); + + if ($endColor instanceof Alpha) { + $this->xmlWriter->writeAttribute('stop-opacity', $endColor->getAlpha()); + } + + $this->xmlWriter->endElement(); + + $this->xmlWriter->endElement(); + $this->xmlWriter->endElement(); + + return $id; + } + + private function getColorString(ColorInterface $color) : string + { + $color = $color->toRgb(); + + return sprintf( + '#%02x%02x%02x', + $color->getRed(), + $color->getGreen(), + $color->getBlue() + ); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php b/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php new file mode 100755 index 0000000..7e88da6 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php @@ -0,0 +1,68 @@ +values = [1, 0, 0, 1, 0, 0]; + } + + public function multiply(self $other) : self + { + $matrix = new self(); + $matrix->values[0] = $this->values[0] * $other->values[0] + $this->values[2] * $other->values[1]; + $matrix->values[1] = $this->values[1] * $other->values[0] + $this->values[3] * $other->values[1]; + $matrix->values[2] = $this->values[0] * $other->values[2] + $this->values[2] * $other->values[3]; + $matrix->values[3] = $this->values[1] * $other->values[2] + $this->values[3] * $other->values[3]; + $matrix->values[4] = $this->values[0] * $other->values[4] + $this->values[2] * $other->values[5] + + $this->values[4]; + $matrix->values[5] = $this->values[1] * $other->values[4] + $this->values[3] * $other->values[5] + + $this->values[5]; + + return $matrix; + } + + public static function scale(float $size) : self + { + $matrix = new self(); + $matrix->values = [$size, 0, 0, $size, 0, 0]; + return $matrix; + } + + public static function translate(float $x, float $y) : self + { + $matrix = new self(); + $matrix->values = [1, 0, 0, 1, $x, $y]; + return $matrix; + } + + public static function rotate(int $degrees) : self + { + $matrix = new self(); + $rad = deg2rad($degrees); + $matrix->values = [cos($rad), sin($rad), -sin($rad), cos($rad), 0, 0]; + return $matrix; + } + + + /** + * Applies this matrix onto a point and returns the resulting viewport point. + * + * @return float[] + */ + public function apply(float $x, float $y) : array + { + return [ + $x * $this->values[0] + $y * $this->values[2] + $this->values[4], + $x * $this->values[1] + $y * $this->values[3] + $this->values[5], + ]; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php b/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php new file mode 100755 index 0000000..ab16276 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php @@ -0,0 +1,152 @@ +rendererStyle = $rendererStyle; + $this->imageBackEnd = $imageBackEnd; + } + + /** + * @throws InvalidArgumentException if matrix width doesn't match height + */ + public function render(QrCode $qrCode) : string + { + $size = $this->rendererStyle->getSize(); + $margin = $this->rendererStyle->getMargin(); + $matrix = $qrCode->getMatrix(); + $matrixSize = $matrix->getWidth(); + + if ($matrixSize !== $matrix->getHeight()) { + throw new InvalidArgumentException('Matrix must have the same width and height'); + } + + $totalSize = $matrixSize + ($margin * 2); + $moduleSize = $size / $totalSize; + $fill = $this->rendererStyle->getFill(); + + $this->imageBackEnd->new($size, $fill->getBackgroundColor()); + $this->imageBackEnd->scale((float) $moduleSize); + $this->imageBackEnd->translate((float) $margin, (float) $margin); + + $module = $this->rendererStyle->getModule(); + $moduleMatrix = clone $matrix; + MatrixUtil::removePositionDetectionPatterns($moduleMatrix); + $modulePath = $this->drawEyes($matrixSize, $module->createPath($moduleMatrix)); + + if ($fill->hasGradientFill()) { + $this->imageBackEnd->drawPathWithGradient( + $modulePath, + $fill->getForegroundGradient(), + 0, + 0, + $matrixSize, + $matrixSize + ); + } else { + $this->imageBackEnd->drawPathWithColor($modulePath, $fill->getForegroundColor()); + } + + return $this->imageBackEnd->done(); + } + + private function drawEyes(int $matrixSize, Path $modulePath) : Path + { + $fill = $this->rendererStyle->getFill(); + + $eye = $this->rendererStyle->getEye(); + $externalPath = $eye->getExternalPath(); + $internalPath = $eye->getInternalPath(); + + $modulePath = $this->drawEye( + $externalPath, + $internalPath, + $fill->getTopLeftEyeFill(), + 3.5, + 3.5, + 0, + $modulePath + ); + $modulePath = $this->drawEye( + $externalPath, + $internalPath, + $fill->getTopRightEyeFill(), + $matrixSize - 3.5, + 3.5, + 90, + $modulePath + ); + $modulePath = $this->drawEye( + $externalPath, + $internalPath, + $fill->getBottomLeftEyeFill(), + 3.5, + $matrixSize - 3.5, + -90, + $modulePath + ); + + return $modulePath; + } + + private function drawEye( + Path $externalPath, + Path $internalPath, + EyeFill $fill, + float $xTranslation, + float $yTranslation, + int $rotation, + Path $modulePath + ) : Path { + if ($fill->inheritsBothColors()) { + return $modulePath + ->append($externalPath->translate($xTranslation, $yTranslation)) + ->append($internalPath->translate($xTranslation, $yTranslation)); + } + + $this->imageBackEnd->push(); + $this->imageBackEnd->translate($xTranslation, $yTranslation); + + if (0 !== $rotation) { + $this->imageBackEnd->rotate($rotation); + } + + if ($fill->inheritsExternalColor()) { + $modulePath = $modulePath->append($externalPath->translate($xTranslation, $yTranslation)); + } else { + $this->imageBackEnd->drawPathWithColor($externalPath, $fill->getExternalColor()); + } + + if ($fill->inheritsInternalColor()) { + $modulePath = $modulePath->append($internalPath->translate($xTranslation, $yTranslation)); + } else { + $this->imageBackEnd->drawPathWithColor($internalPath, $fill->getInternalColor()); + } + + $this->imageBackEnd->pop(); + + return $modulePath; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php b/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php new file mode 100755 index 0000000..f536e5a --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php @@ -0,0 +1,63 @@ + 1) { + throw new InvalidArgumentException('Size must between 0 (exclusive) and 1 (inclusive)'); + } + + $this->size = $size; + } + + public function createPath(ByteMatrix $matrix) : Path + { + $width = $matrix->getWidth(); + $height = $matrix->getHeight(); + $path = new Path(); + $halfSize = $this->size / 2; + $margin = (1 - $this->size) / 2; + + for ($y = 0; $y < $height; ++$y) { + for ($x = 0; $x < $width; ++$x) { + if (! $matrix->get($x, $y)) { + continue; + } + + $pathX = $x + $margin; + $pathY = $y + $margin; + + $path = $path + ->move($pathX + $this->size, $pathY + $halfSize) + ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX + $halfSize, $pathY + $this->size) + ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX, $pathY + $halfSize) + ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX + $halfSize, $pathY) + ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX + $this->size, $pathY + $halfSize) + ->close() + ; + } + } + + return $path; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php b/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php new file mode 100755 index 0000000..90482f2 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php @@ -0,0 +1,100 @@ + + */ + private $points = []; + + /** + * @var array|null + */ + private $simplifiedPoints; + + /** + * @var int + */ + private $minX = PHP_INT_MAX; + + /** + * @var int + */ + private $minY = PHP_INT_MAX; + + /** + * @var int + */ + private $maxX = -1; + + /** + * @var int + */ + private $maxY = -1; + + public function __construct(bool $positive) + { + $this->positive = $positive; + } + + public function addPoint(int $x, int $y) : void + { + $this->points[] = [$x, $y]; + $this->minX = min($this->minX, $x); + $this->minY = min($this->minY, $y); + $this->maxX = max($this->maxX, $x); + $this->maxY = max($this->maxY, $y); + } + + public function isPositive() : bool + { + return $this->positive; + } + + /** + * @return array + */ + public function getPoints() : array + { + return $this->points; + } + + public function getMaxX() : int + { + return $this->maxX; + } + + public function getSimplifiedPoints() : array + { + if (null !== $this->simplifiedPoints) { + return $this->simplifiedPoints; + } + + $points = []; + $length = count($this->points); + + for ($i = 0; $i < $length; ++$i) { + $previousPoint = $this->points[(0 === $i ? $length : $i) - 1]; + $nextPoint = $this->points[($length - 1 === $i ? -1 : $i) + 1]; + $currentPoint = $this->points[$i]; + + if (($previousPoint[0] === $currentPoint[0] && $currentPoint[0] === $nextPoint[0]) + || ($previousPoint[1] === $currentPoint[1] && $currentPoint[1] === $nextPoint[1]) + ) { + continue; + } + + $points[] = $currentPoint; + } + + return $this->simplifiedPoints = $points; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php b/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php new file mode 100755 index 0000000..af52d52 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php @@ -0,0 +1,169 @@ +bytes = iterator_to_array($matrix->getBytes()); + $this->size = count($this->bytes); + $this->width = $matrix->getWidth(); + $this->height = $matrix->getHeight(); + } + + /** + * @return Edge[] + */ + public function getIterator() : Traversable + { + $originalBytes = $this->bytes; + $point = $this->findNext(0, 0); + + while (null !== $point) { + $edge = $this->findEdge($point[0], $point[1]); + $this->xorEdge($edge); + + yield $edge; + + $point = $this->findNext($point[0], $point[1]); + } + + $this->bytes = $originalBytes; + } + + /** + * @return int[]|null + */ + private function findNext(int $x, int $y) : ?array + { + $i = $this->width * $y + $x; + + while ($i < $this->size && 1 !== $this->bytes[$i]) { + ++$i; + } + + if ($i < $this->size) { + return $this->pointOf($i); + } + + return null; + } + + private function findEdge(int $x, int $y) : Edge + { + $edge = new Edge($this->isSet($x, $y)); + $startX = $x; + $startY = $y; + $dirX = 0; + $dirY = 1; + + while (true) { + $edge->addPoint($x, $y); + $x += $dirX; + $y += $dirY; + + if ($x === $startX && $y === $startY) { + break; + } + + $left = $this->isSet($x + ($dirX + $dirY - 1 ) / 2, $y + ($dirY - $dirX - 1) / 2); + $right = $this->isSet($x + ($dirX - $dirY - 1) / 2, $y + ($dirY + $dirX - 1) / 2); + + if ($right && ! $left) { + $tmp = $dirX; + $dirX = -$dirY; + $dirY = $tmp; + } elseif ($right) { + $tmp = $dirX; + $dirX = -$dirY; + $dirY = $tmp; + } elseif (! $left) { + $tmp = $dirX; + $dirX = $dirY; + $dirY = -$tmp; + } + } + + return $edge; + } + + private function xorEdge(Edge $path) : void + { + $points = $path->getPoints(); + $y1 = $points[0][1]; + $length = count($points); + $maxX = $path->getMaxX(); + + for ($i = 1; $i < $length; ++$i) { + $y = $points[$i][1]; + + if ($y === $y1) { + continue; + } + + $x = $points[$i][0]; + $minY = min($y1, $y); + + for ($j = $x; $j < $maxX; ++$j) { + $this->flip($j, $minY); + } + + $y1 = $y; + } + } + + private function isSet(int $x, int $y) : bool + { + return ( + $x >= 0 + && $x < $this->width + && $y >= 0 + && $y < $this->height + ) && 1 === $this->bytes[$this->width * $y + $x]; + } + + /** + * @return int[] + */ + private function pointOf(int $i) : array + { + $y = intdiv($i, $this->width); + return [$i - $y * $this->width, $y]; + } + + private function flip(int $x, int $y) : void + { + $this->bytes[$this->width * $y + $x] = ( + $this->isSet($x, $y) ? 0 : 1 + ); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Module/ModuleInterface.php b/vendor/bacon/bacon-qr-code/src/Renderer/Module/ModuleInterface.php new file mode 100755 index 0000000..0ccb0e0 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Module/ModuleInterface.php @@ -0,0 +1,18 @@ + 1) { + throw new InvalidArgumentException('Intensity must between 0 (exclusive) and 1 (inclusive)'); + } + + $this->intensity = $intensity / 2; + } + + public function createPath(ByteMatrix $matrix) : Path + { + $path = new Path(); + + foreach (new EdgeIterator($matrix) as $edge) { + $points = $edge->getSimplifiedPoints(); + $length = count($points); + + $currentPoint = $points[0]; + $nextPoint = $points[1]; + $horizontal = ($currentPoint[1] === $nextPoint[1]); + + if ($horizontal) { + $right = $nextPoint[0] > $currentPoint[0]; + $path = $path->move( + $currentPoint[0] + ($right ? $this->intensity : -$this->intensity), + $currentPoint[1] + ); + } else { + $up = $nextPoint[0] < $currentPoint[0]; + $path = $path->move( + $currentPoint[0], + $currentPoint[1] + ($up ? -$this->intensity : $this->intensity) + ); + } + + for ($i = 1; $i <= $length; ++$i) { + if ($i === $length) { + $previousPoint = $points[$length - 1]; + $currentPoint = $points[0]; + $nextPoint = $points[1]; + } else { + $previousPoint = $points[(0 === $i ? $length : $i) - 1]; + $currentPoint = $points[$i]; + $nextPoint = $points[($length - 1 === $i ? -1 : $i) + 1]; + } + + $horizontal = ($previousPoint[1] === $currentPoint[1]); + + if ($horizontal) { + $right = $previousPoint[0] < $currentPoint[0]; + $up = $nextPoint[1] < $currentPoint[1]; + $sweep = ($up xor $right); + + if ($this->intensity < 0.5 + || ($right && $previousPoint[0] !== $currentPoint[0] - 1) + || (! $right && $previousPoint[0] - 1 !== $currentPoint[0]) + ) { + $path = $path->line( + $currentPoint[0] + ($right ? -$this->intensity : $this->intensity), + $currentPoint[1] + ); + } + + $path = $path->ellipticArc( + $this->intensity, + $this->intensity, + 0, + false, + $sweep, + $currentPoint[0], + $currentPoint[1] + ($up ? -$this->intensity : $this->intensity) + ); + } else { + $up = $previousPoint[1] > $currentPoint[1]; + $right = $nextPoint[0] > $currentPoint[0]; + $sweep = ! ($up xor $right); + + if ($this->intensity < 0.5 + || ($up && $previousPoint[1] !== $currentPoint[1] + 1) + || (! $up && $previousPoint[0] + 1 !== $currentPoint[0]) + ) { + $path = $path->line( + $currentPoint[0], + $currentPoint[1] + ($up ? $this->intensity : -$this->intensity) + ); + } + + $path = $path->ellipticArc( + $this->intensity, + $this->intensity, + 0, + false, + $sweep, + $currentPoint[0] + ($right ? $this->intensity : -$this->intensity), + $currentPoint[1] + ); + } + } + + $path = $path->close(); + } + + return $path; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php b/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php new file mode 100755 index 0000000..9ab4607 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php @@ -0,0 +1,47 @@ +getSimplifiedPoints(); + $length = count($points); + $path = $path->move($points[0][0], $points[0][1]); + + for ($i = 1; $i < $length; ++$i) { + $path = $path->line($points[$i][0], $points[$i][1]); + } + + $path = $path->close(); + } + + return $path; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php b/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php new file mode 100755 index 0000000..b07feb0 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php @@ -0,0 +1,29 @@ +x1 = $x1; + $this->y1 = $y1; + $this->x2 = $x2; + $this->y2 = $y2; + $this->x3 = $x3; + $this->y3 = $y3; + } + + public function getX1() : float + { + return $this->x1; + } + + public function getY1() : float + { + return $this->y1; + } + + public function getX2() : float + { + return $this->x2; + } + + public function getY2() : float + { + return $this->y2; + } + + public function getX3() : float + { + return $this->x3; + } + + public function getY3() : float + { + return $this->y3; + } + + /** + * @return self + */ + public function translate(float $x, float $y) : OperationInterface + { + return new self( + $this->x1 + $x, + $this->y1 + $y, + $this->x2 + $x, + $this->y2 + $y, + $this->x3 + $x, + $this->y3 + $y + ); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php b/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php new file mode 100755 index 0000000..eff7deb --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php @@ -0,0 +1,278 @@ +xRadius = abs($xRadius); + $this->yRadius = abs($yRadius); + $this->xAxisAngle = $xAxisAngle % 360; + $this->largeArc = $largeArc; + $this->sweep = $sweep; + $this->x = $x; + $this->y = $y; + } + + public function getXRadius() : float + { + return $this->xRadius; + } + + public function getYRadius() : float + { + return $this->yRadius; + } + + public function getXAxisAngle() : float + { + return $this->xAxisAngle; + } + + public function isLargeArc() : bool + { + return $this->largeArc; + } + + public function isSweep() : bool + { + return $this->sweep; + } + + public function getX() : float + { + return $this->x; + } + + public function getY() : float + { + return $this->y; + } + + /** + * @return self + */ + public function translate(float $x, float $y) : OperationInterface + { + return new self( + $this->xRadius, + $this->yRadius, + $this->xAxisAngle, + $this->largeArc, + $this->sweep, + $this->x + $x, + $this->y + $y + ); + } + + /** + * Converts the elliptic arc to multiple curves. + * + * Since not all image back ends support elliptic arcs, this method allows to convert the arc into multiple curves + * resembling the same result. + * + * @see https://mortoray.com/2017/02/16/rendering-an-svg-elliptical-arc-as-bezier-curves/ + * @return array + */ + public function toCurves(float $fromX, float $fromY) : array + { + if (sqrt(($fromX - $this->x) ** 2 + ($fromY - $this->y) ** 2) < self::ZERO_TOLERANCE) { + return []; + } + + if ($this->xRadius < self::ZERO_TOLERANCE || $this->yRadius < self::ZERO_TOLERANCE) { + return [new Line($this->x, $this->y)]; + } + + return $this->createCurves($fromX, $fromY); + } + + /** + * @return Curve[] + */ + private function createCurves(float $fromX, $fromY) : array + { + $xAngle = deg2rad($this->xAxisAngle); + list($centerX, $centerY, $radiusX, $radiusY, $startAngle, $deltaAngle) = + $this->calculateCenterPointParameters($fromX, $fromY, $xAngle); + + $s = $startAngle; + $e = $s + $deltaAngle; + $sign = ($e < $s) ? -1 : 1; + $remain = abs($e - $s); + $p1 = self::point($centerX, $centerY, $radiusX, $radiusY, $xAngle, $s); + $curves = []; + + while ($remain > self::ZERO_TOLERANCE) { + $step = min($remain, pi() / 2); + $signStep = $step * $sign; + $p2 = self::point($centerX, $centerY, $radiusX, $radiusY, $xAngle, $s + $signStep); + + $alphaT = tan($signStep / 2); + $alpha = sin($signStep) * (sqrt(4 + 3 * $alphaT ** 2) - 1) / 3; + $d1 = self::derivative($radiusX, $radiusY, $xAngle, $s); + $d2 = self::derivative($radiusX, $radiusY, $xAngle, $s + $signStep); + + $curves[] = new Curve( + $p1[0] + $alpha * $d1[0], + $p1[1] + $alpha * $d1[1], + $p2[0] - $alpha * $d2[0], + $p2[1] - $alpha * $d2[1], + $p2[0], + $p2[1] + ); + + $s += $signStep; + $remain -= $step; + $p1 = $p2; + } + + return $curves; + } + + /** + * @return float[] + */ + private function calculateCenterPointParameters(float $fromX, float $fromY, float $xAngle) + { + $rX = $this->xRadius; + $rY = $this->yRadius; + + // F.6.5.1 + $dx2 = ($fromX - $this->x) / 2; + $dy2 = ($fromY - $this->y) / 2; + $x1p = cos($xAngle) * $dx2 + sin($xAngle) * $dy2; + $y1p = -sin($xAngle) * $dx2 + cos($xAngle) * $dy2; + + // F.6.5.2 + $rxs = $rX ** 2; + $rys = $rY ** 2; + $x1ps = $x1p ** 2; + $y1ps = $y1p ** 2; + $cr = $x1ps / $rxs + $y1ps / $rys; + + if ($cr > 1) { + $s = sqrt($cr); + $rX *= $s; + $rY *= $s; + $rxs = $rX ** 2; + $rys = $rY ** 2; + } + + $dq = ($rxs * $y1ps + $rys * $x1ps); + $pq = ($rxs * $rys - $dq) / $dq; + $q = sqrt(max(0, $pq)); + + if ($this->largeArc === $this->sweep) { + $q = -$q; + } + + $cxp = $q * $rX * $y1p / $rY; + $cyp = -$q * $rY * $x1p / $rX; + + // F.6.5.3 + $cx = cos($xAngle) * $cxp - sin($xAngle) * $cyp + ($fromX + $this->x) / 2; + $cy = sin($xAngle) * $cxp + cos($xAngle) * $cyp + ($fromY + $this->y) / 2; + + // F.6.5.5 + $theta = self::angle(1, 0, ($x1p - $cxp) / $rX, ($y1p - $cyp) / $rY); + + // F.6.5.6 + $delta = self::angle(($x1p - $cxp) / $rX, ($y1p - $cyp) / $rY, (-$x1p - $cxp) / $rX, (-$y1p - $cyp) / $rY); + $delta = fmod($delta, pi() * 2); + + if (! $this->sweep) { + $delta -= 2 * pi(); + } + + return [$cx, $cy, $rX, $rY, $theta, $delta]; + } + + private static function angle(float $ux, float $uy, float $vx, float $vy) : float + { + // F.6.5.4 + $dot = $ux * $vx + $uy * $vy; + $length = sqrt($ux ** 2 + $uy ** 2) * sqrt($vx ** 2 + $vy ** 2); + $angle = acos(min(1, max(-1, $dot / $length))); + + if (($ux * $vy - $uy * $vx) < 0) { + return -$angle; + } + + return $angle; + } + + /** + * @return float[] + */ + private static function point( + float $centerX, + float $centerY, + float $radiusX, + float $radiusY, + float $xAngle, + float $angle + ) : array { + return [ + $centerX + $radiusX * cos($xAngle) * cos($angle) - $radiusY * sin($xAngle) * sin($angle), + $centerY + $radiusX * sin($xAngle) * cos($angle) + $radiusY * cos($xAngle) * sin($angle), + ]; + } + + /** + * @return float[] + */ + private static function derivative(float $radiusX, float $radiusY, float $xAngle, float $angle) : array + { + return [ + -$radiusX * cos($xAngle) * sin($angle) - $radiusY * sin($xAngle) * cos($angle), + -$radiusX * sin($xAngle) * sin($angle) + $radiusY * cos($xAngle) * cos($angle), + ]; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php b/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php new file mode 100755 index 0000000..3149a39 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php @@ -0,0 +1,41 @@ +x = $x; + $this->y = $y; + } + + public function getX() : float + { + return $this->x; + } + + public function getY() : float + { + return $this->y; + } + + /** + * @return self + */ + public function translate(float $x, float $y) : OperationInterface + { + return new self($this->x + $x, $this->y + $y); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php b/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php new file mode 100755 index 0000000..481d0dd --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php @@ -0,0 +1,41 @@ +x = $x; + $this->y = $y; + } + + public function getX() : float + { + return $this->x; + } + + public function getY() : float + { + return $this->y; + } + + /** + * @return self + */ + public function translate(float $x, float $y) : OperationInterface + { + return new self($this->x + $x, $this->y + $y); + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php b/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php new file mode 100755 index 0000000..a5fa0ed --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php @@ -0,0 +1,12 @@ +operations[] = new Move($x, $y); + return $path; + } + + /** + * Draws a line from the current position to another position. + */ + public function line(float $x, float $y) : self + { + $path = clone $this; + $path->operations[] = new Line($x, $y); + return $path; + } + + /** + * Draws an elliptic arc from the current position to another position. + */ + public function ellipticArc( + float $xRadius, + float $yRadius, + float $xAxisRotation, + bool $largeArc, + bool $sweep, + float $x, + float $y + ) : self { + $path = clone $this; + $path->operations[] = new EllipticArc($xRadius, $yRadius, $xAxisRotation, $largeArc, $sweep, $x, $y); + return $path; + } + + /** + * Draws a curve from the current position to another position. + */ + public function curve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3) : self + { + $path = clone $this; + $path->operations[] = new Curve($x1, $y1, $x2, $y2, $x3, $y3); + return $path; + } + + /** + * Closes a sub-path. + */ + public function close() : self + { + $path = clone $this; + $path->operations[] = Close::instance(); + return $path; + } + + /** + * Appends another path to this one. + */ + public function append(self $other) : self + { + $path = clone $this; + $path->operations = array_merge($this->operations, $other->operations); + return $path; + } + + public function translate(float $x, float $y) : self + { + $path = new self(); + + foreach ($this->operations as $operation) { + $path->operations[] = $operation->translate($x, $y); + } + + return $path; + } + + /** + * @return OperationInterface[]|Traversable + */ + public function getIterator() : Traversable + { + foreach ($this->operations as $operation) { + yield $operation; + } + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php b/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php new file mode 100755 index 0000000..8aa7652 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php @@ -0,0 +1,86 @@ +margin = $margin; + } + + /** + * @throws InvalidArgumentException if matrix width doesn't match height + */ + public function render(QrCode $qrCode) : string + { + $matrix = $qrCode->getMatrix(); + $matrixSize = $matrix->getWidth(); + + if ($matrixSize !== $matrix->getHeight()) { + throw new InvalidArgumentException('Matrix must have the same width and height'); + } + + $rows = $matrix->getArray()->toArray(); + + if (0 !== $matrixSize % 2) { + $rows[] = array_fill(0, $matrixSize, 0); + } + + $horizontalMargin = str_repeat(self::EMPTY_BLOCK, $this->margin); + $result = str_repeat("\n", (int) ceil($this->margin / 2)); + + for ($i = 0; $i < $matrixSize; $i += 2) { + $result .= $horizontalMargin; + + $upperRow = $rows[$i]; + $lowerRow = $rows[$i + 1]; + + for ($j = 0; $j < $matrixSize; ++$j) { + $upperBit = $upperRow[$j]; + $lowerBit = $lowerRow[$j]; + + if ($upperBit) { + $result .= $lowerBit ? self::FULL_BLOCK : self::UPPER_HALF_BLOCK; + } else { + $result .= $lowerBit ? self::LOWER_HALF_BLOCK : self::EMPTY_BLOCK; + } + } + + $result .= $horizontalMargin . "\n"; + } + + $result .= str_repeat("\n", (int) ceil($this->margin / 2)); + + return $result; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/RendererInterface.php b/vendor/bacon/bacon-qr-code/src/Renderer/RendererInterface.php new file mode 100755 index 0000000..b0aae39 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/RendererInterface.php @@ -0,0 +1,11 @@ +externalColor = $externalColor; + $this->internalColor = $internalColor; + } + + public static function uniform(ColorInterface $color) : self + { + return new self($color, $color); + } + + public static function inherit() : self + { + return self::$inherit ?: self::$inherit = new self(null, null); + } + + public function inheritsBothColors() : bool + { + return null === $this->externalColor && null === $this->internalColor; + } + + public function inheritsExternalColor() : bool + { + return null === $this->externalColor; + } + + public function inheritsInternalColor() : bool + { + return null === $this->internalColor; + } + + public function getExternalColor() : ColorInterface + { + if (null === $this->externalColor) { + throw new RuntimeException('External eye color inherits foreground color'); + } + + return $this->externalColor; + } + + public function getInternalColor() : ColorInterface + { + if (null === $this->internalColor) { + throw new RuntimeException('Internal eye color inherits foreground color'); + } + + return $this->internalColor; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php b/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php new file mode 100755 index 0000000..d54268e --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php @@ -0,0 +1,168 @@ +backgroundColor = $backgroundColor; + $this->foregroundColor = $foregroundColor; + $this->foregroundGradient = $foregroundGradient; + $this->topLeftEyeFill = $topLeftEyeFill; + $this->topRightEyeFill = $topRightEyeFill; + $this->bottomLeftEyeFill = $bottomLeftEyeFill; + } + + public static function default() : self + { + return self::$default ?: self::$default = self::uniformColor(new Gray(100), new Gray(0)); + } + + public static function withForegroundColor( + ColorInterface $backgroundColor, + ColorInterface $foregroundColor, + EyeFill $topLeftEyeFill, + EyeFill $topRightEyeFill, + EyeFill $bottomLeftEyeFill + ) : self { + return new self( + $backgroundColor, + $foregroundColor, + null, + $topLeftEyeFill, + $topRightEyeFill, + $bottomLeftEyeFill + ); + } + + public static function withForegroundGradient( + ColorInterface $backgroundColor, + Gradient $foregroundGradient, + EyeFill $topLeftEyeFill, + EyeFill $topRightEyeFill, + EyeFill $bottomLeftEyeFill + ) : self { + return new self( + $backgroundColor, + null, + $foregroundGradient, + $topLeftEyeFill, + $topRightEyeFill, + $bottomLeftEyeFill + ); + } + + public static function uniformColor(ColorInterface $backgroundColor, ColorInterface $foregroundColor) : self + { + return new self( + $backgroundColor, + $foregroundColor, + null, + EyeFill::inherit(), + EyeFill::inherit(), + EyeFill::inherit() + ); + } + + public static function uniformGradient(ColorInterface $backgroundColor, Gradient $foregroundGradient) : self + { + return new self( + $backgroundColor, + null, + $foregroundGradient, + EyeFill::inherit(), + EyeFill::inherit(), + EyeFill::inherit() + ); + } + + public function hasGradientFill() : bool + { + return null !== $this->foregroundGradient; + } + + public function getBackgroundColor() : ColorInterface + { + return $this->backgroundColor; + } + + public function getForegroundColor() : ColorInterface + { + if (null === $this->foregroundColor) { + throw new RuntimeException('Fill uses a gradient, thus no foreground color is available'); + } + + return $this->foregroundColor; + } + + public function getForegroundGradient() : Gradient + { + if (null === $this->foregroundGradient) { + throw new RuntimeException('Fill uses a single color, thus no foreground gradient is available'); + } + + return $this->foregroundGradient; + } + + public function getTopLeftEyeFill() : EyeFill + { + return $this->topLeftEyeFill; + } + + public function getTopRightEyeFill() : EyeFill + { + return $this->topRightEyeFill; + } + + public function getBottomLeftEyeFill() : EyeFill + { + return $this->bottomLeftEyeFill; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php b/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php new file mode 100755 index 0000000..3813dfd --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php @@ -0,0 +1,46 @@ +startColor = $startColor; + $this->endColor = $endColor; + $this->type = $type; + } + + public function getStartColor() : ColorInterface + { + return $this->startColor; + } + + public function getEndColor() : ColorInterface + { + return $this->endColor; + } + + public function getType() : GradientType + { + return $this->type; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/GradientType.php b/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/GradientType.php new file mode 100755 index 0000000..c1ca754 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/GradientType.php @@ -0,0 +1,22 @@ +margin = $margin; + $this->size = $size; + $this->module = $module ?: SquareModule::instance(); + $this->eye = $eye ?: new ModuleEye($this->module); + $this->fill = $fill ?: Fill::default(); + } + + public function withSize(int $size) : self + { + $style = clone $this; + $style->size = $size; + return $style; + } + + public function withMargin(int $margin) : self + { + $style = clone $this; + $style->margin = $margin; + return $style; + } + + public function getSize() : int + { + return $this->size; + } + + public function getMargin() : int + { + return $this->margin; + } + + public function getModule() : ModuleInterface + { + return $this->module; + } + + public function getEye() : EyeInterface + { + return $this->eye; + } + + public function getFill() : Fill + { + return $this->fill; + } +} diff --git a/vendor/bacon/bacon-qr-code/src/Writer.php b/vendor/bacon/bacon-qr-code/src/Writer.php new file mode 100755 index 0000000..d5bdc5c --- /dev/null +++ b/vendor/bacon/bacon-qr-code/src/Writer.php @@ -0,0 +1,71 @@ +renderer = $renderer; + } + + /** + * 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 + */ + public function writeString( + string $content, + string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, + ?ErrorCorrectionLevel $ecLevel = null, + ?Version $forcedVersion = null + ) : string { + if (strlen($content) === 0) { + throw new InvalidArgumentException('Found empty contents'); + } + + if (null === $ecLevel) { + $ecLevel = ErrorCorrectionLevel::L(); + } + + return $this->renderer->render(Encoder::encode($content, $ecLevel, $encoding, $forcedVersion)); + } + + /** + * Writes QR code to a file. + * + * @see Writer::writeString() + */ + public function writeFile( + string $content, + string $filename, + string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, + ?ErrorCorrectionLevel $ecLevel = null, + ?Version $forcedVersion = null + ) : void { + file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel, $forcedVersion)); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php b/vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php new file mode 100755 index 0000000..add798b --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php @@ -0,0 +1,222 @@ +assertFalse($array->get($i)); + $array->set($i); + $this->assertTrue($array->get($i)); + } + } + + public function testGetNextSet1() : void + { + $array = new BitArray(32); + + for ($i = 0; $i < $array->getSize(); ++$i) { + if ($this->getPhpUnitMajorVersion() === 7) { + $this->assertEquals($i, 32, '', $array->getNextSet($i)); + } else { + $this->assertEqualsWithDelta($i, 32, $array->getNextSet($i)); + } + } + + $array = new BitArray(33); + + for ($i = 0; $i < $array->getSize(); ++$i) { + if ($this->getPhpUnitMajorVersion() === 7) { + $this->assertEquals($i, 33, '', $array->getNextSet($i)); + } else { + $this->assertEqualsWithDelta($i, 33, $array->getNextSet($i)); + } + } + } + + public function testGetNextSet2() : void + { + $array = new BitArray(33); + + for ($i = 0; $i < $array->getSize(); ++$i) { + if ($this->getPhpUnitMajorVersion() === 7) { + $this->assertEquals($i, $i <= 31 ? 31 : 33, '', $array->getNextSet($i)); + } else { + $this->assertEqualsWithDelta($i, $i <= 31 ? 31 : 33, $array->getNextSet($i)); + } + } + + $array = new BitArray(33); + + for ($i = 0; $i < $array->getSize(); ++$i) { + if ($this->getPhpUnitMajorVersion() === 7) { + $this->assertEquals($i, 32, '', $array->getNextSet($i)); + } else { + $this->assertEqualsWithDelta($i, 32, $array->getNextSet($i)); + } + } + } + + public function testGetNextSet3() : void + { + $array = new BitArray(63); + $array->set(31); + $array->set(32); + + for ($i = 0; $i < $array->getSize(); ++$i) { + if ($i <= 31) { + $expected = 31; + } elseif ($i <= 32) { + $expected = 32; + } else { + $expected = 63; + } + + if ($this->getPhpUnitMajorVersion() === 7) { + $this->assertEquals($i, $expected, '', $array->getNextSet($i)); + } else { + $this->assertEqualsWithDelta($i, $expected, $array->getNextSet($i)); + } + } + } + + public function testGetNextSet4() : void + { + $array = new BitArray(63); + $array->set(33); + $array->set(40); + + for ($i = 0; $i < $array->getSize(); ++$i) { + if ($i <= 33) { + $expected = 33; + } elseif ($i <= 40) { + $expected = 40; + } else { + $expected = 63; + } + + if ($this->getPhpUnitMajorVersion() === 7) { + $this->assertEquals($i, $expected, '', $array->getNextSet($i)); + } else { + $this->assertEqualsWithDelta($i, $expected, $array->getNextSet($i)); + } + } + } + + public function testGetNextSet5() : void + { + mt_srand(0xdeadbeef, MT_RAND_PHP); + + for ($i = 0; $i < 10; ++$i) { + $array = new BitArray(mt_rand(1, 100)); + $numSet = mt_rand(0, 19); + + for ($j = 0; $j < $numSet; ++$j) { + $array->set(mt_rand(0, $array->getSize() - 1)); + } + + $numQueries = mt_rand(0, 19); + + for ($j = 0; $j < $numQueries; ++$j) { + $query = mt_rand(0, $array->getSize() - 1); + $expected = $query; + + while ($expected < $array->getSize() && ! $array->get($expected)) { + ++$expected; + } + + $actual = $array->getNextSet($query); + + if ($actual !== $expected) { + $array->getNextSet($query); + } + + $this->assertEquals($expected, $actual); + } + } + } + + public function testSetBulk() : void + { + $array = new BitArray(64); + $array->setBulk(32, 0xFFFF0000); + + for ($i = 0; $i < 48; ++$i) { + $this->assertFalse($array->get($i)); + } + + for ($i = 48; $i < 64; ++$i) { + $this->assertTrue($array->get($i)); + } + } + + public function testClear() : void + { + $array = new BitArray(32); + + for ($i = 0; $i < 32; ++$i) { + $array->set($i); + } + + $array->clear(); + + for ($i = 0; $i < 32; ++$i) { + $this->assertFalse($array->get($i)); + } + } + + public function testGetArray() : void + { + $array = new BitArray(64); + $array->set(0); + $array->set(63); + + $ints = $array->getBitArray(); + + $this->assertSame(1, $ints[0]); + $this->assertSame(0x80000000, $ints[1]); + } + + public function testIsRange() : void + { + $array = new BitArray(64); + $this->assertTrue($array->isRange(0, 64, false)); + $this->assertFalse($array->isRange(0, 64, true)); + + $array->set(32); + $this->assertTrue($array->isRange(32, 33, true)); + + $array->set(31); + $this->assertTrue($array->isRange(31, 33, true)); + + $array->set(34); + $this->assertFalse($array->isRange(31, 35, true)); + + for ($i = 0; $i < 31; ++$i) { + $array->set($i); + } + + $this->assertTrue($array->isRange(0, 33, true)); + + for ($i = 33; $i < 64; ++$i) { + $array->set($i); + } + + $this->assertTrue($array->isRange(0, 64, true)); + $this->assertFalse($array->isRange(0, 64, false)); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php b/vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php new file mode 100755 index 0000000..8ad86d4 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php @@ -0,0 +1,115 @@ +assertEquals(33, $matrix->getHeight()); + + for ($y = 0; $y < 33; ++$y) { + for ($x = 0; $x < 33; ++$x) { + if ($y * $x % 3 === 0) { + $matrix->set($x, $y); + } + } + } + + for ($y = 0; $y < 33; $y++) { + for ($x = 0; $x < 33; ++$x) { + $this->assertSame(0 === $x * $y % 3, $matrix->get($x, $y)); + } + } + } + + public function testSetRegion() : void + { + $matrix = new BitMatrix(5); + $matrix->setRegion(1, 1, 3, 3); + + for ($y = 0; $y < 5; ++$y) { + for ($x = 0; $x < 5; ++$x) { + $this->assertSame($y >= 1 && $y <= 3 && $x >= 1 && $x <= 3, $matrix->get($x, $y)); + } + } + } + + public function testRectangularMatrix() : void + { + $matrix = new BitMatrix(75, 20); + $this->assertSame(75, $matrix->getWidth()); + $this->assertSame(20, $matrix->getHeight()); + + $matrix->set(10, 0); + $matrix->set(11, 1); + $matrix->set(50, 2); + $matrix->set(51, 3); + $matrix->flip(74, 4); + $matrix->flip(0, 5); + + $this->assertTrue($matrix->get(10, 0)); + $this->assertTrue($matrix->get(11, 1)); + $this->assertTrue($matrix->get(50, 2)); + $this->assertTrue($matrix->get(51, 3)); + $this->assertTrue($matrix->get(74, 4)); + $this->assertTrue($matrix->get(0, 5)); + + $matrix->flip(50, 2); + $matrix->flip(51, 3); + + $this->assertFalse($matrix->get(50, 2)); + $this->assertFalse($matrix->get(51, 3)); + } + + public function testRectangularSetRegion() : void + { + $matrix = new BitMatrix(320, 240); + $this->assertSame(320, $matrix->getWidth()); + $this->assertSame(240, $matrix->getHeight()); + + $matrix->setRegion(105, 22, 80, 12); + + for ($y = 0; $y < 240; ++$y) { + for ($x = 0; $x < 320; ++$x) { + $this->assertEquals($y >= 22 && $y < 34 && $x >= 105 && $x < 185, $matrix->get($x, $y)); + } + } + } + + public function testGetRow() : void + { + $matrix = new BitMatrix(102, 5); + + for ($x = 0; $x < 102; ++$x) { + if (0 === ($x & 3)) { + $matrix->set($x, 2); + } + } + + $array1 = $matrix->getRow(2, null); + $this->assertSame(102, $array1->getSize()); + + $array2 = new BitArray(60); + $array2 = $matrix->getRow(2, $array2); + $this->assertSame(102, $array2->getSize()); + + $array3 = new BitArray(200); + $array3 = $matrix->getRow(2, $array3); + $this->assertSame(200, $array3->getSize()); + + for ($x = 0; $x < 102; ++$x) { + $on = (0 === ($x & 3)); + + $this->assertSame($on, $array1->get($x)); + $this->assertSame($on, $array2->get($x)); + $this->assertSame($on, $array3->get($x)); + } + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php b/vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php new file mode 100755 index 0000000..2904d31 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php @@ -0,0 +1,25 @@ +assertSame(1, BitUtils::unsignedRightShift(1, 0)); + $this->assertSame(1, BitUtils::unsignedRightShift(10, 3)); + $this->assertSame(536870910, BitUtils::unsignedRightShift(-10, 3)); + } + + public function testNumberOfTrailingZeros() : void + { + $this->assertSame(32, BitUtils::numberOfTrailingZeros(0)); + $this->assertSame(1, BitUtils::numberOfTrailingZeros(10)); + $this->assertSame(0, BitUtils::numberOfTrailingZeros(15)); + $this->assertSame(2, BitUtils::numberOfTrailingZeros(20)); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php b/vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php new file mode 100755 index 0000000..369b5d9 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php @@ -0,0 +1,25 @@ +assertSame(0x0, ErrorCorrectionLevel::M()->getBits()); + $this->assertSame(0x1, ErrorCorrectionLevel::L()->getBits()); + $this->assertSame(0x2, ErrorCorrectionLevel::H()->getBits()); + $this->assertSame(0x3, ErrorCorrectionLevel::Q()->getBits()); + } + + public function testInvalidErrorCorrectionLevelThrowsException() : void + { + $this->expectException(OutOfBoundsException::class); + ErrorCorrectionLevel::forBits(4); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php b/vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php new file mode 100755 index 0000000..39534a2 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php @@ -0,0 +1,94 @@ +assertSame(0, FormatInformation::numBitsDiffering(1, 1)); + $this->assertSame(1, FormatInformation::numBitsDiffering(0, 2)); + $this->assertSame(2, FormatInformation::numBitsDiffering(1, 2)); + $this->assertEquals(32, FormatInformation::numBitsDiffering(-1, 0)); + } + + public function testDecode() : void + { + $expected = FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO, + self::MASKED_TEST_FORMAT_INFO + ); + + $this->assertNotNull($expected); + $this->assertSame(7, $expected->getDataMask()); + $this->assertSame(ErrorCorrectionLevel::Q(), $expected->getErrorCorrectionLevel()); + + $this->assertEquals( + $expected, + FormatInformation::decodeFormatInformation( + self::UNMAKSED_TEST_FORMAT_INFO, + self::MASKED_TEST_FORMAT_INFO + ) + ); + } + + public function testDecodeWithBitDifference() : void + { + $expected = FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO, + self::MASKED_TEST_FORMAT_INFO + ); + + $this->assertEquals( + $expected, + FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO ^ 0x1, + self::MASKED_TEST_FORMAT_INFO ^ 0x1 + ) + ); + $this->assertEquals( + $expected, + FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO ^ 0x3, + self::MASKED_TEST_FORMAT_INFO ^ 0x3 + ) + ); + $this->assertEquals( + $expected, + FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO ^ 0x7, + self::MASKED_TEST_FORMAT_INFO ^ 0x7 + ) + ); + $this->assertNull( + FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO ^ 0xf, + self::MASKED_TEST_FORMAT_INFO ^ 0xf + ) + ); + } + + public function testDecodeWithMisRead() : void + { + $expected = FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO, + self::MASKED_TEST_FORMAT_INFO + ); + + $this->assertEquals( + $expected, + FormatInformation::decodeFormatInformation( + self::MASKED_TEST_FORMAT_INFO ^ 0x3, + self::MASKED_TEST_FORMAT_INFO ^ 0xf + ) + ); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/ModeTest.php b/vendor/bacon/bacon-qr-code/test/Common/ModeTest.php new file mode 100755 index 0000000..51fcb3e --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/ModeTest.php @@ -0,0 +1,19 @@ +assertSame(0x0, Mode::TERMINATOR()->getBits()); + $this->assertSame(0x1, Mode::NUMERIC()->getBits()); + $this->assertSame(0x2, Mode::ALPHANUMERIC()->getBits()); + $this->assertSame(0x4, Mode::BYTE()->getBits()); + $this->assertSame(0x8, Mode::KANJI()->getBits()); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php b/vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php new file mode 100755 index 0000000..47975b5 --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php @@ -0,0 +1,96 @@ +encode($block, $parity); + + // Copy parity into test blocks + for ($i = 0; $i < $numRoots; ++$i) { + $block[$i + $dataSize] = $parity[$i]; + $tBlock[$i + $dataSize] = $parity[$i]; + } + + // Seed with errors + for ($i = 0; $i < $errors; ++$i) { + $errorValue = mt_rand(1, $blockSize); + + do { + $errorLocation = mt_rand(0, $blockSize); + } while (0 !== $errorLocations[$errorLocation]); + + $errorLocations[$errorLocation] = 1; + + if (mt_rand(0, 1)) { + $erasures[] = $errorLocation; + } + + $tBlock[$errorLocation] ^= $errorValue; + } + + $erasures = SplFixedArray::fromArray($erasures, false); + + // Decode the errored block + $foundErrors = $codec->decode($tBlock, $erasures); + + if ($errors > 0 && null === $foundErrors) { + $this->assertSame($block, $tBlock, 'Decoder failed to correct errors'); + } + + $this->assertSame($errors, $foundErrors, 'Found errors do not equal expected errors'); + + for ($i = 0; $i < $foundErrors; ++$i) { + if (0 === $errorLocations[$erasures[$i]]) { + $this->fail(sprintf('Decoder indicates error in location %d without error', $erasures[$i])); + } + } + + $this->assertEquals($block, $tBlock, 'Decoder did not correct errors'); + } + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Common/VersionTest.php b/vendor/bacon/bacon-qr-code/test/Common/VersionTest.php new file mode 100755 index 0000000..f6f038b --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Common/VersionTest.php @@ -0,0 +1,78 @@ +assertNotNull($version); + $this->assertEquals($versionNumber, $version->getVersionNumber()); + $this->assertNotNull($version->getAlignmentPatternCenters()); + + if ($versionNumber > 1) { + $this->assertTrue(count($version->getAlignmentPatternCenters()) > 0); + } + + $this->assertEquals($dimension, $version->getDimensionForVersion()); + $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::H())); + $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::L())); + $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::M())); + $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::Q())); + $this->assertNotNull($version->buildFunctionPattern()); + } + + /** + * @dataProvider versions + */ + public function testGetProvisionalVersionForDimension(int $versionNumber, int $dimension) : void + { + $this->assertSame( + $versionNumber, + Version::getProvisionalVersionForDimension($dimension)->getVersionNumber() + ); + } + + /** + * @dataProvider decodeInformation + */ + public function testDecodeVersionInformation(int $expectedVersion, int $mask) : void + { + $version = Version::decodeVersionInformation($mask); + $this->assertNotNull($version); + $this->assertSame($expectedVersion, $version->getVersionNumber()); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php b/vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php new file mode 100755 index 0000000..9baa66b --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php @@ -0,0 +1,487 @@ +getMethods(ReflectionMethod::IS_STATIC) as $method) { + $method->setAccessible(true); + $this->methods[$method->getName()] = $method; + } + } + + public function testGetAlphanumericCode() : void + { + // The first ten code points are numbers. + for ($i = 0; $i < 10; ++$i) { + $this->assertSame($i, $this->methods['getAlphanumericCode']->invoke(null, ord('0') + $i)); + } + + // The next 26 code points are capital alphabet letters. + for ($i = 10; $i < 36; ++$i) { + // The first ten code points are numbers + $this->assertSame($i, $this->methods['getAlphanumericCode']->invoke(null, ord('A') + $i - 10)); + } + + // Others are symbol letters. + $this->assertSame(36, $this->methods['getAlphanumericCode']->invoke(null, ord(' '))); + $this->assertSame(37, $this->methods['getAlphanumericCode']->invoke(null, ord('$'))); + $this->assertSame(38, $this->methods['getAlphanumericCode']->invoke(null, ord('%'))); + $this->assertSame(39, $this->methods['getAlphanumericCode']->invoke(null, ord('*'))); + $this->assertSame(40, $this->methods['getAlphanumericCode']->invoke(null, ord('+'))); + $this->assertSame(41, $this->methods['getAlphanumericCode']->invoke(null, ord('-'))); + $this->assertSame(42, $this->methods['getAlphanumericCode']->invoke(null, ord('.'))); + $this->assertSame(43, $this->methods['getAlphanumericCode']->invoke(null, ord('/'))); + $this->assertSame(44, $this->methods['getAlphanumericCode']->invoke(null, ord(':'))); + + // Should return -1 for other letters. + $this->assertSame(-1, $this->methods['getAlphanumericCode']->invoke(null, ord('a'))); + $this->assertSame(-1, $this->methods['getAlphanumericCode']->invoke(null, ord('#'))); + $this->assertSame(-1, $this->methods['getAlphanumericCode']->invoke(null, ord("\0"))); + } + + public function testChooseMode() : void + { + // Numeric mode + $this->assertSame(Mode::NUMERIC(), $this->methods['chooseMode']->invoke(null, '0')); + $this->assertSame(Mode::NUMERIC(), $this->methods['chooseMode']->invoke(null, '0123456789')); + + // Alphanumeric mode + $this->assertSame(Mode::ALPHANUMERIC(), $this->methods['chooseMode']->invoke(null, 'A')); + $this->assertSame( + Mode::ALPHANUMERIC(), + $this->methods['chooseMode']->invoke(null, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:') + ); + + // 8-bit byte mode + $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, 'a')); + $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, '#')); + $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, '')); + + // AIUE in Hiragana in SHIFT-JIS + $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, "\x8\xa\x8\xa\x8\xa\x8\xa6")); + + // Nihon in Kanji in SHIFT-JIS + $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, "\x9\xf\x9\x7b")); + + // Sou-Utso-Byou in Kanji in SHIFT-JIS + $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, "\xe\x4\x9\x5\x9\x61")); + } + + public function testEncode() : void + { + $qrCode = Encoder::encode('ABCDEF', ErrorCorrectionLevel::H()); + $expected = "<<\n" + . " mode: ALPHANUMERIC\n" + . " ecLevel: H\n" + . " version: 1\n" + . " maskPattern: 0\n" + . " matrix:\n" + . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + . " 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0\n" + . " 0 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1\n" + . " 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0\n" + . " 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1 0\n" + . " 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0\n" + . " 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0\n" + . " 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 0 1 0 0 0\n" + . " 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1\n" + . " 1 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0\n" + . " 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1\n" + . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1\n" + . ">>\n"; + + $this->assertSame($expected, (string) $qrCode); + } + + public function testSimpleUtf8Eci() : void + { + $qrCode = Encoder::encode('hello', ErrorCorrectionLevel::H(), 'utf-8'); + $expected = "<<\n" + . " mode: BYTE\n" + . " ecLevel: H\n" + . " version: 1\n" + . " maskPattern: 3\n" + . " matrix:\n" + . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" + . " 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 1 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0\n" + . " 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 1 0\n" + . " 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 1 1 1\n" + . " 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0\n" + . " 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0\n" + . " 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0\n" + . " 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0\n" + . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0\n" + . " 1 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0\n" + . " 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0\n" + . " 1 1 1 1 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0 0\n" + . ">>\n"; + + $this->assertSame($expected, (string) $qrCode); + } + + public function testAppendModeInfo() : void + { + $bits = new BitArray(); + $this->methods['appendModeInfo']->invoke(null, Mode::NUMERIC(), $bits); + $this->assertSame(' ...X', (string) $bits); + } + + public function testAppendLengthInfo() : void + { + // 1 letter (1/1), 10 bits. + $bits = new BitArray(); + $this->methods['appendLengthInfo']->invoke( + null, + 1, + Version::getVersionForNumber(1), + Mode::NUMERIC(), + $bits + ); + $this->assertSame(' ........ .X', (string) $bits); + + // 2 letters (2/1), 11 bits. + $bits = new BitArray(); + $this->methods['appendLengthInfo']->invoke( + null, + 2, + Version::getVersionForNumber(10), + Mode::ALPHANUMERIC(), + $bits + ); + $this->assertSame(' ........ .X.', (string) $bits); + + // 255 letters (255/1), 16 bits. + $bits = new BitArray(); + $this->methods['appendLengthInfo']->invoke( + null, + 255, + Version::getVersionForNumber(27), + Mode::BYTE(), + $bits + ); + $this->assertSame(' ........ XXXXXXXX', (string) $bits); + + // 512 letters (1024/2), 12 bits. + $bits = new BitArray(); + $this->methods['appendLengthInfo']->invoke( + null, + 512, + Version::getVersionForNumber(40), + Mode::KANJI(), + $bits + ); + $this->assertSame(' ..X..... ....', (string) $bits); + } + + public function testAppendBytes() : void + { + // Should use appendNumericBytes. + // 1 = 01 = 0001 in 4 bits. + $bits = new BitArray(); + $this->methods['appendBytes']->invoke( + null, + '1', + Mode::NUMERIC(), + $bits, + Encoder::DEFAULT_BYTE_MODE_ECODING + ); + $this->assertSame(' ...X', (string) $bits); + + // Should use appendAlphaNumericBytes. + // A = 10 = 0xa = 001010 in 6 bits. + $bits = new BitArray(); + $this->methods['appendBytes']->invoke( + null, + 'A', + Mode::ALPHANUMERIC(), + $bits, + Encoder::DEFAULT_BYTE_MODE_ECODING + ); + $this->assertSame(' ..X.X.', (string) $bits); + + // Should use append8BitBytes. + // 0x61, 0x62, 0x63 + $bits = new BitArray(); + $this->methods['appendBytes']->invoke( + null, + 'abc', + Mode::BYTE(), + $bits, + Encoder::DEFAULT_BYTE_MODE_ECODING + ); + $this->assertSame(' .XX....X .XX...X. .XX...XX', (string) $bits); + + // Should use appendKanjiBytes. + // 0x93, 0x5f + $bits = new BitArray(); + $this->methods['appendBytes']->invoke( + null, + "\x93\x5f", + Mode::KANJI(), + $bits, + Encoder::DEFAULT_BYTE_MODE_ECODING + ); + $this->assertSame(' .XX.XX.. XXXXX', (string) $bits); + + // Lower letters such as 'a' cannot be encoded in alphanumeric mode. + $this->expectException(WriterException::class); + $this->methods['appendBytes']->invoke( + null, + 'a', + Mode::ALPHANUMERIC(), + $bits, + Encoder::DEFAULT_BYTE_MODE_ECODING + ); + } + + public function testTerminateBits() : void + { + $bits = new BitArray(); + $this->methods['terminateBits']->invoke(null, 0, $bits); + $this->assertSame('', (string) $bits); + + $bits = new BitArray(); + $this->methods['terminateBits']->invoke(null, 1, $bits); + $this->assertSame(' ........', (string) $bits); + + $bits = new BitArray(); + $bits->appendBits(0, 3); + $this->methods['terminateBits']->invoke(null, 1, $bits); + $this->assertSame(' ........', (string) $bits); + + $bits = new BitArray(); + $bits->appendBits(0, 5); + $this->methods['terminateBits']->invoke(null, 1, $bits); + $this->assertSame(' ........', (string) $bits); + + $bits = new BitArray(); + $bits->appendBits(0, 8); + $this->methods['terminateBits']->invoke(null, 1, $bits); + $this->assertSame(' ........', (string) $bits); + + $bits = new BitArray(); + $this->methods['terminateBits']->invoke(null, 2, $bits); + $this->assertSame(' ........ XXX.XX..', (string) $bits); + + $bits = new BitArray(); + $bits->appendBits(0, 1); + $this->methods['terminateBits']->invoke(null, 3, $bits); + $this->assertSame(' ........ XXX.XX.. ...X...X', (string) $bits); + } + + public function testGetNumDataBytesAndNumEcBytesForBlockId() : void + { + // Version 1-H. + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 26, 9, 1, 0); + $this->assertSame(9, $numDataBytes); + $this->assertSame(17, $numEcBytes); + + // Version 3-H. 2 blocks. + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 70, 26, 2, 0); + $this->assertSame(13, $numDataBytes); + $this->assertSame(22, $numEcBytes); + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 70, 26, 2, 1); + $this->assertSame(13, $numDataBytes); + $this->assertSame(22, $numEcBytes); + + // Version 7-H. (4 + 1) blocks. + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 196, 66, 5, 0); + $this->assertSame(13, $numDataBytes); + $this->assertSame(26, $numEcBytes); + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 196, 66, 5, 4); + $this->assertSame(14, $numDataBytes); + $this->assertSame(26, $numEcBytes); + + // Version 40-H. (20 + 61) blocks. + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 3706, 1276, 81, 0); + $this->assertSame(15, $numDataBytes); + $this->assertSame(30, $numEcBytes); + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 3706, 1276, 81, 20); + $this->assertSame(16, $numDataBytes); + $this->assertSame(30, $numEcBytes); + list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId'] + ->invoke(null, 3706, 1276, 81, 80); + $this->assertSame(16, $numDataBytes); + $this->assertSame(30, $numEcBytes); + } + + public function testInterleaveWithEcBytes() : void + { + $dataBytes = SplFixedArray::fromArray([32, 65, 205, 69, 41, 220, 46, 128, 236], false); + $in = new BitArray(); + + foreach ($dataBytes as $dataByte) { + $in->appendBits($dataByte, 8); + } + + $outBits = $this->methods['interleaveWithEcBytes']->invoke(null, $in, 26, 9, 1); + $expected = SplFixedArray::fromArray([ + // Data bytes. + 32, 65, 205, 69, 41, 220, 46, 128, 236, + // Error correction bytes. + 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61, + ], false); + + $out = $outBits->toBytes(0, count($expected)); + + $this->assertEquals($expected, $out); + } + + public function testAppendNumericBytes() : void + { + // 1 = 01 = 0001 in 4 bits. + $bits = new BitArray(); + $this->methods['appendNumericBytes']->invoke(null, '1', $bits); + $this->assertSame(' ...X', (string) $bits); + + // 12 = 0xc = 0001100 in 7 bits. + $bits = new BitArray(); + $this->methods['appendNumericBytes']->invoke(null, '12', $bits); + $this->assertSame(' ...XX..', (string) $bits); + + // 123 = 0x7b = 0001111011 in 10 bits. + $bits = new BitArray(); + $this->methods['appendNumericBytes']->invoke(null, '123', $bits); + $this->assertSame(' ...XXXX. XX', (string) $bits); + + // 1234 = "123" + "4" = 0001111011 + 0100 in 14 bits. + $bits = new BitArray(); + $this->methods['appendNumericBytes']->invoke(null, '1234', $bits); + $this->assertSame(' ...XXXX. XX.X..', (string) $bits); + + // Empty + $bits = new BitArray(); + $this->methods['appendNumericBytes']->invoke(null, '', $bits); + $this->assertSame('', (string) $bits); + } + + public function testAppendAlphanumericBytes() : void + { + $bits = new BitArray(); + $this->methods['appendAlphanumericBytes']->invoke(null, 'A', $bits); + $this->assertSame(' ..X.X.', (string) $bits); + + $bits = new BitArray(); + $this->methods['appendAlphanumericBytes']->invoke(null, 'AB', $bits); + $this->assertSame(' ..XXX..X X.X', (string) $bits); + + $bits = new BitArray(); + $this->methods['appendAlphanumericBytes']->invoke(null, 'ABC', $bits); + $this->assertSame(' ..XXX..X X.X..XX. .', (string) $bits); + + // Empty + $bits = new BitArray(); + $this->methods['appendAlphanumericBytes']->invoke(null, '', $bits); + $this->assertSame('', (string) $bits); + + // Invalid data + $this->expectException(WriterException::class); + $bits = new BitArray(); + $this->methods['appendAlphanumericBytes']->invoke(null, 'abc', $bits); + } + + public function testAppend8BitBytes() : void + { + // 0x61, 0x62, 0x63 + $bits = new BitArray(); + $this->methods['append8BitBytes']->invoke(null, 'abc', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING); + $this->assertSame(' .XX....X .XX...X. .XX...XX', (string) $bits); + + // Empty + $bits = new BitArray(); + $this->methods['append8BitBytes']->invoke(null, '', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING); + $this->assertSame('', (string) $bits); + } + + public function testAppendKanjiBytes() : void + { + // Numbers are from page 21 of JISX0510:2004 + $bits = new BitArray(); + $this->methods['appendKanjiBytes']->invoke(null, "\x93\x5f", $bits); + $this->assertSame(' .XX.XX.. XXXXX', (string) $bits); + + $this->methods['appendKanjiBytes']->invoke(null, "\xe4\xaa", $bits); + $this->assertSame(' .XX.XX.. XXXXXXX. X.X.X.X. X.', (string) $bits); + } + + public function testGenerateEcBytes() : void + { + // Numbers are from http://www.swetake.com/qr/qr3.html and + // http://www.swetake.com/qr/qr9.html + $dataBytes = SplFixedArray::fromArray([32, 65, 205, 69, 41, 220, 46, 128, 236], false); + $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17); + $expected = SplFixedArray::fromArray( + [42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61], + false + ); + $this->assertEquals($expected, $ecBytes); + + $dataBytes = SplFixedArray::fromArray( + [67, 70, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214], + false + ); + $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 18); + $expected = SplFixedArray::fromArray( + [175, 80, 155, 64, 178, 45, 214, 233, 65, 209, 12, 155, 117, 31, 140, 214, 27, 187], + false + ); + $this->assertEquals($expected, $ecBytes); + + // High-order zero coefficient case. + $dataBytes = SplFixedArray::fromArray([32, 49, 205, 69, 42, 20, 0, 236, 17], false); + $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17); + $expected = SplFixedArray::fromArray( + [0, 3, 130, 179, 194, 0, 55, 211, 110, 79, 98, 72, 170, 96, 211, 137, 213], + false + ); + $this->assertEquals($expected, $ecBytes); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php b/vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php new file mode 100755 index 0000000..46670fc --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php @@ -0,0 +1,251 @@ +assertSame( + 1 === $expected[$y][$x], + MaskUtil::getDataMaskBit($maskPattern, $x, $y) + ); + } + } + } + + public function testApplyMaskPenaltyRule1() : void + { + $matrix = new ByteMatrix(4, 1); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 0); + $matrix->set(2, 0, 0); + $matrix->set(3, 0, 0); + + $this->assertSame(0, MaskUtil::applyMaskPenaltyRule1($matrix)); + + // Horizontal + $matrix = new ByteMatrix(6, 1); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 0); + $matrix->set(2, 0, 0); + $matrix->set(3, 0, 0); + $matrix->set(4, 0, 0); + $matrix->set(5, 0, 1); + $this->assertSame(3, MaskUtil::applyMaskPenaltyRule1($matrix)); + $matrix->set(5, 0, 0); + $this->assertSame(4, MaskUtil::applyMaskPenaltyRule1($matrix)); + + // Vertical + $matrix = new ByteMatrix(1, 6); + $matrix->set(0, 0, 0); + $matrix->set(0, 1, 0); + $matrix->set(0, 2, 0); + $matrix->set(0, 3, 0); + $matrix->set(0, 4, 0); + $matrix->set(0, 5, 1); + $this->assertSame(3, MaskUtil::applyMaskPenaltyRule1($matrix)); + $matrix->set(0, 5, 0); + $this->assertSame(4, MaskUtil::applyMaskPenaltyRule1($matrix)); + } + + public function testApplyMaskPenaltyRule2() : void + { + $matrix = new ByteMatrix(1, 1); + $matrix->set(0, 0, 0); + $this->assertSame(0, MaskUtil::applyMaskPenaltyRule2($matrix)); + + $matrix = new ByteMatrix(2, 2); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 0); + $matrix->set(0, 1, 0); + $matrix->set(1, 1, 1); + $this->assertSame(0, MaskUtil::applyMaskPenaltyRule2($matrix)); + + $matrix = new ByteMatrix(2, 2); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 0); + $matrix->set(0, 1, 0); + $matrix->set(1, 1, 0); + $this->assertSame(3, MaskUtil::applyMaskPenaltyRule2($matrix)); + + $matrix = new ByteMatrix(3, 3); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 0); + $matrix->set(2, 0, 0); + $matrix->set(0, 1, 0); + $matrix->set(1, 1, 0); + $matrix->set(2, 1, 0); + $matrix->set(0, 2, 0); + $matrix->set(1, 2, 0); + $matrix->set(2, 2, 0); + $this->assertSame(3 * 4, MaskUtil::applyMaskPenaltyRule2($matrix)); + } + + public function testApplyMaskPenalty3() : void + { + // Horizontal 00001011101 + $matrix = new ByteMatrix(11, 1); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 0); + $matrix->set(2, 0, 0); + $matrix->set(3, 0, 0); + $matrix->set(4, 0, 1); + $matrix->set(5, 0, 0); + $matrix->set(6, 0, 1); + $matrix->set(7, 0, 1); + $matrix->set(8, 0, 1); + $matrix->set(9, 0, 0); + $matrix->set(10, 0, 1); + $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix)); + + // Horizontal 10111010000 + $matrix = new ByteMatrix(11, 1); + $matrix->set(0, 0, 1); + $matrix->set(1, 0, 0); + $matrix->set(2, 0, 1); + $matrix->set(3, 0, 1); + $matrix->set(4, 0, 1); + $matrix->set(5, 0, 0); + $matrix->set(6, 0, 1); + $matrix->set(7, 0, 0); + $matrix->set(8, 0, 0); + $matrix->set(9, 0, 0); + $matrix->set(10, 0, 0); + $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix)); + + // Vertical 00001011101 + $matrix = new ByteMatrix(1, 11); + $matrix->set(0, 0, 0); + $matrix->set(0, 1, 0); + $matrix->set(0, 2, 0); + $matrix->set(0, 3, 0); + $matrix->set(0, 4, 1); + $matrix->set(0, 5, 0); + $matrix->set(0, 6, 1); + $matrix->set(0, 7, 1); + $matrix->set(0, 8, 1); + $matrix->set(0, 9, 0); + $matrix->set(0, 10, 1); + $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix)); + + // Vertical 10111010000 + $matrix = new ByteMatrix(1, 11); + $matrix->set(0, 0, 1); + $matrix->set(0, 1, 0); + $matrix->set(0, 2, 1); + $matrix->set(0, 3, 1); + $matrix->set(0, 4, 1); + $matrix->set(0, 5, 0); + $matrix->set(0, 6, 1); + $matrix->set(0, 7, 0); + $matrix->set(0, 8, 0); + $matrix->set(0, 9, 0); + $matrix->set(0, 10, 0); + $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix)); + } + + public function testApplyMaskPenaltyRule4() : void + { + // Dark cell ratio = 0% + $matrix = new ByteMatrix(1, 1); + $matrix->set(0, 0, 0); + $this->assertSame(100, MaskUtil::applyMaskPenaltyRule4($matrix)); + + // Dark cell ratio = 5% + $matrix = new ByteMatrix(2, 1); + $matrix->set(0, 0, 0); + $matrix->set(0, 0, 1); + $this->assertSame(0, MaskUtil::applyMaskPenaltyRule4($matrix)); + + // Dark cell ratio = 66.67% + $matrix = new ByteMatrix(6, 1); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 1); + $matrix->set(2, 0, 1); + $matrix->set(3, 0, 1); + $matrix->set(4, 0, 1); + $matrix->set(5, 0, 0); + $this->assertSame(30, MaskUtil::applyMaskPenaltyRule4($matrix)); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php b/vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php new file mode 100755 index 0000000..106ceaa --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php @@ -0,0 +1,335 @@ +getMethods(ReflectionMethod::IS_STATIC) as $method) { + $method->setAccessible(true); + $this->methods[$method->getName()] = $method; + } + } + + public function testToString() : void + { + $matrix = new ByteMatrix(3, 3); + $matrix->set(0, 0, 0); + $matrix->set(1, 0, 1); + $matrix->set(2, 0, 0); + $matrix->set(0, 1, 1); + $matrix->set(1, 1, 0); + $matrix->set(2, 1, 1); + $matrix->set(0, 2, -1); + $matrix->set(1, 2, -1); + $matrix->set(2, 2, -1); + + $expected = " 0 1 0\n 1 0 1\n \n"; + $this->assertSame($expected, (string) $matrix); + } + + public function testClearMatrix() : void + { + $matrix = new ByteMatrix(2, 2); + MatrixUtil::clearMatrix($matrix); + + $this->assertSame(-1, $matrix->get(0, 0)); + $this->assertSame(-1, $matrix->get(1, 0)); + $this->assertSame(-1, $matrix->get(0, 1)); + $this->assertSame(-1, $matrix->get(1, 1)); + } + + public function testEmbedBasicPatterns1() : void + { + $matrix = new ByteMatrix(21, 21); + MatrixUtil::clearMatrix($matrix); + $this->methods['embedBasicPatterns']->invoke( + null, + Version::getVersionForNumber(1), + $matrix + ); + $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 \n" + . " 0 \n" + . " 1 \n" + . " 0 \n" + . " 1 \n" + . " 0 0 0 0 0 0 0 0 1 \n" + . " 1 1 1 1 1 1 1 0 \n" + . " 1 0 0 0 0 0 1 0 \n" + . " 1 0 1 1 1 0 1 0 \n" + . " 1 0 1 1 1 0 1 0 \n" + . " 1 0 1 1 1 0 1 0 \n" + . " 1 0 0 0 0 0 1 0 \n" + . " 1 1 1 1 1 1 1 0 \n"; + + $this->assertSame($expected, (string) $matrix); + } + + public function testEmbedBasicPatterns2() : void + { + $matrix = new ByteMatrix(25, 25); + MatrixUtil::clearMatrix($matrix); + $this->methods['embedBasicPatterns']->invoke( + null, + Version::getVersionForNumber(2), + $matrix + ); + $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 \n" + . " 0 \n" + . " 1 \n" + . " 0 \n" + . " 1 \n" + . " 0 \n" + . " 1 \n" + . " 0 \n" + . " 1 1 1 1 1 1 \n" + . " 0 0 0 0 0 0 0 0 1 1 0 0 0 1 \n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 \n" + . " 1 0 0 0 0 0 1 0 1 0 0 0 1 \n" + . " 1 0 1 1 1 0 1 0 1 1 1 1 1 \n" + . " 1 0 1 1 1 0 1 0 \n" + . " 1 0 1 1 1 0 1 0 \n" + . " 1 0 0 0 0 0 1 0 \n" + . " 1 1 1 1 1 1 1 0 \n"; + + $this->assertSame($expected, (string) $matrix); + } + + public function testEmbedTypeInfo() : void + { + $matrix = new ByteMatrix(21, 21); + MatrixUtil::clearMatrix($matrix); + $this->methods['embedTypeInfo']->invoke( + null, + ErrorCorrectionLevel::M(), + 5, + $matrix + ); + $expected = " 0 \n" + . " 1 \n" + . " 1 \n" + . " 1 \n" + . " 0 \n" + . " 0 \n" + . " \n" + . " 1 \n" + . " 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0\n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " 0 \n" + . " 0 \n" + . " 0 \n" + . " 0 \n" + . " 0 \n" + . " 0 \n" + . " 1 \n"; + + $this->assertSame($expected, (string) $matrix); + } + + public function testEmbedVersionInfo() : void + { + $matrix = new ByteMatrix(21, 21); + MatrixUtil::clearMatrix($matrix); + $this->methods['maybeEmbedVersionInfo']->invoke( + null, + Version::getVersionForNumber(7), + $matrix + ); + $expected = " 0 0 1 \n" + . " 0 1 0 \n" + . " 0 1 0 \n" + . " 0 1 1 \n" + . " 1 1 1 \n" + . " 0 0 0 \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " 0 0 0 0 1 0 \n" + . " 0 1 1 1 1 0 \n" + . " 1 0 0 1 1 0 \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n"; + + $this->assertSame($expected, (string) $matrix); + } + + public function testEmbedDataBits() : void + { + $matrix = new ByteMatrix(21, 21); + MatrixUtil::clearMatrix($matrix); + $this->methods['embedBasicPatterns']->invoke( + null, + Version::getVersionForNumber(1), + $matrix + ); + + $bits = new BitArray(); + $this->methods['embedDataBits']->invoke( + null, + $bits, + -1, + $matrix + ); + + $expected = " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"; + + $this->assertSame($expected, (string) $matrix); + } + + public function testBuildMatrix() : void + { + $bytes = [ + 32, 65, 205, 69, 41, 220, 46, 128, 236, 42, 159, 74, 221, 244, 169, + 239, 150, 138, 70, 237, 85, 224, 96, 74, 219 , 61 + ]; + $bits = new BitArray(); + + foreach ($bytes as $byte) { + $bits->appendBits($byte, 8); + } + + $matrix = new ByteMatrix(21, 21); + MatrixUtil::buildMatrix( + $bits, + ErrorCorrectionLevel::H(), + Version::getVersionForNumber(1), + 3, + $matrix + ); + + $expected = " 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" + . " 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1\n" + . " 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1\n" + . " 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1\n" + . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0\n" + . " 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0\n" + . " 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0\n" + . " 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0\n" + . " 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 0\n" + . " 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1\n" + . " 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 1\n" + . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0\n" + . " 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0\n" + . " 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1\n" + . " 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0\n" + . " 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0\n" + . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0\n" + . " 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0\n"; + + $this->assertSame($expected, (string) $matrix); + } + + public function testFindMsbSet() : void + { + $this->assertSame(0, $this->methods['findMsbSet']->invoke(null, 0)); + $this->assertSame(1, $this->methods['findMsbSet']->invoke(null, 1)); + $this->assertSame(8, $this->methods['findMsbSet']->invoke(null, 0x80)); + $this->assertSame(32, $this->methods['findMsbSet']->invoke(null, 0x80000000)); + } + + public function testCalculateBchCode() : void + { + // Encoding of type information. + // From Appendix C in JISX0510:2004 (p 65) + $this->assertSame(0xdc, $this->methods['calculateBchCode']->invoke(null, 5, 0x537)); + // From http://www.swetake.com/qr/qr6.html + $this->assertSame(0x1c2, $this->methods['calculateBchCode']->invoke(null, 0x13, 0x537)); + // From http://www.swetake.com/qr/qr11.html + $this->assertSame(0x214, $this->methods['calculateBchCode']->invoke(null, 0x1b, 0x537)); + + // Encoding of version information. + // From Appendix D in JISX0510:2004 (p 68) + $this->assertSame(0xc94, $this->methods['calculateBchCode']->invoke(null, 7, 0x1f25)); + $this->assertSame(0x5bc, $this->methods['calculateBchCode']->invoke(null, 8, 0x1f25)); + $this->assertSame(0xa99, $this->methods['calculateBchCode']->invoke(null, 9, 0x1f25)); + $this->assertSame(0x4d3, $this->methods['calculateBchCode']->invoke(null, 10, 0x1f25)); + $this->assertSame(0x9a6, $this->methods['calculateBchCode']->invoke(null, 20, 0x1f25)); + $this->assertSame(0xd75, $this->methods['calculateBchCode']->invoke(null, 30, 0x1f25)); + $this->assertSame(0xc69, $this->methods['calculateBchCode']->invoke(null, 40, 0x1f25)); + } + + public function testMakeVersionInfoBits() : void + { + // From Appendix D in JISX0510:2004 (p 68) + $bits = new BitArray(); + $this->methods['makeVersionInfoBits']->invoke(null, Version::getVersionForNumber(7), $bits); + $this->assertSame(' ...XXXXX ..X..X.X ..', (string) $bits); + } + + public function testMakeTypeInfoBits() : void + { + // From Appendix D in JISX0510:2004 (p 68) + $bits = new BitArray(); + $this->methods['makeTypeInfoBits']->invoke(null, ErrorCorrectionLevel::M(), 5, $bits); + $this->assertSame(' X......X X..XXX.', (string) $bits); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php b/vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php new file mode 100755 index 0000000..39e44bf --- /dev/null +++ b/vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php @@ -0,0 +1,63 @@ +writeFile('Hello World!', $tempName); + + $this->assertMatchesFileSnapshot($tempName); + unlink($tempName); + } + + public function testIssue79() : void + { + $eye = SquareEye::instance(); + $squareModule = SquareModule::instance(); + + $eyeFill = new EyeFill(new Rgb(100, 100, 55), new Rgb(100, 100, 255)); + $gradient = new Gradient(new Rgb(100, 100, 55), new Rgb(100, 100, 255), GradientType::HORIZONTAL()); + + $renderer = new ImageRenderer( + new RendererStyle( + 400, + 2, + $squareModule, + $eye, + Fill::withForegroundGradient(new Rgb(255, 255, 255), $gradient, $eyeFill, $eyeFill, $eyeFill) + ), + new ImagickImageBackEnd() + ); + $writer = new Writer($renderer); + $tempName = tempnam(sys_get_temp_dir(), 'test') . '.png'; + $writer->writeFile('https://apiroad.net/very-long-url', $tempName); + + $this->assertMatchesFileSnapshot($tempName); + unlink($tempName); + } +} diff --git a/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testGenericQrCode__1.png b/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testGenericQrCode__1.png new file mode 100755 index 0000000000000000000000000000000000000000..9a429edc8c9005c7f0087ecd510f5d36a24f8782 GIT binary patch literal 3111 zcmai1c{r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jXo%zLq|gTLeE`*1k4n7)1 zH?&^LPZi{QlIW=G0h^4NYY6m>ubleUUw#2S=j`CC#-}f2M5X%8y<(&%X)z)Hl_J`qx+)L+0PriE6k+_hU>*2r|AV)hk zXsWat%~O;apkYOMe!dN2UN47q@dqJNmzkscEQc1ltYN`7AN%>CSL)YT8P?8$TS=^E=iDv4kJ?H1CY6hlV5=TLgHP3GxaOW3fwn6ita(_zX1lX?V0#D5CEO5< z*DODSi7k>Sh0AOWy+_d!2 H`Ro4$E5d|S literal 0 HcmV?d00001 diff --git a/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testIssue79__1.png b/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testIssue79__1.png new file mode 100755 index 0000000000000000000000000000000000000000..47e3b1a29055bcc05485c83053f497944417e881 GIT binary patch literal 8366 zcmb7p2UOGR_GPduA|irxkYeZvibxF#2uPD6CA3QsrT0z}EC?dKcT@}!F!UldR|G;w zS}1`agx(@0APFQB-n{o;_r6&(*Gbm5vXXo$=l7kx_c{B#d8Dt&aDn3j003an)>1bD z0O%5q*SRyaSHe+udT9@*p5D{D2LM#W(;wQMrak9#&@$2k077oicDw=rNXI*u0RaD- z0Kn=W0DwXU0C3GKr@>H(_Qn}|9Zhur_4xj-8Ier;Fi>0lo=MQ;#uUWM#6OR)MOg9U z(bjr)p7FZ4qwK}Y(s#RVCW#QUEP5UnyB_4xj^E<^upuoC2tZ z1OB!Ce>O!~c?^60?BFcxs`q8+^~;d3+>5ujNE0Bf)($1N5rqNApQ92&&IxBGr@9HuZU_7>`P zr4eA%!A^z*-zARuOQ{IZo{46-Q~!F zz2Kkt$|rRi>y(wvOWlJ7Ppdl=gMBIoFE1%DLEGEo+1&GCttb8(_i@aBkNfz-`~Z6t z0$xH6x1MeaH*xB7keh?mm z92y#PaAB%-3m!K-Iyl^UP*kjN_lNz>5adS*ON_RQOZ0ZcK{ooe!Od|g@*X#L&A>@s z<-FS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W=dv^hP1DMT_AB7ru;%G%-#EZ$x8~XTE##T>bFkeqOXzeV*MXy!Iu-pg(unH+ZFx(hac^)#+owyI;V-_b)O*d&32R#DUTs}HJg`|I)Ya@^=es=6(<`{4 zp|UWyuqGjP_C*q*6EIP^U>88XYgsY(-cY~X6_$6`u=$yd?~YleyXC^WfCr@vkBxj9 zKf>X{IlHD>=yhyhj0Ue}noy;EyW2+1aQzqR;gTLrvaTx-Tf4iRbX;6=92T8tS|piP zjCj<%y_>{sd3ZzfRd2Siif4%N7`!eZ`7Pzr$5y*y@6gF?(%EmCn@=jJpsR&EX#(cOlSOhhDGAU{epA)5i&SdR1Ow~VX~xsepztQ03dmA7xN zUEHF$K#W2CU1jHC*yI~R3adGp%8C|+`g-3v)U0yq@4wR4PP=*y$Y~uZV%*F6qS_5x zThDb8;J0O9{tuV^SU~ZSMpc=5jg DJV9~T literal 0 HcmV?d00001 diff --git a/vendor/bin/lessc b/vendor/bin/lessc new file mode 100755 index 0000000..7ae7f57 --- /dev/null +++ b/vendor/bin/lessc @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/wikimedia/less.php/bin/lessc'); + exit(0); + } +} + +include __DIR__ . '/..'.'/wikimedia/less.php/bin/lessc'; diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php new file mode 100755 index 0000000..afef3fa --- /dev/null +++ b/vendor/composer/ClassLoader.php @@ -0,0 +1,572 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-return array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php new file mode 100755 index 0000000..c6b54af --- /dev/null +++ b/vendor/composer/InstalledVersions.php @@ -0,0 +1,352 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints($constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + $installed[] = self::$installed; + + return $installed; + } +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100755 index 0000000..f27399a --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100755 index 0000000..35d5fc3 --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,11 @@ + $vendorDir . '/composer/InstalledVersions.php', + 'lessc' => $vendorDir . '/wikimedia/less.php/lessc.inc.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100755 index 0000000..8558de4 --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,10 @@ + array($vendorDir . '/wikimedia/less.php/lib'), +); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php new file mode 100755 index 0000000..570636e --- /dev/null +++ b/vendor/composer/autoload_psr4.php @@ -0,0 +1,12 @@ + array($vendorDir . '/endroid/qr-code/src'), + 'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'), + 'BaconQrCode\\' => array($vendorDir . '/bacon/bacon-qr-code/src'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100755 index 0000000..a81e37d --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,38 @@ +register(true); + + return $loader; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100755 index 0000000..c6b0153 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,64 @@ + + array ( + 'Endroid\\QrCode\\' => 15, + ), + 'D' => + array ( + 'DASPRiD\\Enum\\' => 13, + ), + 'B' => + array ( + 'BaconQrCode\\' => 12, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Endroid\\QrCode\\' => + array ( + 0 => __DIR__ . '/..' . '/endroid/qr-code/src', + ), + 'DASPRiD\\Enum\\' => + array ( + 0 => __DIR__ . '/..' . '/dasprid/enum/src', + ), + 'BaconQrCode\\' => + array ( + 0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src', + ), + ); + + public static $prefixesPsr0 = array ( + 'L' => + array ( + 'Less' => + array ( + 0 => __DIR__ . '/..' . '/wikimedia/less.php/lib', + ), + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'lessc' => __DIR__ . '/..' . '/wikimedia/less.php/lessc.inc.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$prefixesPsr0; + $loader->classMap = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100755 index 0000000..d43d4f1 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,260 @@ +{ + "packages": [ + { + "name": "bacon/bacon-qr-code", + "version": "2.0.7", + "version_normalized": "2.0.7.0", + "source": { + "type": "git", + "url": "https://github.com/Bacon/BaconQrCode.git", + "reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/d70c840f68657ce49094b8d91f9ee0cc07fbf66c", + "reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c", + "shasum": "" + }, + "require": { + "dasprid/enum": "^1.0.3", + "ext-iconv": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phly/keep-a-changelog": "^2.1", + "phpunit/phpunit": "^7 | ^8 | ^9", + "spatie/phpunit-snapshot-assertions": "^4.2.9", + "squizlabs/php_codesniffer": "^3.4" + }, + "suggest": { + "ext-imagick": "to generate QR code images" + }, + "time": "2022-03-14T02:02:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "BaconQrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "BaconQrCode is a QR code generator for PHP.", + "homepage": "https://github.com/Bacon/BaconQrCode", + "support": { + "issues": "https://github.com/Bacon/BaconQrCode/issues", + "source": "https://github.com/Bacon/BaconQrCode/tree/2.0.7" + }, + "install-path": "../bacon/bacon-qr-code" + }, + { + "name": "dasprid/enum", + "version": "1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/DASPRiD/Enum.git", + "reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2", + "reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^7 | ^8 | ^9", + "squizlabs/php_codesniffer": "^3.4" + }, + "time": "2020-10-02T16:03:48+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "DASPRiD\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "PHP 7.1 enum implementation", + "keywords": [ + "enum", + "map" + ], + "support": { + "issues": "https://github.com/DASPRiD/Enum/issues", + "source": "https://github.com/DASPRiD/Enum/tree/1.0.3" + }, + "install-path": "../dasprid/enum" + }, + { + "name": "endroid/qr-code", + "version": "4.4.9", + "version_normalized": "4.4.9.0", + "source": { + "type": "git", + "url": "https://github.com/endroid/qr-code.git", + "reference": "bf087fa1e93a1b7310e2d94d187e26ae51db199d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/qr-code/zipball/bf087fa1e93a1b7310e2d94d187e26ae51db199d", + "reference": "bf087fa1e93a1b7310e2d94d187e26ae51db199d", + "shasum": "" + }, + "require": { + "bacon/bacon-qr-code": "^2.0.5", + "php": "^7.4||^8.0" + }, + "require-dev": { + "endroid/quality": "dev-master", + "ext-gd": "*", + "khanamiryan/qrcode-detector-decoder": "^1.0.4", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "ext-gd": "Enables you to write PNG images", + "khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator", + "roave/security-advisories": "Makes sure package versions with known security issues are not installed", + "setasign/fpdf": "Enables you to use the PDF writer" + }, + "time": "2022-05-10T07:25:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Endroid\\QrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Endroid QR Code", + "homepage": "https://github.com/endroid/qr-code", + "keywords": [ + "code", + "endroid", + "php", + "qr", + "qrcode" + ], + "support": { + "issues": "https://github.com/endroid/qr-code/issues", + "source": "https://github.com/endroid/qr-code/tree/4.4.9" + }, + "funding": [ + { + "url": "https://github.com/endroid", + "type": "github" + } + ], + "install-path": "../endroid/qr-code" + }, + { + "name": "wikimedia/less.php", + "version": "v3.1.0", + "version_normalized": "3.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/less.php.git", + "reference": "a486d78b9bd16b72f237fc6093aa56d69ce8bd13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/less.php/zipball/a486d78b9bd16b72f237fc6093aa56d69ce8bd13", + "reference": "a486d78b9bd16b72f237fc6093aa56d69ce8bd13", + "shasum": "" + }, + "require": { + "php": ">=7.2.9" + }, + "require-dev": { + "mediawiki/mediawiki-codesniffer": "34.0.0", + "mediawiki/minus-x": "1.0.0", + "php-parallel-lint/php-console-highlighter": "0.5.0", + "php-parallel-lint/php-parallel-lint": "1.2.0", + "phpunit/phpunit": "^8.5" + }, + "time": "2020-12-11T19:33:31+00:00", + "bin": [ + "bin/lessc" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Less": "lib/" + }, + "classmap": [ + "lessc.inc.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Josh Schmidt", + "homepage": "https://github.com/oyejorge" + }, + { + "name": "Matt Agar", + "homepage": "https://github.com/agar" + }, + { + "name": "Martin Jantošovič", + "homepage": "https://github.com/Mordred" + } + ], + "description": "PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)", + "keywords": [ + "css", + "less", + "less.js", + "lesscss", + "php", + "stylesheet" + ], + "support": { + "issues": "https://github.com/wikimedia/less.php/issues", + "source": "https://github.com/wikimedia/less.php/tree/v3.1.0" + }, + "install-path": "../wikimedia/less.php" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php new file mode 100755 index 0000000..7c8fcd4 --- /dev/null +++ b/vendor/composer/installed.php @@ -0,0 +1,59 @@ + array( + 'name' => '__root__', + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '5e455c1499d4fba2d9bb825e4db8b58a3a6a595e', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '5e455c1499d4fba2d9bb825e4db8b58a3a6a595e', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'bacon/bacon-qr-code' => array( + 'pretty_version' => '2.0.7', + 'version' => '2.0.7.0', + 'reference' => 'd70c840f68657ce49094b8d91f9ee0cc07fbf66c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../bacon/bacon-qr-code', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'dasprid/enum' => array( + 'pretty_version' => '1.0.3', + 'version' => '1.0.3.0', + 'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../dasprid/enum', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'endroid/qr-code' => array( + 'pretty_version' => '4.4.9', + 'version' => '4.4.9.0', + 'reference' => 'bf087fa1e93a1b7310e2d94d187e26ae51db199d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../endroid/qr-code', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'wikimedia/less.php' => array( + 'pretty_version' => 'v3.1.0', + 'version' => '3.1.0.0', + 'reference' => 'a486d78b9bd16b72f237fc6093aa56d69ce8bd13', + 'type' => 'library', + 'install_path' => __DIR__ . '/../wikimedia/less.php', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php new file mode 100755 index 0000000..580fa96 --- /dev/null +++ b/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 70400)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/vendor/dasprid/enum/LICENSE b/vendor/dasprid/enum/LICENSE new file mode 100755 index 0000000..d45a356 --- /dev/null +++ b/vendor/dasprid/enum/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2017, Ben Scholzen 'DASPRiD' +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/dasprid/enum/README.md b/vendor/dasprid/enum/README.md new file mode 100755 index 0000000..9e9ca12 --- /dev/null +++ b/vendor/dasprid/enum/README.md @@ -0,0 +1,164 @@ +# PHP 7.1 enums + +[![Build Status](https://travis-ci.org/DASPRiD/Enum.svg?branch=master)](https://travis-ci.org/DASPRiD/Enum) +[![Coverage Status](https://coveralls.io/repos/github/DASPRiD/Enum/badge.svg?branch=master)](https://coveralls.io/github/DASPRiD/Enum?branch=master) +[![Latest Stable Version](https://poser.pugx.org/dasprid/enum/v/stable)](https://packagist.org/packages/dasprid/enum) +[![Total Downloads](https://poser.pugx.org/dasprid/enum/downloads)](https://packagist.org/packages/dasprid/enum) +[![License](https://poser.pugx.org/dasprid/enum/license)](https://packagist.org/packages/dasprid/enum) + +It is a well known fact that PHP is missing a basic enum type, ignoring the rather incomplete `SplEnum` implementation +which is only available as a PECL extension. There are also quite a few other userland enum implementations around, +but all of them have one or another compromise. This library tries to close that gap as far as PHP allows it to. + +## Usage + +### Basics + +At its core, there is the `DASPRiD\Enum\AbstractEnum` class, which by default will work with constants like any other +enum implementation you might know. The first clear difference is that you should define all the constants as protected +(so nobody outside your class can read them but the `AbstractEnum` can still do so). The other even mightier difference +is that, for simple enums, the value of the constant doesn't matter at all. Let's have a look at a simple example: + +```php +use DASPRiD\Enum\AbstractEnum; + +/** + * @method static self MONDAY() + * @method static self TUESDAY() + * @method static self WEDNESDAY() + * @method static self THURSDAY() + * @method static self FRIDAY() + * @method static self SATURDAY() + * @method static self SUNDAY() + */ +final class WeekDay extends AbstractEnum +{ + protected const MONDAY = null; + protected const TUESDAY = null; + protected const WEDNESDAY = null; + protected const THURSDAY = null; + protected const FRIDAY = null; + protected const SATURDAY = null; + protected const SUNDAY = null; +} +``` + +If you need to provide constants for either internal use or public use, you can mark them as either private or public, +in which case they will be ignored by the enum, which only considers protected constants as valid values. As you can +see, we specifically defined the generated magic methods in a class level doc block, so anyone using this class will +automatically have proper auto-completion in their IDE. Now since you have defined the enum, you can simply use it like +that: + +```php +function tellItLikeItIs(WeekDay $weekDay) +{ + switch ($weekDay) { + case WeekDay::MONDAY(): + echo 'Mondays are bad.'; + break; + + case WeekDay::FRIDAY(): + echo 'Fridays are better.'; + break; + + case WeekDay::SATURDAY(): + case WeekDay::SUNDAY(): + echo 'Weekends are best.'; + break; + + default: + echo 'Midweek days are so-so.'; + } +} + +tellItLikeItIs(WeekDay::MONDAY()); +tellItLikeItIs(WeekDay::WEDNESDAY()); +tellItLikeItIs(WeekDay::FRIDAY()); +tellItLikeItIs(WeekDay::SATURDAY()); +tellItLikeItIs(WeekDay::SUNDAY()); +``` + +### More complex example + +Of course, all enums are singletons, which are not cloneable or serializable. Thus you can be sure that there is always +just one instance of the same type. Of course, the values of constants are not completely useless, let's have a look at +a more complex example: + +```php +use DASPRiD\Enum\AbstractEnum; + +/** + * @method static self MERCURY() + * @method static self VENUS() + * @method static self EARTH() + * @method static self MARS() + * @method static self JUPITER() + * @method static self SATURN() + * @method static self URANUS() + * @method static self NEPTUNE() + */ +final class Planet extends AbstractEnum +{ + protected const MERCURY = [3.303e+23, 2.4397e6]; + protected const VENUS = [4.869e+24, 6.0518e6]; + protected const EARTH = [5.976e+24, 6.37814e6]; + protected const MARS = [6.421e+23, 3.3972e6]; + protected const JUPITER = [1.9e+27, 7.1492e7]; + protected const SATURN = [5.688e+26, 6.0268e7]; + protected const URANUS = [8.686e+25, 2.5559e7]; + protected const NEPTUNE = [1.024e+26, 2.4746e7]; + + /** + * Universal gravitational constant. + * + * @var float + */ + private const G = 6.67300E-11; + + /** + * Mass in kilograms. + * + * @var float + */ + private $mass; + + /** + * Radius in meters. + * + * @var float + */ + private $radius; + + protected function __construct(float $mass, float $radius) + { + $this->mass = $mass; + $this->radius = $radius; + } + + public function mass() : float + { + return $this->mass; + } + + public function radius() : float + { + return $this->radius; + } + + public function surfaceGravity() : float + { + return self::G * $this->mass / ($this->radius * $this->radius); + } + + public function surfaceWeight(float $otherMass) : float + { + return $otherMass * $this->surfaceGravity(); + } +} + +$myMass = 80; + +foreach (Planet::values() as $planet) { + printf("Your weight on %s is %f\n", $planet, $planet->surfaceWeight($myMass)); +} +``` diff --git a/vendor/dasprid/enum/composer.json b/vendor/dasprid/enum/composer.json new file mode 100755 index 0000000..b3d745a --- /dev/null +++ b/vendor/dasprid/enum/composer.json @@ -0,0 +1,31 @@ +{ + "name": "dasprid/enum", + "description": "PHP 7.1 enum implementation", + "license": "BSD-2-Clause", + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "keywords": [ + "enum", + "map" + ], + "require-dev": { + "phpunit/phpunit": "^7 | ^8 | ^9", + "squizlabs/php_codesniffer": "^3.4" + }, + "autoload": { + "psr-4": { + "DASPRiD\\Enum\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "DASPRiD\\EnumTest\\": "test/" + } + } +} diff --git a/vendor/dasprid/enum/phpunit.xml.dist b/vendor/dasprid/enum/phpunit.xml.dist new file mode 100755 index 0000000..307a430 --- /dev/null +++ b/vendor/dasprid/enum/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + + ./test + + + + + + src + + + diff --git a/vendor/dasprid/enum/src/AbstractEnum.php b/vendor/dasprid/enum/src/AbstractEnum.php new file mode 100755 index 0000000..79fe81c --- /dev/null +++ b/vendor/dasprid/enum/src/AbstractEnum.php @@ -0,0 +1,241 @@ +> + */ + private static $values = []; + + /** + * @var array + */ + private static $allValuesLoaded = []; + + /** + * @var array + */ + private static $constants = []; + + /** + * The constructor is private by default to avoid arbitrary enum creation. + * + * When creating your own constructor for a parameterized enum, make sure to declare it as protected, so that + * the static methods are able to construct it. Avoid making it public, as that would allow creation of + * non-singleton enum instances. + */ + private function __construct() + { + } + + /** + * Magic getter which forwards all calls to {@see self::valueOf()}. + * + * @return static + */ + final public static function __callStatic(string $name, array $arguments) : self + { + return static::valueOf($name); + } + + /** + * Returns an enum with the specified name. + * + * The name must match exactly an identifier used to declare an enum in this type (extraneous whitespace characters + * are not permitted). + * + * @return static + * @throws IllegalArgumentException if the enum has no constant with the specified name + */ + final public static function valueOf(string $name) : self + { + if (isset(self::$values[static::class][$name])) { + return self::$values[static::class][$name]; + } + + $constants = self::constants(); + + if (array_key_exists($name, $constants)) { + return self::createValue($name, $constants[$name][0], $constants[$name][1]); + } + + throw new IllegalArgumentException(sprintf('No enum constant %s::%s', static::class, $name)); + } + + /** + * @return static + */ + private static function createValue(string $name, int $ordinal, array $arguments) : self + { + $instance = new static(...$arguments); + $instance->name = $name; + $instance->ordinal = $ordinal; + self::$values[static::class][$name] = $instance; + return $instance; + } + + /** + * Obtains all possible types defined by this enum. + * + * @return static[] + */ + final public static function values() : array + { + if (isset(self::$allValuesLoaded[static::class])) { + return self::$values[static::class]; + } + + if (! isset(self::$values[static::class])) { + self::$values[static::class] = []; + } + + foreach (self::constants() as $name => $constant) { + if (array_key_exists($name, self::$values[static::class])) { + continue; + } + + static::createValue($name, $constant[0], $constant[1]); + } + + uasort(self::$values[static::class], function (self $a, self $b) { + return $a->ordinal() <=> $b->ordinal(); + }); + + self::$allValuesLoaded[static::class] = true; + return self::$values[static::class]; + } + + private static function constants() : array + { + if (isset(self::$constants[static::class])) { + return self::$constants[static::class]; + } + + self::$constants[static::class] = []; + $reflectionClass = new ReflectionClass(static::class); + $ordinal = -1; + + foreach ($reflectionClass->getReflectionConstants() as $reflectionConstant) { + if (! $reflectionConstant->isProtected()) { + continue; + } + + $value = $reflectionConstant->getValue(); + + self::$constants[static::class][$reflectionConstant->name] = [ + ++$ordinal, + is_array($value) ? $value : [] + ]; + } + + return self::$constants[static::class]; + } + + /** + * Returns the name of this enum constant, exactly as declared in its enum declaration. + * + * Most programmers should use the {@see self::__toString()} method in preference to this one, as the toString + * method may return a more user-friendly name. This method is designed primarily for use in specialized situations + * where correctness depends on getting the exact name, which will not vary from release to release. + */ + final public function name() : string + { + return $this->name; + } + + /** + * Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial + * constant is assigned an ordinal of zero). + * + * Most programmers will have no use for this method. It is designed for use by sophisticated enum-based data + * structures. + */ + final public function ordinal() : int + { + return $this->ordinal; + } + + /** + * Compares this enum with the specified object for order. + * + * Returns negative integer, zero or positive integer as this object is less than, equal to or greater than the + * specified object. + * + * Enums are only comparable to other enums of the same type. The natural order implemented by this method is the + * order in which the constants are declared. + * + * @throws MismatchException if the passed enum is not of the same type + */ + final public function compareTo(self $other) : int + { + if (! $other instanceof static) { + throw new MismatchException(sprintf( + 'The passed enum %s is not of the same type as %s', + get_class($other), + static::class + )); + } + + return $this->ordinal - $other->ordinal; + } + + /** + * Forbid cloning enums. + * + * @throws CloneNotSupportedException + */ + final public function __clone() + { + throw new CloneNotSupportedException(); + } + + /** + * Forbid serializing enums. + * + * @throws SerializeNotSupportedException + */ + final public function __sleep() : array + { + throw new SerializeNotSupportedException(); + } + + /** + * Forbid unserializing enums. + * + * @throws UnserializeNotSupportedException + */ + final public function __wakeup() : void + { + throw new UnserializeNotSupportedException(); + } + + /** + * Turns the enum into a string representation. + * + * You may override this method to give a more user-friendly version. + */ + public function __toString() : string + { + return $this->name; + } +} diff --git a/vendor/dasprid/enum/src/EnumMap.php b/vendor/dasprid/enum/src/EnumMap.php new file mode 100755 index 0000000..77c5f35 --- /dev/null +++ b/vendor/dasprid/enum/src/EnumMap.php @@ -0,0 +1,375 @@ + + */ + private $keyUniverse; + + /** + * Array representation of this map. The ith element is the value to which universe[i] is currently mapped, or null + * if it isn't mapped to anything, or NullValue if it's mapped to null. + * + * @var array + */ + private $values; + + /** + * @var int + */ + private $size = 0; + + /** + * Creates a new enum map. + * + * @param string $keyType the type of the keys, must extend AbstractEnum + * @param string $valueType the type of the values + * @param bool $allowNullValues whether to allow null values + * @throws IllegalArgumentException when key type does not extend AbstractEnum + */ + public function __construct(string $keyType, string $valueType, bool $allowNullValues) + { + if (! is_subclass_of($keyType, AbstractEnum::class)) { + throw new IllegalArgumentException(sprintf( + 'Class %s does not extend %s', + $keyType, + AbstractEnum::class + )); + } + + $this->keyType = $keyType; + $this->valueType = $valueType; + $this->allowNullValues = $allowNullValues; + $this->keyUniverse = $keyType::values(); + $this->values = array_fill(0, count($this->keyUniverse), null); + } + + /** + * Checks whether the map types match the supplied ones. + * + * You should call this method when an EnumMap is passed to you and you want to ensure that it's made up of the + * correct types. + * + * @throws ExpectationException when supplied key type mismatches local key type + * @throws ExpectationException when supplied value type mismatches local value type + * @throws ExpectationException when the supplied map allows null values, abut should not + */ + public function expect(string $keyType, string $valueType, bool $allowNullValues) : void + { + if ($keyType !== $this->keyType) { + throw new ExpectationException(sprintf( + 'Callee expected an EnumMap with key type %s, but got %s', + $keyType, + $this->keyType + )); + } + + if ($valueType !== $this->valueType) { + throw new ExpectationException(sprintf( + 'Callee expected an EnumMap with value type %s, but got %s', + $keyType, + $this->keyType + )); + } + + if ($allowNullValues !== $this->allowNullValues) { + throw new ExpectationException(sprintf( + 'Callee expected an EnumMap with nullable flag %s, but got %s', + ($allowNullValues ? 'true' : 'false'), + ($this->allowNullValues ? 'true' : 'false') + )); + } + } + + /** + * Returns the number of key-value mappings in this map. + */ + public function size() : int + { + return $this->size; + } + + /** + * Returns true if this map maps one or more keys to the specified value. + */ + public function containsValue($value) : bool + { + return in_array($this->maskNull($value), $this->values, true); + } + + /** + * Returns true if this map contains a mapping for the specified key. + */ + public function containsKey(AbstractEnum $key) : bool + { + $this->checkKeyType($key); + return null !== $this->values[$key->ordinal()]; + } + + /** + * Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. + * + * More formally, if this map contains a mapping from a key to a value, then this method returns the value; + * otherwise it returns null (there can be at most one such mapping). + * + * A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also + * possible that hte map explicitly maps the key to null. The {@see self::containsKey()} operation may be used to + * distinguish these two cases. + * + * @return mixed + */ + public function get(AbstractEnum $key) + { + $this->checkKeyType($key); + return $this->unmaskNull($this->values[$key->ordinal()]); + } + + /** + * Associates the specified value with the specified key in this map. + * + * If the map previously contained a mapping for this key, the old value is replaced. + * + * @return mixed the previous value associated with the specified key, or null if there was no mapping for the key. + * (a null return can also indicate that the map previously associated null with the specified key.) + * @throws IllegalArgumentException when the passed values does not match the internal value type + */ + public function put(AbstractEnum $key, $value) + { + $this->checkKeyType($key); + + if (! $this->isValidValue($value)) { + throw new IllegalArgumentException(sprintf('Value is not of type %s', $this->valueType)); + } + + $index = $key->ordinal(); + $oldValue = $this->values[$index]; + $this->values[$index] = $this->maskNull($value); + + if (null === $oldValue) { + ++$this->size; + } + + return $this->unmaskNull($oldValue); + } + + /** + * Removes the mapping for this key frm this map if present. + * + * @return mixed the previous value associated with the specified key, or null if there was no mapping for the key. + * (a null return can also indicate that the map previously associated null with the specified key.) + */ + public function remove(AbstractEnum $key) + { + $this->checkKeyType($key); + + $index = $key->ordinal(); + $oldValue = $this->values[$index]; + $this->values[$index] = null; + + if (null !== $oldValue) { + --$this->size; + } + + return $this->unmaskNull($oldValue); + } + + /** + * Removes all mappings from this map. + */ + public function clear() : void + { + $this->values = array_fill(0, count($this->keyUniverse), null); + $this->size = 0; + } + + /** + * Compares the specified map with this map for quality. + * + * Returns true if the two maps represent the same mappings. + */ + public function equals(self $other) : bool + { + if ($this === $other) { + return true; + } + + if ($this->size !== $other->size) { + return false; + } + + return $this->values === $other->values; + } + + /** + * Returns the values contained in this map. + * + * The array will contain the values in the order their corresponding keys appear in the map, which is their natural + * order (the order in which the num constants are declared). + */ + public function values() : array + { + return array_values(array_map(function ($value) { + return $this->unmaskNull($value); + }, array_filter($this->values, function ($value) : bool { + return null !== $value; + }))); + } + + public function serialize() : string + { + $values = []; + + foreach ($this->values as $ordinal => $value) { + if (null === $value) { + continue; + } + + $values[$ordinal] = $this->unmaskNull($value); + } + + return serialize([ + 'keyType' => $this->keyType, + 'valueType' => $this->valueType, + 'allowNullValues' => $this->allowNullValues, + 'values' => $values, + ]); + } + + public function unserialize($serialized) : void + { + $data = unserialize($serialized); + $this->__construct($data['keyType'], $data['valueType'], $data['allowNullValues']); + + foreach ($this->keyUniverse as $key) { + if (array_key_exists($key->ordinal(), $data['values'])) { + $this->put($key, $data['values'][$key->ordinal()]); + } + } + } + + public function getIterator() : Traversable + { + foreach ($this->keyUniverse as $key) { + if (null === $this->values[$key->ordinal()]) { + continue; + } + + yield $key => $this->unmaskNull($this->values[$key->ordinal()]); + } + } + + private function maskNull($value) + { + if (null === $value) { + return NullValue::instance(); + } + + return $value; + } + + private function unmaskNull($value) + { + if ($value instanceof NullValue) { + return null; + } + + return $value; + } + + /** + * @throws IllegalArgumentException when the passed key does not match the internal key type + */ + private function checkKeyType(AbstractEnum $key) : void + { + if (get_class($key) !== $this->keyType) { + throw new IllegalArgumentException(sprintf( + 'Object of type %s is not the same type as %s', + get_class($key), + $this->keyType + )); + } + } + + private function isValidValue($value) : bool + { + if (null === $value) { + if ($this->allowNullValues) { + return true; + } + + return false; + } + + switch ($this->valueType) { + case 'mixed': + return true; + + case 'bool': + case 'boolean': + return is_bool($value); + + case 'int': + case 'integer': + return is_int($value); + + case 'float': + case 'double': + return is_float($value); + + case 'string': + return is_string($value); + + case 'object': + return is_object($value); + + case 'array': + return is_array($value); + } + + return $value instanceof $this->valueType; + } +} diff --git a/vendor/dasprid/enum/src/Exception/CloneNotSupportedException.php b/vendor/dasprid/enum/src/Exception/CloneNotSupportedException.php new file mode 100755 index 0000000..4b37dbe --- /dev/null +++ b/vendor/dasprid/enum/src/Exception/CloneNotSupportedException.php @@ -0,0 +1,10 @@ +getProperty('constants'); + $constantsProperty->setAccessible(true); + $constantsProperty->setValue([]); + + $valuesProperty = $reflectionClass->getProperty('values'); + $valuesProperty->setAccessible(true); + $valuesProperty->setValue([]); + + $allValuesLoadedProperty = $reflectionClass->getProperty('allValuesLoaded'); + $allValuesLoadedProperty->setAccessible(true); + $allValuesLoadedProperty->setValue([]); + } + + public function testToString() : void + { + $weekday = WeekDay::FRIDAY(); + self::assertSame('FRIDAY', (string) $weekday); + } + + public function testName() : void + { + $this->assertSame('WEDNESDAY', WeekDay::WEDNESDAY()->name()); + } + + public function testOrdinal() : void + { + $this->assertSame(2, WeekDay::WEDNESDAY()->ordinal()); + } + + public function testSameInstanceIsReturned() : void + { + self::assertSame(WeekDay::FRIDAY(), WeekDay::FRIDAY()); + } + + public static function testValueOf() : void + { + self::assertSame(WeekDay::FRIDAY(), WeekDay::valueOf('FRIDAY')); + } + + public function testValueOfInvalidConstant() : void + { + $this->expectException(IllegalArgumentException::class); + WeekDay::valueOf('CATURDAY'); + } + + public function testExceptionOnCloneAttempt() : void + { + $this->expectException(CloneNotSupportedException::class); + clone WeekDay::FRIDAY(); + } + + public function testExceptionOnSerializeAttempt() : void + { + $this->expectException(SerializeNotSupportedException::class); + serialize(WeekDay::FRIDAY()); + } + + public function testExceptionOnUnserializeAttempt() : void + { + $this->expectException(UnserializeNotSupportedException::class); + unserialize('O:24:"DASPRiD\\EnumTest\\WeekDay":0:{}'); + } + + public function testReturnValueOfValuesIsSortedByOrdinal() : void + { + // Initialize some week days out of order + WeekDay::SATURDAY(); + WeekDay::TUESDAY(); + + $ordinals = array_values(array_map(function (WeekDay $weekDay) : int { + return $weekDay->ordinal(); + }, WeekDay::values())); + + self::assertSame([0, 1, 2, 3, 4, 5, 6], $ordinals); + + $cachedOrdinals = array_values(array_map(function (WeekDay $weekDay) : int { + return $weekDay->ordinal(); + }, WeekDay::values())); + $this->assertSame($ordinals, $cachedOrdinals); + } + + public function testCompareTo() : void + { + $this->assertSame(-4, WeekDay::WEDNESDAY()->compareTo(WeekDay::SUNDAY())); + $this->assertSame(4, WeekDay::SUNDAY()->compareTo(WeekDay::WEDNESDAY())); + $this->assertSame(0, WeekDay::WEDNESDAY()->compareTo(WeekDay::WEDNESDAY())); + } + + public function testCompareToWrongEnum() : void + { + $this->expectException(MismatchException::class); + WeekDay::MONDAY()->compareTo(Planet::EARTH()); + } + + public function testParameterizedEnum() : void + { + $planet = Planet::EARTH(); + $this->assertSame(5.976e+24, $planet->mass()); + $this->assertSame(6.37814e6, $planet->radius()); + } +} diff --git a/vendor/dasprid/enum/test/EnumMapTest.php b/vendor/dasprid/enum/test/EnumMapTest.php new file mode 100755 index 0000000..d51a86c --- /dev/null +++ b/vendor/dasprid/enum/test/EnumMapTest.php @@ -0,0 +1,243 @@ +expectException(IllegalArgumentException::class); + new EnumMap(stdClass::class, 'string', false); + } + + public function testUnexpectedKeyType() : void + { + $this->expectException(ExpectationException::class); + $map = new EnumMap(WeekDay::class, 'string', false); + $map->expect(Planet::class, 'string', false); + } + + public function testUnexpectedValueType() : void + { + $this->expectException(ExpectationException::class); + $map = new EnumMap(WeekDay::class, 'string', false); + $map->expect(WeekDay::class, 'int', false); + } + + public function testUnexpectedNullableValueType() : void + { + $this->expectException(ExpectationException::class); + $map = new EnumMap(WeekDay::class, 'string', true); + $map->expect(WeekDay::class, 'string', false); + } + + public function testExpectedTypes() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $map->expect(WeekDay::class, 'string', true); + $this->addToAssertionCount(1); + } + + public function testSize() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $this->assertSame(0, $map->size()); + $map->put(WeekDay::MONDAY(), 'foo'); + $this->assertSame(1, $map->size()); + } + + public function testContainsValue() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $this->assertFalse($map->containsValue('foo')); + $map->put(WeekDay::TUESDAY(), 'foo'); + $this->assertTrue($map->containsValue('foo')); + $this->assertFalse($map->containsValue(null)); + $map->put(WeekDay::WEDNESDAY(), null); + $this->assertTrue($map->containsValue(null)); + } + + public function testContainsKey() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $this->assertFalse($map->containsKey(WeekDay::TUESDAY())); + $map->put(WeekDay::TUESDAY(), 'foo'); + $this->assertTrue($map->containsKey(WeekDay::TUESDAY())); + $map->put(WeekDay::WEDNESDAY(), null); + $this->assertTrue($map->containsKey(WeekDay::WEDNESDAY())); + } + + public function testPutAndGet() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $map->put(WeekDay::TUESDAY(), 'foo'); + $map->put(WeekDay::FRIDAY(), null); + $this->assertSame('foo', $map->get(WeekDay::TUESDAY())); + $this->assertSame(null, $map->get(WeekDay::WEDNESDAY())); + $this->assertSame(null, $map->get(WeekDay::FRIDAY())); + } + + public function testPutInvalidKey() : void + { + $this->expectException(IllegalArgumentException::class); + $map = new EnumMap(WeekDay::class, 'string', true); + $map->put(Planet::MARS(), 'foo'); + } + + public function invalidValues() : array + { + return [ + ['bool', null, false], + ['bool', 0], + ['boolean', 0], + ['int', 2.4], + ['integer', 5.3], + ['float', 3], + ['double', 7], + ['string', 1], + ['object', 1], + ['array', 1], + [stdClass::class, 1], + ]; + } + + /** + * @dataProvider invalidValues + * @param mixed $value + */ + public function testPutInvalidValue(string $valueType, $value, bool $allowNull = true) : void + { + $this->expectException(IllegalArgumentException::class); + $map = new EnumMap(WeekDay::class, $valueType, $allowNull); + $map->put(WeekDay::TUESDAY(), $value); + } + + public function validValues() : array + { + return [ + ['bool', null], + ['mixed', 'foo'], + ['mixed', 1], + ['mixed', new stdClass()], + ['bool', true], + ['boolean', false], + ['int', 1], + ['integer', 4], + ['float', 2.5], + ['double', 6.4], + ['string', 'foo'], + ['object', new stdClass()], + ['array', ['foo']], + [stdClass::class, new stdClass()], + ]; + } + + /** + * @dataProvider validValues + * @param mixed $value + */ + public function testPutValidValue(string $valueType, $value, bool $allowNull = true) : void + { + $map = new EnumMap(WeekDay::class, $valueType, $allowNull); + $map->put(WeekDay::TUESDAY(), $value); + $this->addToAssertionCount(1); + } + + public function testRemove() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $map->put(WeekDay::TUESDAY(), 'foo'); + $map->remove(WeekDay::TUESDAY()); + $map->remove(WeekDay::WEDNESDAY()); + $this->assertSame(null, $map->get(WeekDay::TUESDAY())); + $this->assertSame(0, $map->size()); + } + + public function testClear() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $map->put(WeekDay::TUESDAY(), 'foo'); + $map->clear(); + $this->assertSame(null, $map->get(WeekDay::TUESDAY())); + $this->assertSame(0, $map->size()); + } + + public function testEqualsWithSameInstance() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $this->assertTrue($map->equals($map)); + } + + public function testEqualsWithDifferentSize() : void + { + $mapA = new EnumMap(WeekDay::class, 'string', true); + $mapB = new EnumMap(WeekDay::class, 'string', true); + $mapB->put(WeekDay::MONDAY(), 'foo'); + + $this->assertFalse($mapA->equals($mapB)); + } + + public function testEqualsWithDifferentValues() : void + { + $mapA = new EnumMap(WeekDay::class, 'string', true); + $mapA->put(WeekDay::MONDAY(), 'foo'); + $mapB = new EnumMap(WeekDay::class, 'string', true); + $mapB->put(WeekDay::MONDAY(), 'bar'); + + $this->assertFalse($mapA->equals($mapB)); + } + + public function testEqualsWithDifferentConstants() : void + { + $mapA = new EnumMap(WeekDay::class, 'string', true); + $mapA->put(WeekDay::MONDAY(), 'foo'); + $mapB = new EnumMap(WeekDay::class, 'string', true); + $mapB->put(WeekDay::TUESDAY(), 'foo'); + + $this->assertFalse($mapA->equals($mapB)); + } + + public function testValues() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $this->assertSame([], $map->values()); + + $map->put(WeekDay::FRIDAY(), 'foo'); + $map->put(WeekDay::TUESDAY(), 'bar'); + $map->put(WeekDay::SUNDAY(), null); + + $this->assertSame(['bar', 'foo', null], $map->values()); + } + + public function testSerializeAndUnserialize() : void + { + $mapA = new EnumMap(WeekDay::class, 'string', true); + $mapA->put(WeekDay::MONDAY(), 'foo'); + $mapB = unserialize(serialize($mapA)); + + $this->assertTrue($mapA->equals($mapB)); + } + + public function testIterator() : void + { + $map = new EnumMap(WeekDay::class, 'string', true); + $map->put(WeekDay::FRIDAY(), 'foo'); + $map->put(WeekDay::TUESDAY(), 'bar'); + $map->put(WeekDay::SUNDAY(), null); + + $result = []; + + foreach ($map as $key => $value) { + $result[$key->ordinal()] = $value; + } + + $this->assertSame([1 => 'bar', 4 => 'foo', 6 => null], $result); + } +} diff --git a/vendor/dasprid/enum/test/NullValueTest.php b/vendor/dasprid/enum/test/NullValueTest.php new file mode 100755 index 0000000..9f70640 --- /dev/null +++ b/vendor/dasprid/enum/test/NullValueTest.php @@ -0,0 +1,31 @@ +expectException(CloneNotSupportedException::class); + clone NullValue::instance(); + } + + public function testExceptionOnSerializeAttempt() : void + { + $this->expectException(SerializeNotSupportedException::class); + serialize(NullValue::instance()); + } + + public function testExceptionOnUnserializeAttempt() : void + { + $this->expectException(UnserializeNotSupportedException::class); + unserialize('O:22:"DASPRiD\\Enum\\NullValue":0:{}'); + } +} diff --git a/vendor/dasprid/enum/test/Planet.php b/vendor/dasprid/enum/test/Planet.php new file mode 100755 index 0000000..3c44c1d --- /dev/null +++ b/vendor/dasprid/enum/test/Planet.php @@ -0,0 +1,73 @@ +mass = $mass; + $this->radius = $radius; + } + + public function mass() : float + { + return $this->mass; + } + + public function radius() : float + { + return $this->radius; + } + + public function surfaceGravity() : float + { + return self::G * $this->mass / ($this->radius * $this->radius); + } + + public function surfaceWeight(float $otherMass) : float + { + return $otherMass * $this->surfaceGravity(); + } +} diff --git a/vendor/dasprid/enum/test/WeekDay.php b/vendor/dasprid/enum/test/WeekDay.php new file mode 100755 index 0000000..70b8db5 --- /dev/null +++ b/vendor/dasprid/enum/test/WeekDay.php @@ -0,0 +1,26 @@ +writer(new PngWriter()) + ->writerOptions([]) + ->data('Custom QR code contents') + ->encoding(new Encoding('UTF-8')) + ->errorCorrectionLevel(new ErrorCorrectionLevelHigh()) + ->size(300) + ->margin(10) + ->roundBlockSizeMode(new RoundBlockSizeModeMargin()) + ->logoPath(__DIR__.'/assets/symfony.png') + ->labelText('This is the label') + ->labelFont(new NotoSans(20)) + ->labelAlignment(new LabelAlignmentCenter()) + ->build(); +``` + +## Usage: without using the builder + +```php +use Endroid\QrCode\Color\Color; +use Endroid\QrCode\Encoding\Encoding; +use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow; +use Endroid\QrCode\QrCode; +use Endroid\QrCode\Label\Label; +use Endroid\QrCode\Logo\Logo; +use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin; +use Endroid\QrCode\Writer\PngWriter; + +$writer = new PngWriter(); + +// Create QR code +$qrCode = QrCode::create('Data') + ->setEncoding(new Encoding('UTF-8')) + ->setErrorCorrectionLevel(new ErrorCorrectionLevelLow()) + ->setSize(300) + ->setMargin(10) + ->setRoundBlockSizeMode(new RoundBlockSizeModeMargin()) + ->setForegroundColor(new Color(0, 0, 0)) + ->setBackgroundColor(new Color(255, 255, 255)); + +// Create generic logo +$logo = Logo::create(__DIR__.'/assets/symfony.png') + ->setResizeToWidth(50); + +// Create generic label +$label = Label::create('Label') + ->setTextColor(new Color(255, 0, 0)); + +$result = $writer->write($qrCode, $logo, $label); +``` + +## Usage: working with results + +```php + +// Directly output the QR code +header('Content-Type: '.$result->getMimeType()); +echo $result->getString(); + +// Save it to a file +$result->saveToFile(__DIR__.'/qrcode.png'); + +// Generate a data URI to include image data inline (i.e. inside an tag) +$dataUri = $result->getDataUri(); +``` + +![QR Code](https://endroid.nl/qr-code/default/Life%20is%20too%20short%20to%20be%20generating%20QR%20codes) + +### Writer options + +```php +use Endroid\QrCode\Writer\SvgWriter; + +$builder->setWriterOptions([SvgWriter::WRITER_OPTION_EXCLUDE_XML_DECLARATION => true]); +``` + +### Encoding + +If you use a barcode scanner you can have some troubles while reading the +generated QR codes. Depending on the encoding you chose you will have an extra +amount of data corresponding to the ECI block. Some barcode scanner are not +programmed to interpret this block of information. To ensure a maximum +compatibility you can use the `ISO-8859-1` encoding that is the default +encoding used by barcode scanners (if your character set supports it, +i.e. no Chinese characters are present). + +### Round block size mode + +By default block sizes are rounded to guarantee sharp images and improve +readability. However some other rounding variants are available. + +* `margin (default)`: the size of the QR code is shrunk if necessary but the size + of the final image remains unchanged due to additional margin being added. +* `enlarge`: the size of the QR code and the final image are enlarged when + rounding differences occur. +* `shrink`: the size of the QR code and the final image are + shrunk when rounding differences occur. +* `none`: No rounding. This mode can be used when blocks don't need to be rounded + to pixels (for instance SVG). + +## Readability + +The readability of a QR code is primarily determined by the size, the input +length, the error correction level and any possible logo over the image so you +can tweak these parameters if you are looking for optimal results. You can also +check $qrCode->getRoundBlockSize() value to see if block dimensions are rounded +so that the image is more sharp and readable. Please note that rounding block +size can result in additional padding to compensate for the rounding difference. +And finally the encoding (default UTF-8 to support large character sets) can be +set to `ISO-8859-1` if possible to improve readability. + +## Built-in validation reader + +You can enable the built-in validation reader (disabled by default) by calling +setValidateResult(true). This validation reader does not guarantee that the QR +code will be readable by all readers but it helps you provide a minimum level +of quality. Take note that the validator can consume quite amount of additional +resources and it should be installed separately only if you use it. + +## Symfony integration + +The [endroid/qr-code-bundle](https://github.com/endroid/qr-code-bundle) +integrates the QR code library in Symfony for an even better experience. + +* Configure your defaults (like image size, default writer etc.) +* Support for multiple configurations and injection via aliases +* Generate QR codes for defined configurations via URL like /qr-code//Hello +* Generate QR codes or URLs directly from Twig using dedicated functions + +Read the [bundle documentation](https://github.com/endroid/qr-code-bundle) +for more information. + +## Versioning + +Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility +breaking changes will be kept to a minimum but be aware that these can occur. +Lock your dependencies for production and test your code when upgrading. + +## License + +This bundle is under the MIT license. For the full copyright and license +information please view the LICENSE file that was distributed with this source code. diff --git a/vendor/endroid/qr-code/assets/open_sans.ttf b/vendor/endroid/qr-code/assets/open_sans.ttf new file mode 100755 index 0000000000000000000000000000000000000000..db433349b7047f72f40072630c1bc110620bf09e GIT binary patch literal 217360 zcmbTf2|!d;`v-i^y?0h-UqJ+B7zac|gaHvZMg(M25z!b^#2qbHTv9U^!UgvYcQZ3G zG8@gze9f{lGcz;Wd&|uB%=YC~xO~5JXGYPt{_ppFV~0EU-gD1+&a*$ydG16gA;gS7 z0_mJHsG#pIQ%)4&yYC>xI-_q+Z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JNRXV?1QFAGi30xur9;_azh zZ`yk9bCvxX*PfWO=lCbqS;hUb^8V>)WetGET1tq%^tu0Uu}3ri0Q9zVs*TNhX1fuQ z=8)$M-4mxqDa?`9?lK3?wGAJeBLfa7+QQlT8EqN41MYugKlt=$*V@?A_hnBTX#b1v zWcTU~-P(^d*#GgROFSd?zP9Jfw|gF_8F8%B=i{uGdkpup^w->s4d1M~Z_-KkXH9v- z#vT~FZtwlWXVncT$lY_@gAb1r*T47O?e0^j8Xx|4iFKiSfA!kOE?qe3f?hi^`jz~B zf66WSua-|-JHm2f=Fl1b&#!p1_T`)>tk)I%v-9R#PJBIi^pP=LH`=tmSJi)cY*f!p z5|eI6pL_ACTOPk`@wIa%^n7yYv<>T@>vH_2hWwX@4$gY! z^Zk2g+{d;IzVY+kD{maIVnK(S4|o3Qwbv>tBN@+}lN+)>%bx$_qYf|iD}G>V_ai^; j+_!VPYv1l8X`A1wy=V7^2OFn9@%|fwe_OZZkf!}Vb520^ literal 0 HcmV?d00001 diff --git a/vendor/endroid/qr-code/composer.json b/vendor/endroid/qr-code/composer.json new file mode 100755 index 0000000..9fd62c0 --- /dev/null +++ b/vendor/endroid/qr-code/composer.json @@ -0,0 +1,51 @@ +{ + "name": "endroid/qr-code", + "description": "Endroid QR Code", + "keywords": ["endroid", "qrcode", "qr", "code", "php"], + "homepage": "https://github.com/endroid/qr-code", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "require": { + "php": "^7.4||^8.0", + "bacon/bacon-qr-code": "^2.0.5" + }, + "require-dev": { + "ext-gd": "*", + "endroid/quality": "dev-master", + "khanamiryan/qrcode-detector-decoder": "^1.0.4", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "ext-gd": "Enables you to write PNG images", + "khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator", + "roave/security-advisories": "Makes sure package versions with known security issues are not installed", + "setasign/fpdf": "Enables you to use the PDF writer" + }, + "autoload": { + "psr-4": { + "Endroid\\QrCode\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Endroid\\QrCode\\Tests\\": "tests/" + } + }, + "config": { + "sort-packages": true, + "preferred-install": { + "endroid/*": "source" + } + }, + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + } +} diff --git a/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php b/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php new file mode 100755 index 0000000..90f23e0 --- /dev/null +++ b/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php @@ -0,0 +1,30 @@ +getErrorCorrectionLevel()); + $baconMatrix = Encoder::encode($qrCode->getData(), $baconErrorCorrectionLevel, strval($qrCode->getEncoding()))->getMatrix(); + + $blockValues = []; + $columnCount = $baconMatrix->getWidth(); + $rowCount = $baconMatrix->getHeight(); + for ($rowIndex = 0; $rowIndex < $rowCount; ++$rowIndex) { + $blockValues[$rowIndex] = []; + for ($columnIndex = 0; $columnIndex < $columnCount; ++$columnIndex) { + $blockValues[$rowIndex][$columnIndex] = $baconMatrix->get($columnIndex, $rowIndex); + } + } + + return new Matrix($blockValues, $qrCode->getSize(), $qrCode->getMargin(), $qrCode->getRoundBlockSizeMode()); + } +} diff --git a/vendor/endroid/qr-code/src/Builder/Builder.php b/vendor/endroid/qr-code/src/Builder/Builder.php new file mode 100755 index 0000000..c00be13 --- /dev/null +++ b/vendor/endroid/qr-code/src/Builder/Builder.php @@ -0,0 +1,278 @@ +{ + * data: string, + * writer: WriterInterface, + * writerOptions: array, + * qrCodeClass: class-string, + * logoClass: class-string, + * labelClass: class-string, + * validateResult: bool, + * size?: int, + * encoding?: EncodingInterface, + * errorCorrectionLevel?: ErrorCorrectionLevelInterface, + * roundBlockSizeMode?: RoundBlockSizeModeInterface, + * margin?: int, + * backgroundColor?: ColorInterface, + * foregroundColor?: ColorInterface, + * labelText?: string, + * labelFont?: FontInterface, + * labelAlignment?: LabelAlignmentInterface, + * labelMargin?: MarginInterface, + * labelTextColor?: ColorInterface, + * logoPath?: string, + * logoResizeToWidth?: int, + * logoResizeToHeight?: int, + * logoPunchoutBackground?: bool + * } + */ + private array $options; + + public function __construct() + { + $this->options = [ + 'data' => '', + 'writer' => new PngWriter(), + 'writerOptions' => [], + 'qrCodeClass' => QrCode::class, + 'logoClass' => Logo::class, + 'labelClass' => Label::class, + 'validateResult' => false, + ]; + } + + public static function create(): BuilderInterface + { + return new self(); + } + + public function writer(WriterInterface $writer): BuilderInterface + { + $this->options['writer'] = $writer; + + return $this; + } + + /** @param array $writerOptions */ + public function writerOptions(array $writerOptions): BuilderInterface + { + $this->options['writerOptions'] = $writerOptions; + + return $this; + } + + public function data(string $data): BuilderInterface + { + $this->options['data'] = $data; + + return $this; + } + + public function encoding(EncodingInterface $encoding): BuilderInterface + { + $this->options['encoding'] = $encoding; + + return $this; + } + + public function errorCorrectionLevel(ErrorCorrectionLevelInterface $errorCorrectionLevel): BuilderInterface + { + $this->options['errorCorrectionLevel'] = $errorCorrectionLevel; + + return $this; + } + + public function size(int $size): BuilderInterface + { + $this->options['size'] = $size; + + return $this; + } + + public function margin(int $margin): BuilderInterface + { + $this->options['margin'] = $margin; + + return $this; + } + + public function roundBlockSizeMode(RoundBlockSizeModeInterface $roundBlockSizeMode): BuilderInterface + { + $this->options['roundBlockSizeMode'] = $roundBlockSizeMode; + + return $this; + } + + public function foregroundColor(ColorInterface $foregroundColor): BuilderInterface + { + $this->options['foregroundColor'] = $foregroundColor; + + return $this; + } + + public function backgroundColor(ColorInterface $backgroundColor): BuilderInterface + { + $this->options['backgroundColor'] = $backgroundColor; + + return $this; + } + + public function logoPath(string $logoPath): BuilderInterface + { + $this->options['logoPath'] = $logoPath; + + return $this; + } + + public function logoResizeToWidth(int $logoResizeToWidth): BuilderInterface + { + $this->options['logoResizeToWidth'] = $logoResizeToWidth; + + return $this; + } + + public function logoResizeToHeight(int $logoResizeToHeight): BuilderInterface + { + $this->options['logoResizeToHeight'] = $logoResizeToHeight; + + return $this; + } + + public function logoPunchoutBackground(bool $logoPunchoutBackground): BuilderInterface + { + $this->options['logoPunchoutBackground'] = $logoPunchoutBackground; + + return $this; + } + + public function labelText(string $labelText): BuilderInterface + { + $this->options['labelText'] = $labelText; + + return $this; + } + + public function labelFont(FontInterface $labelFont): BuilderInterface + { + $this->options['labelFont'] = $labelFont; + + return $this; + } + + public function labelAlignment(LabelAlignmentInterface $labelAlignment): BuilderInterface + { + $this->options['labelAlignment'] = $labelAlignment; + + return $this; + } + + public function labelMargin(MarginInterface $labelMargin): BuilderInterface + { + $this->options['labelMargin'] = $labelMargin; + + return $this; + } + + public function labelTextColor(ColorInterface $labelTextColor): BuilderInterface + { + $this->options['labelTextColor'] = $labelTextColor; + + return $this; + } + + public function validateResult(bool $validateResult): BuilderInterface + { + $this->options['validateResult'] = $validateResult; + + return $this; + } + + public function build(): ResultInterface + { + $writer = $this->options['writer']; + + if ($this->options['validateResult'] && !$writer instanceof ValidatingWriterInterface) { + throw new \Exception('Unable to validate result with '.get_class($writer)); + } + + /** @var QrCode $qrCode */ + $qrCode = $this->buildObject($this->options['qrCodeClass']); + + /** @var LogoInterface|null $logo */ + $logo = $this->buildObject($this->options['logoClass'], 'logo'); + + /** @var LabelInterface|null $label */ + $label = $this->buildObject($this->options['labelClass'], 'label'); + + $result = $writer->write($qrCode, $logo, $label, $this->options['writerOptions']); + + if ($this->options['validateResult'] && $writer instanceof ValidatingWriterInterface) { + $writer->validateResult($result, $qrCode->getData()); + } + + return $result; + } + + /** + * @param class-string $class + * + * @return mixed + */ + private function buildObject(string $class, string $optionsPrefix = null) + { + /** @var \ReflectionClass $reflectionClass */ + $reflectionClass = new \ReflectionClass($class); + + $arguments = []; + $hasBuilderOptions = false; + $missingRequiredArguments = []; + /** @var \ReflectionMethod $constructor */ + $constructor = $reflectionClass->getConstructor(); + $constructorParameters = $constructor->getParameters(); + foreach ($constructorParameters as $parameter) { + $optionName = null === $optionsPrefix ? $parameter->getName() : $optionsPrefix.ucfirst($parameter->getName()); + if (isset($this->options[$optionName])) { + $hasBuilderOptions = true; + $arguments[] = $this->options[$optionName]; + } elseif ($parameter->isDefaultValueAvailable()) { + $arguments[] = $parameter->getDefaultValue(); + } else { + $missingRequiredArguments[] = $optionName; + } + } + + if (!$hasBuilderOptions) { + return null; + } + + if (count($missingRequiredArguments) > 0) { + throw new \Exception(sprintf('Missing required arguments: %s', implode(', ', $missingRequiredArguments))); + } + + return $reflectionClass->newInstanceArgs($arguments); + } +} diff --git a/vendor/endroid/qr-code/src/Builder/BuilderInterface.php b/vendor/endroid/qr-code/src/Builder/BuilderInterface.php new file mode 100755 index 0000000..5e69bc2 --- /dev/null +++ b/vendor/endroid/qr-code/src/Builder/BuilderInterface.php @@ -0,0 +1,63 @@ + $writerOptions */ + public function writerOptions(array $writerOptions): BuilderInterface; + + public function data(string $data): BuilderInterface; + + public function encoding(EncodingInterface $encoding): BuilderInterface; + + public function errorCorrectionLevel(ErrorCorrectionLevelInterface $errorCorrectionLevel): BuilderInterface; + + public function size(int $size): BuilderInterface; + + public function margin(int $margin): BuilderInterface; + + public function roundBlockSizeMode(RoundBlockSizeModeInterface $roundBlockSizeMode): BuilderInterface; + + public function foregroundColor(ColorInterface $foregroundColor): BuilderInterface; + + public function backgroundColor(ColorInterface $backgroundColor): BuilderInterface; + + public function logoPath(string $logoPath): BuilderInterface; + + public function logoResizeToWidth(int $logoResizeToWidth): BuilderInterface; + + public function logoResizeToHeight(int $logoResizeToHeight): BuilderInterface; + + public function logoPunchoutBackground(bool $logoPunchoutBackground): BuilderInterface; + + public function labelText(string $labelText): BuilderInterface; + + public function labelFont(FontInterface $labelFont): BuilderInterface; + + public function labelAlignment(LabelAlignmentInterface $labelAlignment): BuilderInterface; + + public function labelMargin(MarginInterface $labelMargin): BuilderInterface; + + public function labelTextColor(ColorInterface $labelTextColor): BuilderInterface; + + public function validateResult(bool $validateResult): BuilderInterface; + + public function build(): ResultInterface; +} diff --git a/vendor/endroid/qr-code/src/Builder/BuilderRegistry.php b/vendor/endroid/qr-code/src/Builder/BuilderRegistry.php new file mode 100755 index 0000000..cf1449c --- /dev/null +++ b/vendor/endroid/qr-code/src/Builder/BuilderRegistry.php @@ -0,0 +1,25 @@ + */ + private array $builders = []; + + public function getBuilder(string $name): BuilderInterface + { + if (!isset($this->builders[$name])) { + throw new \Exception(sprintf('Builder with name "%s" not available from registry', $name)); + } + + return $this->builders[$name]; + } + + public function addBuilder(string $name, BuilderInterface $builder): void + { + $this->builders[$name] = $builder; + } +} diff --git a/vendor/endroid/qr-code/src/Builder/BuilderRegistryInterface.php b/vendor/endroid/qr-code/src/Builder/BuilderRegistryInterface.php new file mode 100755 index 0000000..048d649 --- /dev/null +++ b/vendor/endroid/qr-code/src/Builder/BuilderRegistryInterface.php @@ -0,0 +1,12 @@ +red = $red; + $this->green = $green; + $this->blue = $blue; + $this->alpha = $alpha; + } + + public function getRed(): int + { + return $this->red; + } + + public function getGreen(): int + { + return $this->green; + } + + public function getBlue(): int + { + return $this->blue; + } + + public function getAlpha(): int + { + return $this->alpha; + } + + public function getOpacity(): float + { + return 1 - $this->alpha / 127; + } + + public function toArray(): array + { + return [ + 'red' => $this->red, + 'green' => $this->green, + 'blue' => $this->blue, + 'alpha' => $this->alpha, + ]; + } +} diff --git a/vendor/endroid/qr-code/src/Color/ColorInterface.php b/vendor/endroid/qr-code/src/Color/ColorInterface.php new file mode 100755 index 0000000..91d3818 --- /dev/null +++ b/vendor/endroid/qr-code/src/Color/ColorInterface.php @@ -0,0 +1,21 @@ + */ + public function toArray(): array; +} diff --git a/vendor/endroid/qr-code/src/Encoding/Encoding.php b/vendor/endroid/qr-code/src/Encoding/Encoding.php new file mode 100755 index 0000000..2126d1e --- /dev/null +++ b/vendor/endroid/qr-code/src/Encoding/Encoding.php @@ -0,0 +1,24 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } +} diff --git a/vendor/endroid/qr-code/src/Encoding/EncodingInterface.php b/vendor/endroid/qr-code/src/Encoding/EncodingInterface.php new file mode 100755 index 0000000..f57001b --- /dev/null +++ b/vendor/endroid/qr-code/src/Encoding/EncodingInterface.php @@ -0,0 +1,10 @@ +width = $width; + $this->height = $height; + } + + public static function createForLabel(LabelInterface $label): self + { + if (false !== strpos($label->getText(), "\n")) { + throw new \Exception('Label does not support line breaks'); + } + + if (!function_exists('imagettfbbox')) { + throw new \Exception('Function "imagettfbbox" does not exist: check your FreeType installation'); + } + + $labelBox = imagettfbbox($label->getFont()->getSize(), 0, $label->getFont()->getPath(), $label->getText()); + + if (!is_array($labelBox)) { + throw new \Exception('Unable to generate label image box: check your FreeType installation'); + } + + return new self( + intval($labelBox[2] - $labelBox[0]), + intval($labelBox[0] - $labelBox[7]) + ); + } + + public function getWidth(): int + { + return $this->width; + } + + public function getHeight(): int + { + return $this->height; + } +} diff --git a/vendor/endroid/qr-code/src/ImageData/LogoImageData.php b/vendor/endroid/qr-code/src/ImageData/LogoImageData.php new file mode 100755 index 0000000..75b4078 --- /dev/null +++ b/vendor/endroid/qr-code/src/ImageData/LogoImageData.php @@ -0,0 +1,164 @@ +data = $data; + $this->image = $image; + $this->mimeType = $mimeType; + $this->width = $width; + $this->height = $height; + $this->punchoutBackground = $punchoutBackground; + } + + public static function createForLogo(LogoInterface $logo): self + { + $data = @file_get_contents($logo->getPath()); + + if (!is_string($data)) { + throw new \Exception(sprintf('Invalid data at path "%s"', $logo->getPath())); + } + + if (false !== filter_var($logo->getPath(), FILTER_VALIDATE_URL)) { + $mimeType = self::detectMimeTypeFromUrl($logo->getPath()); + } else { + $mimeType = self::detectMimeTypeFromPath($logo->getPath()); + } + + $width = $logo->getResizeToWidth(); + $height = $logo->getResizeToHeight(); + + if ('image/svg+xml' === $mimeType) { + if (null === $width || null === $height) { + throw new \Exception('SVG Logos require an explicitly set resize width and height'); + } + + return new self($data, null, $mimeType, $width, $height, $logo->getPunchoutBackground()); + } + + $image = @imagecreatefromstring($data); + + if (!$image) { + throw new \Exception(sprintf('Unable to parse image data at path "%s"', $logo->getPath())); + } + + // No target width and height specified: use from original image + if (null !== $width && null !== $height) { + return new self($data, $image, $mimeType, $width, $height, $logo->getPunchoutBackground()); + } + + // Only target width specified: calculate height + if (null !== $width && null === $height) { + return new self($data, $image, $mimeType, $width, intval(imagesy($image) * $width / imagesx($image)), $logo->getPunchoutBackground()); + } + + // Only target height specified: calculate width + if (null === $width && null !== $height) { + return new self($data, $image, $mimeType, intval(imagesx($image) * $height / imagesy($image)), $height, $logo->getPunchoutBackground()); + } + + return new self($data, $image, $mimeType, imagesx($image), imagesy($image), $logo->getPunchoutBackground()); + } + + public function getData(): string + { + return $this->data; + } + + /** @return mixed */ + public function getImage() + { + if (null === $this->image) { + throw new \Exception('SVG Images have no image resource'); + } + + return $this->image; + } + + public function getMimeType(): string + { + return $this->mimeType; + } + + public function getWidth(): int + { + return $this->width; + } + + public function getHeight(): int + { + return $this->height; + } + + public function getPunchoutBackground(): bool + { + return $this->punchoutBackground; + } + + public function createDataUri(): string + { + return 'data:'.$this->mimeType.';base64,'.base64_encode($this->data); + } + + private static function detectMimeTypeFromUrl(string $url): string + { + /** @var mixed $format */ + $format = PHP_VERSION_ID >= 80000 ? true : 1; + + $headers = get_headers($url, $format); + + if (!is_array($headers) || !isset($headers['Content-Type'])) { + throw new \Exception(sprintf('Content type could not be determined for logo URL "%s"', $url)); + } + + return is_array($headers['Content-Type']) ? $headers['Content-Type'][1] : $headers['Content-Type']; + } + + private static function detectMimeTypeFromPath(string $path): string + { + if (!function_exists('mime_content_type')) { + throw new \Exception('You need the ext-fileinfo extension to determine logo mime type'); + } + + $mimeType = @mime_content_type($path); + + if (!is_string($mimeType)) { + throw new \Exception('Could not determine mime type'); + } + + if (!preg_match('#^image/#', $mimeType)) { + throw new \Exception('Logo path is not an image'); + } + + // Passing mime type image/svg results in invisible images + if ('image/svg' === $mimeType) { + return 'image/svg+xml'; + } + + return $mimeType; + } +} diff --git a/vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentCenter.php b/vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentCenter.php new file mode 100755 index 0000000..c13e287 --- /dev/null +++ b/vendor/endroid/qr-code/src/Label/Alignment/LabelAlignmentCenter.php @@ -0,0 +1,9 @@ +validatePath($path); + + $this->path = $path; + $this->size = $size; + } + + private function validatePath(string $path): void + { + if (!file_exists($path)) { + throw new \Exception(sprintf('Invalid font path "%s"', $path)); + } + } + + public function getPath(): string + { + return $this->path; + } + + public function getSize(): int + { + return $this->size; + } +} diff --git a/vendor/endroid/qr-code/src/Label/Font/FontInterface.php b/vendor/endroid/qr-code/src/Label/Font/FontInterface.php new file mode 100755 index 0000000..1c0de9a --- /dev/null +++ b/vendor/endroid/qr-code/src/Label/Font/FontInterface.php @@ -0,0 +1,12 @@ +size = $size; + } + + public function getPath(): string + { + return __DIR__.'/../../../assets/noto_sans.otf'; + } + + public function getSize(): int + { + return $this->size; + } +} diff --git a/vendor/endroid/qr-code/src/Label/Font/OpenSans.php b/vendor/endroid/qr-code/src/Label/Font/OpenSans.php new file mode 100755 index 0000000..4daab73 --- /dev/null +++ b/vendor/endroid/qr-code/src/Label/Font/OpenSans.php @@ -0,0 +1,25 @@ +size = $size; + } + + public function getPath(): string + { + return __DIR__.'/../../../assets/open_sans.ttf'; + } + + public function getSize(): int + { + return $this->size; + } +} diff --git a/vendor/endroid/qr-code/src/Label/Label.php b/vendor/endroid/qr-code/src/Label/Label.php new file mode 100755 index 0000000..5d5d013 --- /dev/null +++ b/vendor/endroid/qr-code/src/Label/Label.php @@ -0,0 +1,102 @@ +text = $text; + $this->font = isset($font) ? $font : new Font(__DIR__.'/../../assets/noto_sans.otf', 16); + $this->alignment = isset($alignment) ? $alignment : new LabelAlignmentCenter(); + $this->margin = isset($margin) ? $margin : new Margin(0, 10, 10, 10); + $this->textColor = isset($textColor) ? $textColor : new Color(0, 0, 0); + } + + public static function create(string $text): self + { + return new self($text); + } + + public function getText(): string + { + return $this->text; + } + + public function setText(string $text): self + { + $this->text = $text; + + return $this; + } + + public function getFont(): FontInterface + { + return $this->font; + } + + public function setFont(FontInterface $font): self + { + $this->font = $font; + + return $this; + } + + public function getAlignment(): LabelAlignmentInterface + { + return $this->alignment; + } + + public function setAlignment(LabelAlignmentInterface $alignment): self + { + $this->alignment = $alignment; + + return $this; + } + + public function getMargin(): MarginInterface + { + return $this->margin; + } + + public function setMargin(MarginInterface $margin): self + { + $this->margin = $margin; + + return $this; + } + + public function getTextColor(): ColorInterface + { + return $this->textColor; + } + + public function setTextColor(ColorInterface $textColor): self + { + $this->textColor = $textColor; + + return $this; + } +} diff --git a/vendor/endroid/qr-code/src/Label/LabelInterface.php b/vendor/endroid/qr-code/src/Label/LabelInterface.php new file mode 100755 index 0000000..a7d2ed6 --- /dev/null +++ b/vendor/endroid/qr-code/src/Label/LabelInterface.php @@ -0,0 +1,23 @@ +top = $top; + $this->right = $right; + $this->bottom = $bottom; + $this->left = $left; + } + + public function getTop(): int + { + return $this->top; + } + + public function getRight(): int + { + return $this->right; + } + + public function getBottom(): int + { + return $this->bottom; + } + + public function getLeft(): int + { + return $this->left; + } + + /** @return array */ + public function toArray(): array + { + return [ + 'top' => $this->top, + 'right' => $this->right, + 'bottom' => $this->bottom, + 'left' => $this->left, + ]; + } +} diff --git a/vendor/endroid/qr-code/src/Label/Margin/MarginInterface.php b/vendor/endroid/qr-code/src/Label/Margin/MarginInterface.php new file mode 100755 index 0000000..bc428bd --- /dev/null +++ b/vendor/endroid/qr-code/src/Label/Margin/MarginInterface.php @@ -0,0 +1,19 @@ + */ + public function toArray(): array; +} diff --git a/vendor/endroid/qr-code/src/Logo/Logo.php b/vendor/endroid/qr-code/src/Logo/Logo.php new file mode 100755 index 0000000..b50d743 --- /dev/null +++ b/vendor/endroid/qr-code/src/Logo/Logo.php @@ -0,0 +1,74 @@ +path = $path; + $this->resizeToWidth = $resizeToWidth; + $this->resizeToHeight = $resizeToHeight; + $this->punchoutBackground = $punchoutBackground; + } + + public static function create(string $path): self + { + return new self($path); + } + + public function getPath(): string + { + return $this->path; + } + + public function setPath(string $path): self + { + $this->path = $path; + + return $this; + } + + public function getResizeToWidth(): ?int + { + return $this->resizeToWidth; + } + + public function setResizeToWidth(?int $resizeToWidth): self + { + $this->resizeToWidth = $resizeToWidth; + + return $this; + } + + public function getResizeToHeight(): ?int + { + return $this->resizeToHeight; + } + + public function setResizeToHeight(?int $resizeToHeight): self + { + $this->resizeToHeight = $resizeToHeight; + + return $this; + } + + public function getPunchoutBackground(): bool + { + return $this->punchoutBackground; + } + + public function setPunchoutBackground(bool $punchoutBackground): self + { + $this->punchoutBackground = $punchoutBackground; + + return $this; + } +} diff --git a/vendor/endroid/qr-code/src/Logo/LogoInterface.php b/vendor/endroid/qr-code/src/Logo/LogoInterface.php new file mode 100755 index 0000000..13d940c --- /dev/null +++ b/vendor/endroid/qr-code/src/Logo/LogoInterface.php @@ -0,0 +1,16 @@ +> */ + private array $blockValues = []; + + private float $blockSize; + private int $innerSize; + private int $outerSize; + private int $marginLeft; + private int $marginRight; + + /** @param array> $blockValues */ + public function __construct(array $blockValues, int $size, int $margin, RoundBlockSizeModeInterface $roundBlockSizeMode) + { + $this->blockValues = $blockValues; + + $this->blockSize = $size / $this->getBlockCount(); + $this->innerSize = $size; + $this->outerSize = $size + 2 * $margin; + + if ($roundBlockSizeMode instanceof RoundBlockSizeModeEnlarge) { + $this->blockSize = intval(ceil($this->blockSize)); + $this->innerSize = intval($this->blockSize * $this->getBlockCount()); + $this->outerSize = $this->innerSize + 2 * $margin; + } elseif ($roundBlockSizeMode instanceof RoundBlockSizeModeShrink) { + $this->blockSize = intval(floor($this->blockSize)); + $this->innerSize = intval($this->blockSize * $this->getBlockCount()); + $this->outerSize = $this->innerSize + 2 * $margin; + } elseif ($roundBlockSizeMode instanceof RoundBlockSizeModeMargin) { + $this->blockSize = intval(floor($this->blockSize)); + $this->innerSize = intval($this->blockSize * $this->getBlockCount()); + } + + if ($this->blockSize < 1) { + throw new \Exception('Too much data: increase image dimensions or lower error correction level'); + } + + $this->marginLeft = intval(($this->outerSize - $this->innerSize) / 2); + $this->marginRight = $this->outerSize - $this->innerSize - $this->marginLeft; + } + + public function getBlockValue(int $rowIndex, int $columnIndex): int + { + return $this->blockValues[$rowIndex][$columnIndex]; + } + + public function getBlockCount(): int + { + return count($this->blockValues[0]); + } + + public function getBlockSize(): float + { + return $this->blockSize; + } + + public function getInnerSize(): int + { + return $this->innerSize; + } + + public function getOuterSize(): int + { + return $this->outerSize; + } + + public function getMarginLeft(): int + { + return $this->marginLeft; + } + + public function getMarginRight(): int + { + return $this->marginRight; + } +} diff --git a/vendor/endroid/qr-code/src/Matrix/MatrixFactoryInterface.php b/vendor/endroid/qr-code/src/Matrix/MatrixFactoryInterface.php new file mode 100755 index 0000000..be501f1 --- /dev/null +++ b/vendor/endroid/qr-code/src/Matrix/MatrixFactoryInterface.php @@ -0,0 +1,12 @@ +data = $data; + $this->encoding = $encoding ?? new Encoding('UTF-8'); + $this->errorCorrectionLevel = $errorCorrectionLevel ?? new ErrorCorrectionLevelLow(); + $this->size = $size; + $this->margin = $margin; + $this->roundBlockSizeMode = $roundBlockSizeMode ?? new RoundBlockSizeModeMargin(); + $this->foregroundColor = $foregroundColor ?? new Color(0, 0, 0); + $this->backgroundColor = $backgroundColor ?? new Color(255, 255, 255); + } + + public static function create(string $data): self + { + return new self($data); + } + + public function getData(): string + { + return $this->data; + } + + public function setData(string $data): self + { + $this->data = $data; + + return $this; + } + + public function getEncoding(): EncodingInterface + { + return $this->encoding; + } + + public function setEncoding(Encoding $encoding): self + { + $this->encoding = $encoding; + + return $this; + } + + public function getErrorCorrectionLevel(): ErrorCorrectionLevelInterface + { + return $this->errorCorrectionLevel; + } + + public function setErrorCorrectionLevel(ErrorCorrectionLevelInterface $errorCorrectionLevel): self + { + $this->errorCorrectionLevel = $errorCorrectionLevel; + + return $this; + } + + public function getSize(): int + { + return $this->size; + } + + public function setSize(int $size): self + { + $this->size = $size; + + return $this; + } + + public function getMargin(): int + { + return $this->margin; + } + + public function setMargin(int $margin): self + { + $this->margin = $margin; + + return $this; + } + + public function getRoundBlockSizeMode(): RoundBlockSizeModeInterface + { + return $this->roundBlockSizeMode; + } + + public function setRoundBlockSizeMode(RoundBlockSizeModeInterface $roundBlockSizeMode): self + { + $this->roundBlockSizeMode = $roundBlockSizeMode; + + return $this; + } + + public function getForegroundColor(): ColorInterface + { + return $this->foregroundColor; + } + + public function setForegroundColor(ColorInterface $foregroundColor): self + { + $this->foregroundColor = $foregroundColor; + + return $this; + } + + public function getBackgroundColor(): ColorInterface + { + return $this->backgroundColor; + } + + public function setBackgroundColor(ColorInterface $backgroundColor): self + { + $this->backgroundColor = $backgroundColor; + + return $this; + } +} diff --git a/vendor/endroid/qr-code/src/QrCodeInterface.php b/vendor/endroid/qr-code/src/QrCodeInterface.php new file mode 100755 index 0000000..2c96984 --- /dev/null +++ b/vendor/endroid/qr-code/src/QrCodeInterface.php @@ -0,0 +1,29 @@ +create($qrCode); + + return new BinaryResult($matrix); + } +} diff --git a/vendor/endroid/qr-code/src/Writer/DebugWriter.php b/vendor/endroid/qr-code/src/Writer/DebugWriter.php new file mode 100755 index 0000000..3e89515 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/DebugWriter.php @@ -0,0 +1,28 @@ +setValidateResult(true); + } +} diff --git a/vendor/endroid/qr-code/src/Writer/EpsWriter.php b/vendor/endroid/qr-code/src/Writer/EpsWriter.php new file mode 100755 index 0000000..2ffd219 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/EpsWriter.php @@ -0,0 +1,44 @@ +create($qrCode); + + $lines = [ + '%!PS-Adobe-3.0 EPSF-3.0', + '%%BoundingBox: 0 0 '.$matrix->getOuterSize().' '.$matrix->getOuterSize(), + '/F { rectfill } def', + number_format($qrCode->getBackgroundColor()->getRed() / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()->getGreen() / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()->getBlue() / 100, 2, '.', ',').' setrgbcolor', + '0 0 '.$matrix->getOuterSize().' '.$matrix->getOuterSize().' F', + number_format($qrCode->getForegroundColor()->getRed() / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()->getGreen() / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()->getBlue() / 100, 2, '.', ',').' setrgbcolor', + ]; + + for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) { + for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) { + if (1 === $matrix->getBlockValue($matrix->getBlockCount() - 1 - $rowIndex, $columnIndex)) { + $x = $matrix->getMarginLeft() + $matrix->getBlockSize() * $columnIndex; + $y = $matrix->getMarginLeft() + $matrix->getBlockSize() * $rowIndex; + $lines[] = number_format($x, self::DECIMAL_PRECISION, '.', '').' '.number_format($y, self::DECIMAL_PRECISION, '.', '').' '.number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', '').' '.number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', '').' F'; + } + } + } + + return new EpsResult($lines); + } +} diff --git a/vendor/endroid/qr-code/src/Writer/PdfWriter.php b/vendor/endroid/qr-code/src/Writer/PdfWriter.php new file mode 100755 index 0000000..78f0603 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/PdfWriter.php @@ -0,0 +1,133 @@ +create($qrCode); + + $unit = 'mm'; + if (isset($options[self::WRITER_OPTION_UNIT])) { + $unit = $options[self::WRITER_OPTION_UNIT]; + } + + $allowedUnits = ['mm', 'pt', 'cm', 'in']; + if (!in_array($unit, $allowedUnits)) { + throw new \Exception(sprintf('PDF Measure unit should be one of [%s]', implode(', ', $allowedUnits))); + } + + $labelSpace = 0; + if ($label instanceof LabelInterface) { + $labelSpace = 30; + } + + if (!class_exists(\FPDF::class)) { + throw new \Exception('Unable to find FPDF: check your installation'); + } + + $foregroundColor = $qrCode->getForegroundColor(); + if ($foregroundColor->getAlpha() > 0) { + throw new \Exception('PDF Writer does not support alpha channels'); + } + $backgroundColor = $qrCode->getBackgroundColor(); + if ($backgroundColor->getAlpha() > 0) { + throw new \Exception('PDF Writer does not support alpha channels'); + } + + if (isset($options[self::WRITER_OPTION_PDF])) { + $fpdf = $options[self::WRITER_OPTION_PDF]; + if (!$fpdf instanceof \FPDF) { + throw new \Exception('pdf option must be an instance of FPDF'); + } + } else { + // @todo Check how to add label height later + $fpdf = new \FPDF('P', $unit, [$matrix->getOuterSize(), $matrix->getOuterSize() + $labelSpace]); + $fpdf->AddPage(); + } + + $x = 0; + if (isset($options[self::WRITER_OPTION_X])) { + $x = $options[self::WRITER_OPTION_X]; + } + $y = 0; + if (isset($options[self::WRITER_OPTION_Y])) { + $y = $options[self::WRITER_OPTION_Y]; + } + + $fpdf->SetFillColor($backgroundColor->getRed(), $backgroundColor->getGreen(), $backgroundColor->getBlue()); + $fpdf->Rect($x, $y, $matrix->getOuterSize(), $matrix->getOuterSize(), 'F'); + $fpdf->SetFillColor($foregroundColor->getRed(), $foregroundColor->getGreen(), $foregroundColor->getBlue()); + + for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) { + for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) { + if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) { + $fpdf->Rect( + $x + $matrix->getMarginLeft() + ($columnIndex * $matrix->getBlockSize()), + $y + $matrix->getMarginLeft() + ($rowIndex * $matrix->getBlockSize()), + $matrix->getBlockSize(), + $matrix->getBlockSize(), + 'F' + ); + } + } + } + + if ($logo instanceof LogoInterface) { + $this->addLogo($logo, $fpdf, $x, $y, $matrix->getOuterSize()); + } + + if ($label instanceof LabelInterface) { + $fpdf->SetXY($x, $y + $matrix->getOuterSize() + $labelSpace - 25); + $fpdf->SetFont('Helvetica', '', $label->getFont()->getSize()); + $fpdf->Cell($matrix->getOuterSize(), 0, $label->getText(), 0, 0, 'C'); + } + + return new PdfResult($fpdf); + } + + private function addLogo(LogoInterface $logo, \FPDF $fpdf, float $x, float $y, float $size): void + { + $logoPath = $logo->getPath(); + $logoHeight = $logo->getResizeToHeight(); + $logoWidth = $logo->getResizeToWidth(); + + if (null === $logoHeight || null === $logoWidth) { + $imageSize = \getimagesize($logoPath); + if (!$imageSize) { + throw new \Exception(sprintf('Unable to read image size for logo "%s"', $logoPath)); + } + [$logoSourceWidth, $logoSourceHeight] = $imageSize; + + if (null === $logoWidth) { + $logoWidth = (int) $logoSourceWidth; + } + + if (null === $logoHeight) { + $aspectRatio = $logoWidth / $logoSourceWidth; + $logoHeight = (int) ($logoSourceHeight * $aspectRatio); + } + } + + $logoX = $x + $size / 2 - $logoWidth / 2; + $logoY = $y + $size / 2 - $logoHeight / 2; + + $fpdf->Image($logoPath, $logoX, $logoY, $logoWidth, $logoHeight); + } +} diff --git a/vendor/endroid/qr-code/src/Writer/PngWriter.php b/vendor/endroid/qr-code/src/Writer/PngWriter.php new file mode 100755 index 0000000..e944d84 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/PngWriter.php @@ -0,0 +1,227 @@ +create($qrCode); + + $baseBlockSize = $qrCode->getRoundBlockSizeMode() instanceof RoundBlockSizeModeNone ? 10 : intval($matrix->getBlockSize()); + $baseImage = imagecreatetruecolor($matrix->getBlockCount() * $baseBlockSize, $matrix->getBlockCount() * $baseBlockSize); + + if (!$baseImage) { + throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly'); + } + + /** @var int $foregroundColor */ + $foregroundColor = imagecolorallocatealpha( + $baseImage, + $qrCode->getForegroundColor()->getRed(), + $qrCode->getForegroundColor()->getGreen(), + $qrCode->getForegroundColor()->getBlue(), + $qrCode->getForegroundColor()->getAlpha() + ); + + /** @var int $transparentColor */ + $transparentColor = imagecolorallocatealpha($baseImage, 255, 255, 255, 127); + + imagefill($baseImage, 0, 0, $transparentColor); + + for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) { + for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) { + if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) { + imagefilledrectangle( + $baseImage, + $columnIndex * $baseBlockSize, + $rowIndex * $baseBlockSize, + ($columnIndex + 1) * $baseBlockSize - 1, + ($rowIndex + 1) * $baseBlockSize - 1, + $foregroundColor + ); + } + } + } + + $targetWidth = $matrix->getOuterSize(); + $targetHeight = $matrix->getOuterSize(); + + if ($label instanceof LabelInterface) { + $labelImageData = LabelImageData::createForLabel($label); + $targetHeight += $labelImageData->getHeight() + $label->getMargin()->getTop() + $label->getMargin()->getBottom(); + } + + $targetImage = imagecreatetruecolor($targetWidth, $targetHeight); + + if (!$targetImage) { + throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly'); + } + + /** @var int $backgroundColor */ + $backgroundColor = imagecolorallocatealpha( + $targetImage, + $qrCode->getBackgroundColor()->getRed(), + $qrCode->getBackgroundColor()->getGreen(), + $qrCode->getBackgroundColor()->getBlue(), + $qrCode->getBackgroundColor()->getAlpha() + ); + + imagefill($targetImage, 0, 0, $backgroundColor); + + imagecopyresampled( + $targetImage, + $baseImage, + $matrix->getMarginLeft(), + $matrix->getMarginLeft(), + 0, + 0, + $matrix->getInnerSize(), + $matrix->getInnerSize(), + imagesx($baseImage), + imagesy($baseImage) + ); + + if (PHP_VERSION_ID < 80000) { + imagedestroy($baseImage); + } + + if ($qrCode->getBackgroundColor()->getAlpha() > 0) { + imagesavealpha($targetImage, true); + } + + $result = new PngResult($targetImage); + + if ($logo instanceof LogoInterface) { + $result = $this->addLogo($logo, $result); + } + + if ($label instanceof LabelInterface) { + $result = $this->addLabel($label, $result); + } + + return $result; + } + + private function addLogo(LogoInterface $logo, PngResult $result): PngResult + { + $logoImageData = LogoImageData::createForLogo($logo); + + if ('image/svg+xml' === $logoImageData->getMimeType()) { + throw new \Exception('PNG Writer does not support SVG logo'); + } + + $targetImage = $result->getImage(); + + if ($logoImageData->getPunchoutBackground()) { + /** @var int $transparent */ + $transparent = imagecolorallocatealpha($targetImage, 255, 255, 255, 127); + imagealphablending($targetImage, false); + for ( + $x_offset = intval(imagesx($targetImage) / 2 - $logoImageData->getWidth() / 2); + $x_offset < intval(imagesx($targetImage) / 2 - $logoImageData->getWidth() / 2) + $logoImageData->getWidth(); + ++$x_offset + ) { + for ( + $y_offset = intval(imagesy($targetImage) / 2 - $logoImageData->getHeight() / 2); + $y_offset < intval(imagesy($targetImage) / 2 - $logoImageData->getHeight() / 2) + $logoImageData->getHeight(); + ++$y_offset + ) { + imagesetpixel( + $targetImage, + $x_offset, + $y_offset, + $transparent + ); + } + } + } + + imagecopyresampled( + $targetImage, + $logoImageData->getImage(), + intval(imagesx($targetImage) / 2 - $logoImageData->getWidth() / 2), + intval(imagesx($targetImage) / 2 - $logoImageData->getHeight() / 2), + 0, + 0, + $logoImageData->getWidth(), + $logoImageData->getHeight(), + imagesx($logoImageData->getImage()), + imagesy($logoImageData->getImage()) + ); + + if (PHP_VERSION_ID < 80000) { + imagedestroy($logoImageData->getImage()); + } + + return new PngResult($targetImage); + } + + private function addLabel(LabelInterface $label, PngResult $result): PngResult + { + $targetImage = $result->getImage(); + + $labelImageData = LabelImageData::createForLabel($label); + + /** @var int $textColor */ + $textColor = imagecolorallocatealpha( + $targetImage, + $label->getTextColor()->getRed(), + $label->getTextColor()->getGreen(), + $label->getTextColor()->getBlue(), + $label->getTextColor()->getAlpha() + ); + + $x = intval(imagesx($targetImage) / 2 - $labelImageData->getWidth() / 2); + $y = imagesy($targetImage) - $label->getMargin()->getBottom(); + + if ($label->getAlignment() instanceof LabelAlignmentLeft) { + $x = $label->getMargin()->getLeft(); + } elseif ($label->getAlignment() instanceof LabelAlignmentRight) { + $x = imagesx($targetImage) - $labelImageData->getWidth() - $label->getMargin()->getRight(); + } + + imagettftext($targetImage, $label->getFont()->getSize(), 0, $x, $y, $textColor, $label->getFont()->getPath(), $label->getText()); + + return new PngResult($targetImage); + } + + public function validateResult(ResultInterface $result, string $expectedData): void + { + $string = $result->getString(); + + if (!class_exists(QrReader::class)) { + throw new \Exception('Please install khanamiryan/qrcode-detector-decoder or disable image validation'); + } + + if (PHP_VERSION_ID >= 80000) { + throw new \Exception('The validator is not compatible with PHP 8 yet, see https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/103'); + } + + $reader = new QrReader($string, QrReader::SOURCE_TYPE_BLOB); + if ($reader->text() !== $expectedData) { + throw new \Exception('Built-in validation reader read "'.$reader->text().'" instead of "'.$expectedData.'". + Adjust your parameters to increase readability or disable built-in validation.'); + } + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/AbstractResult.php b/vendor/endroid/qr-code/src/Writer/Result/AbstractResult.php new file mode 100755 index 0000000..43b680b --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/AbstractResult.php @@ -0,0 +1,19 @@ +getMimeType().';base64,'.base64_encode($this->getString()); + } + + public function saveToFile(string $path): void + { + $string = $this->getString(); + file_put_contents($path, $string); + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/BinaryResult.php b/vendor/endroid/qr-code/src/Writer/Result/BinaryResult.php new file mode 100755 index 0000000..0618940 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/BinaryResult.php @@ -0,0 +1,35 @@ +matrix = $matrix; + } + + public function getString(): string + { + $binaryString = ''; + for ($rowIndex = 0; $rowIndex < $this->matrix->getBlockCount(); ++$rowIndex) { + for ($columnIndex = 0; $columnIndex < $this->matrix->getBlockCount(); ++$columnIndex) { + $binaryString .= $this->matrix->getBlockValue($rowIndex, $columnIndex); + } + $binaryString .= "\n"; + } + + return $binaryString; + } + + public function getMimeType(): string + { + return 'text/plain'; + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/DebugResult.php b/vendor/endroid/qr-code/src/Writer/Result/DebugResult.php new file mode 100755 index 0000000..c3cbff0 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/DebugResult.php @@ -0,0 +1,77 @@ + */ + private array $options; + + private bool $validateResult = false; + + /** @param array $options */ + public function __construct(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []) + { + $this->qrCode = $qrCode; + $this->logo = $logo; + $this->label = $label; + $this->options = $options; + } + + public function setValidateResult(bool $validateResult): void + { + $this->validateResult = $validateResult; + } + + public function getString(): string + { + $debugLines = []; + + $debugLines[] = 'Data: '.$this->qrCode->getData(); + $debugLines[] = 'Encoding: '.$this->qrCode->getEncoding(); + $debugLines[] = 'Error Correction Level: '.get_class($this->qrCode->getErrorCorrectionLevel()); + $debugLines[] = 'Size: '.$this->qrCode->getSize(); + $debugLines[] = 'Margin: '.$this->qrCode->getMargin(); + $debugLines[] = 'Round block size mode: '.get_class($this->qrCode->getRoundBlockSizeMode()); + $debugLines[] = 'Foreground color: ['.implode(', ', $this->qrCode->getForegroundColor()->toArray()).']'; + $debugLines[] = 'Background color: ['.implode(', ', $this->qrCode->getBackgroundColor()->toArray()).']'; + + foreach ($this->options as $key => $value) { + $debugLines[] = 'Writer option: '.$key.': '.$value; + } + + if (isset($this->logo)) { + $debugLines[] = 'Logo path: '.$this->logo->getPath(); + $debugLines[] = 'Logo resize to width: '.$this->logo->getResizeToWidth(); + $debugLines[] = 'Logo resize to height: '.$this->logo->getResizeToHeight(); + } + + if (isset($this->label)) { + $debugLines[] = 'Label text: '.$this->label->getText(); + $debugLines[] = 'Label font path: '.$this->label->getFont()->getPath(); + $debugLines[] = 'Label font size: '.$this->label->getFont()->getSize(); + $debugLines[] = 'Label alignment: '.get_class($this->label->getAlignment()); + $debugLines[] = 'Label margin: ['.implode(', ', $this->label->getMargin()->toArray()).']'; + $debugLines[] = 'Label text color: ['.implode(', ', $this->label->getTextColor()->toArray()).']'; + } + + $debugLines[] = 'Validate result: '.($this->validateResult ? 'true' : 'false'); + + return implode("\n", $debugLines); + } + + public function getMimeType(): string + { + return 'text/plain'; + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/EpsResult.php b/vendor/endroid/qr-code/src/Writer/Result/EpsResult.php new file mode 100755 index 0000000..0e55991 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/EpsResult.php @@ -0,0 +1,27 @@ + */ + private array $lines; + + /** @param array $lines */ + public function __construct(array $lines) + { + $this->lines = $lines; + } + + public function getString(): string + { + return implode("\n", $this->lines); + } + + public function getMimeType(): string + { + return 'image/eps'; + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/PdfResult.php b/vendor/endroid/qr-code/src/Writer/Result/PdfResult.php new file mode 100755 index 0000000..b4c644f --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/PdfResult.php @@ -0,0 +1,30 @@ +fpdf = $fpdf; + } + + public function getPdf(): \FPDF + { + return $this->fpdf; + } + + public function getString(): string + { + return $this->fpdf->Output('S'); + } + + public function getMimeType(): string + { + return 'application/pdf'; + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/PngResult.php b/vendor/endroid/qr-code/src/Writer/Result/PngResult.php new file mode 100755 index 0000000..efa26c5 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/PngResult.php @@ -0,0 +1,36 @@ +image = $image; + } + + /** @return mixed */ + public function getImage() + { + return $this->image; + } + + public function getString(): string + { + ob_start(); + imagepng($this->image); + + return strval(ob_get_clean()); + } + + public function getMimeType(): string + { + return 'image/png'; + } +} diff --git a/vendor/endroid/qr-code/src/Writer/Result/ResultInterface.php b/vendor/endroid/qr-code/src/Writer/Result/ResultInterface.php new file mode 100755 index 0000000..a255605 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/Result/ResultInterface.php @@ -0,0 +1,16 @@ +xml = $xml; + $this->excludeXmlDeclaration = $excludeXmlDeclaration; + } + + public function getXml(): \SimpleXMLElement + { + return $this->xml; + } + + public function getString(): string + { + $string = $this->xml->asXML(); + + if (!is_string($string)) { + throw new \Exception('Could not save SVG XML to string'); + } + + if ($this->excludeXmlDeclaration) { + $string = str_replace("\n", '', $string); + } + + return $string; + } + + public function getMimeType(): string + { + return 'image/svg+xml'; + } +} diff --git a/vendor/endroid/qr-code/src/Writer/SvgWriter.php b/vendor/endroid/qr-code/src/Writer/SvgWriter.php new file mode 100755 index 0000000..233c903 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/SvgWriter.php @@ -0,0 +1,107 @@ +create($qrCode); + + $xml = new \SimpleXMLElement(''); + $xml->addAttribute('version', '1.1'); + $xml->addAttribute('width', $matrix->getOuterSize().'px'); + $xml->addAttribute('height', $matrix->getOuterSize().'px'); + $xml->addAttribute('viewBox', '0 0 '.$matrix->getOuterSize().' '.$matrix->getOuterSize()); + $xml->addChild('defs'); + + $blockDefinition = $xml->defs->addChild('rect'); + $blockDefinition->addAttribute('id', strval($options[self::WRITER_OPTION_BLOCK_ID])); + $blockDefinition->addAttribute('width', number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', '')); + $blockDefinition->addAttribute('height', number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', '')); + $blockDefinition->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getForegroundColor()->getRed(), $qrCode->getForegroundColor()->getGreen(), $qrCode->getForegroundColor()->getBlue())); + $blockDefinition->addAttribute('fill-opacity', strval($qrCode->getForegroundColor()->getOpacity())); + + $background = $xml->addChild('rect'); + $background->addAttribute('x', '0'); + $background->addAttribute('y', '0'); + $background->addAttribute('width', strval($matrix->getOuterSize())); + $background->addAttribute('height', strval($matrix->getOuterSize())); + $background->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getBackgroundColor()->getRed(), $qrCode->getBackgroundColor()->getGreen(), $qrCode->getBackgroundColor()->getBlue())); + $background->addAttribute('fill-opacity', strval($qrCode->getBackgroundColor()->getOpacity())); + + for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) { + for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) { + if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) { + $block = $xml->addChild('use'); + $block->addAttribute('x', number_format($matrix->getMarginLeft() + $matrix->getBlockSize() * $columnIndex, self::DECIMAL_PRECISION, '.', '')); + $block->addAttribute('y', number_format($matrix->getMarginLeft() + $matrix->getBlockSize() * $rowIndex, self::DECIMAL_PRECISION, '.', '')); + $block->addAttribute('xlink:href', '#'.$options[self::WRITER_OPTION_BLOCK_ID], 'http://www.w3.org/1999/xlink'); + } + } + } + + $result = new SvgResult($xml, boolval($options[self::WRITER_OPTION_EXCLUDE_XML_DECLARATION])); + + if ($logo instanceof LogoInterface) { + $this->addLogo($logo, $result, $options); + } + + return $result; + } + + /** @param array $options */ + private function addLogo(LogoInterface $logo, SvgResult $result, array $options): void + { + $logoImageData = LogoImageData::createForLogo($logo); + + if (!isset($options[self::WRITER_OPTION_FORCE_XLINK_HREF])) { + $options[self::WRITER_OPTION_FORCE_XLINK_HREF] = false; + } + + $xml = $result->getXml(); + + /** @var \SimpleXMLElement $xmlAttributes */ + $xmlAttributes = $xml->attributes(); + + $x = intval($xmlAttributes->width) / 2 - $logoImageData->getWidth() / 2; + $y = intval($xmlAttributes->height) / 2 - $logoImageData->getHeight() / 2; + + $imageDefinition = $xml->addChild('image'); + $imageDefinition->addAttribute('x', strval($x)); + $imageDefinition->addAttribute('y', strval($y)); + $imageDefinition->addAttribute('width', strval($logoImageData->getWidth())); + $imageDefinition->addAttribute('height', strval($logoImageData->getHeight())); + $imageDefinition->addAttribute('preserveAspectRatio', 'none'); + + if ($options[self::WRITER_OPTION_FORCE_XLINK_HREF]) { + $imageDefinition->addAttribute('xlink:href', $logoImageData->createDataUri(), 'http://www.w3.org/1999/xlink'); + } else { + $imageDefinition->addAttribute('href', $logoImageData->createDataUri()); + } + } +} diff --git a/vendor/endroid/qr-code/src/Writer/ValidatingWriterInterface.php b/vendor/endroid/qr-code/src/Writer/ValidatingWriterInterface.php new file mode 100755 index 0000000..4f40048 --- /dev/null +++ b/vendor/endroid/qr-code/src/Writer/ValidatingWriterInterface.php @@ -0,0 +1,12 @@ + $options */ + public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface; +} diff --git a/vendor/wikimedia/less.php/CHANGES.md b/vendor/wikimedia/less.php/CHANGES.md new file mode 100755 index 0000000..92f82f8 --- /dev/null +++ b/vendor/wikimedia/less.php/CHANGES.md @@ -0,0 +1,70 @@ +# 3.1.0 +- [All Changes](https://github.com/wikimedia/less.php/compare/v3.0.0...v3.1.0) +* PHP 8.0 support: Drop use of curly braces for sub-string eval (James D. Forrester) +* Make `Directive::__construct` $rules arg optional (fix PHP 7.4 warning) (Sam Reed) +* ProcessExtends: Improve performance by using a map for selectors and parents (Andrey Legayev) +* build: Run CI tests on PHP 8.0 too (James D. Forrester) +* code: Fix PSR12.Properties.ConstantVisibility.NotFound (Sam Reed) + +# 3.0.0 +- [All Changes](https://github.com/wikimedia/less.php/compare/v2.0.0...v3.0.0) +- Raise PHP requirement from 7.1 to 7.2.9 (James Forrester) +- build: Upgrade phpunit to ^8.5 and make pass (James Forrester) +- build: Install php-parallel-lint (James Forrester) +- build: Install minus-x and make pass (James Forrester) + +# 2.0.0 +- [All Changes](https://github.com/wikimedia/less.php/compare/1.8.2...v2.0.0) +- Relax PHP requirement down to 7.1, from 7.2.9 (Franz Liedke) +- Reflect recent breaking changes properly with the semantic versioning (James Forrester) + +# 1.8.2 +- [All Changes](https://github.com/wikimedia/less.php/compare/1.8.1...1.8.2) +- Require PHP 7.2.9+, up from 5.3+ (James Forrester) +- Release: Update Version.php with the current release ID (COBadger) +- Fix access array offset on value of type null (Michele Locati) +- Fixed test suite on PHP 7.4 (Sergei Morozov) +- docs: Fix 1.8.1 "All changes" link (Timo Tijhof) + +# 1.8.1 +- [All Changes](https://github.com/wikimedia/less.php/compare/v1.8.0...1.8.1) +- Another PHP 7.3 compatibility tweak + +# 1.8.0 +- [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.13...v1.8.0) +- Wikimedia fork +- Supports up to PHP 7.3 +- No longer tested against PHP 5, though it's still remains allowed in `composer.json` for HHVM compatibility +- Switched to [semantic versioning](https://semver.org/), hence version numbers now use 3 digits + +# 1.7.0.13 + - [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.12...v1.7.0.13) + - Fix composer.json (PSR-4 was invalid) + +# 1.7.0.12 + - [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.11...v1.7.0.12) + - set bin/lessc bit executable + - Add 'gettingVariables' method in Less_Parser + +# 1.7.0.11 + - [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.10...v1.7.0.11) + - Fix realpath issue (windows) + - Set Less_Tree_Call property back to public ( Fix 258 266 267 issues from oyejorge/less.php) + +# 1.7.0.10 + + - [All Changes](https://github.com/oyejorge/less.php/compare/v1.7.0.9...v1.7.10) + - Add indentation option + - Add 'optional' modifier for @import + - fix $color in Exception messages + - don't use set_time_limit when running cli + - take relative-url into account when building the cache filename + - urlArgs should be string no array() + - add bug-report fixtures [#6dc898f](https://github.com/oyejorge/less.php/commit/6dc898f5d75b447464906bdf19d79c2e19d95e33) + - fix #269, missing on NameValue type [#a8dac63](https://github.com/oyejorge/less.php/commit/a8dac63d93fb941c54fb78b12588abf635747c1b) + +# 1.7.0.9 + + - [All Changes](https://github.com/oyejorge/less.php/compare/v1.7.0.8...v1.7.0.9) + - Remove space at beginning of Version.php + - Revert require() paths in test interface diff --git a/vendor/wikimedia/less.php/LICENSE b/vendor/wikimedia/less.php/LICENSE new file mode 100755 index 0000000..82216a5 --- /dev/null +++ b/vendor/wikimedia/less.php/LICENSE @@ -0,0 +1,178 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + diff --git a/vendor/wikimedia/less.php/README.md b/vendor/wikimedia/less.php/README.md new file mode 100755 index 0000000..d10177c --- /dev/null +++ b/vendor/wikimedia/less.php/README.md @@ -0,0 +1,315 @@ +[![Continuous Integration](https://github.com/wikimedia/less.php/workflows/PHP%20Test/badge.svg)](https://github.com/wikimedia/less.php/actions) + +[Less.php](http://lessphp.typesettercms.com) +======== + +This is the Wikimedia fork of a PHP port of the official LESS processor . + +* [About](#about) +* [Installation](#installation) +* [Basic Use](#basic-use) +* [Caching](#caching) +* [Source Maps](#source-maps) +* [Command Line](#command-line) +* [Integration with other projects](#integration-with-other-projects) +* [Transitioning from Leafo/lessphp](#transitioning-from-leafolessphp) +* [Credits](#credits) + + + +About +--- +The code structure of less.php mirrors that of the official processor which helps us ensure compatibility and allows for easy maintenance. + +Please note, there are a few unsupported LESS features: + +- Evaluation of JavaScript expressions within back-ticks (for obvious reasons). +- Definition of custom functions. + + +Installation +--- + +You can install the library with Composer or manually. + +#### Composer + +1. [Install Composer](https://getcomposer.org/download/) +2. Run `composer require wikimedia/less.php` + +#### Manually From Release + +Step 1. [Download a release](https://github.com/wikimedia/less.php/releases) and upload the PHP files to your server. + +Step 2. Include the library: + +```php +require_once '[path to less.php]/lib/Less/Autoloader.php'; +Less_Autoloader::register(); +``` + +Basic Use +--- + +#### Parsing Strings + +```php +$parser = new Less_Parser(); +$parser->parse( '@color: #4D926F; #header { color: @color; } h2 { color: @color; }' ); +$css = $parser->getCss(); +``` + + +#### Parsing LESS Files +The parseFile() function takes two arguments: + +1. The absolute path of the .less file to be parsed +2. The url root to prepend to any relative image or @import urls in the .less file. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', 'http://example.com/mysite/' ); +$css = $parser->getCss(); +``` + + +#### Handling Invalid LESS +An exception will be thrown if the compiler encounters invalid LESS. + +```php +try{ + $parser = new Less_Parser(); + $parser->parseFile( '/var/www/mysite/bootstrap.less', 'http://example.com/mysite/' ); + $css = $parser->getCss(); +}catch(Exception $e){ + $error_message = $e->getMessage(); +} +``` + + +#### Parsing Multiple Sources +less.php can parse multiple sources to generate a single CSS file. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$parser->parse( '@color: #4D926F; #header { color: @color; } h2 { color: @color; }' ); +$css = $parser->getCss(); +``` + +#### Getting Info About The Parsed Files +less.php can tell you which .less files were imported and parsed. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +$imported_files = $parser->allParsedFiles(); +``` + + +#### Compressing Output +You can tell less.php to remove comments and whitespace to generate minimized CSS files. + +```php +$options = array( 'compress'=>true ); +$parser = new Less_Parser( $options ); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +#### Getting Variables +You can use the getVariables() method to get an all variables defined and +their value in a php associative array. Note that LESS has to be previously +compiled. +```php +$parser = new Less_Parser; +$parser->parseFile( '/var/www/mysite/bootstrap.less'); +$css = $parser->getCss(); +$variables = $parser->getVariables(); + +``` + + + +#### Setting Variables +You can use the ModifyVars() method to customize your CSS if you have variables stored in PHP associative arrays. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$parser->ModifyVars( array('font-size-base'=>'16px') ); +$css = $parser->getCss(); +``` + + +#### Import Directories +By default, less.php will look for @imports in the directory of the file passed to parseFile(). +If you're using parse() or if @imports reside in different directories, you can tell less.php where to look. + +```php +$directories = array( '/var/www/mysite/bootstrap/' => '/mysite/bootstrap/' ); +$parser = new Less_Parser(); +$parser->SetImportDirs( $directories ); +$parser->parseFile( '/var/www/mysite/theme.less', '/mysite/' ); +$css = $parser->getCss(); +``` + + +Caching +--- +Compiling LESS code into CSS is a time consuming process, caching your results is highly recommended. + + +#### Caching CSS +Use the Less_Cache class to save and reuse the results of compiled LESS files. +This method will check the modified time and size of each LESS file (including imported files) and regenerate a new CSS file when changes are found. +Note: When changes are found, this method will return a different file name for the new cached content. + +```php +$less_files = array( '/var/www/mysite/bootstrap.less' => '/mysite/' ); +$options = array( 'cache_dir' => '/var/www/writable_folder' ); +$css_file_name = Less_Cache::Get( $less_files, $options ); +$compiled = file_get_contents( '/var/www/writable_folder/'.$css_file_name ); +``` + +#### Caching CSS With Variables +Passing options to Less_Cache::Get() + +```php +$less_files = array( '/var/www/mysite/bootstrap.less' => '/mysite/' ); +$options = array( 'cache_dir' => '/var/www/writable_folder' ); +$variables = array( 'width' => '100px' ); +$css_file_name = Less_Cache::Get( $less_files, $options, $variables ); +$compiled = file_get_contents( '/var/www/writable_folder/'.$css_file_name ); +``` + + +#### Parser Caching +less.php will save serialized parser data for each .less file if a writable folder is passed to the SetCacheDir() method. +Note: This feature only caches intermediate parsing results to improve the performance of repeated CSS generation. +Your application should cache any CSS generated by less.php. + +```php +$options = array('cache_dir'=>'/var/www/writable_folder'); +$parser = new Less_Parser( $options ); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +You can specify the caching technique used by changing the ```cache_method``` option. Supported methods are: +* ```php```: Creates valid PHP files which can be included without any changes (default method). +* ```var_export```: Like "php", but using PHP's ```var_export()``` function without any optimizations. + It's recommended to use "php" instead. +* ```serialize```: Faster, but pretty memory-intense. +* ```callback```: Use custom callback functions to implement your own caching method. Give the "cache_callback_get" and + "cache_callback_set" options with callables (see PHP's ```call_user_func()``` and ```is_callable()``` functions). less.php + will pass the parser object (class ```Less_Parser```), the path to the parsed .less file ("/some/path/to/file.less") and + an identifier that will change every time the .less file is modified. The ```get``` callback must return the ruleset + (an array with ```Less_Tree``` objects) provided as fourth parameter of the ```set``` callback. If something goes wrong, + return ```NULL``` (cache doesn't exist) or ```FALSE```. + + + +Source Maps +--- +Less.php supports v3 sourcemaps + +#### Inline +The sourcemap will be appended to the generated CSS file. + +```php +$options = array( 'sourceMap' => true ); +$parser = new Less_Parser($options); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +#### Saving to Map File + +```php +$options = array( + 'sourceMap' => true, + 'sourceMapWriteTo' => '/var/www/mysite/writable_folder/filename.map', + 'sourceMapURL' => '/mysite/writable_folder/filename.map', + ); +$parser = new Less_Parser($options); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + + +Command line +--- +An additional script has been included to use the compiler from the command line. +In the simplest invocation, you specify an input file and the compiled CSS is written to standard out: + +``` +$ lessc input.less > output.css +``` + +By using the -w flag you can watch a specified input file and have it compile as needed to the output file: + +``` +$ lessc -w input.less output.css +``` + +Errors from watch mode are written to standard out. + +For more help, run `lessc --help` + + +Integration with other projects +--- + +#### Drupal 7 + +This library can be used as drop-in replacement of lessphp to work with [Drupal 7 less module](https://drupal.org/project/less). + +How to install: + +1. [Download the less.php source code](https://github.com/wikimedia/less.php/archive/master.zip) and unzip it so that 'lessc.inc.php' is located at 'sites/all/libraries/lessphp/lessc.inc.php'. +2. Download and install [Drupal 7 less module](https://drupal.org/project/less) as usual. +3. That's it :) + +#### JBST WordPress theme + +JBST has a built-in LESS compiler based on lessphp. Customize your WordPress theme with LESS. + +How to use / install: + +1. [Download the latest release](https://github.com/bassjobsen/jamedo-bootstrap-start-theme) copy the files to your {wordpress/}wp-content/themes folder and activate it. +2. Find the compiler under Appearance > LESS Compiler in your WordPress dashboard +3. Enter your LESS code in the text area and press (re)compile + +Use the built-in compiler to: +- set any [Bootstrap](http://getbootstrap.com/customize/) variable or use Bootstrap's mixins: + -`@navbar-default-color: blue;` + - create a custom button: `.btn-custom { + .button-variant(white; red; blue); +}` +- set any built-in LESS variable: for example `@footer_bg_color: black;` sets the background color of the footer to black +- use built-in mixins: - add a custom font: `.include-custom-font(@family: arial,@font-path, @path: @custom-font-dir, @weight: normal, @style: normal);` + +The compiler can also be downloaded as [plugin](http://wordpress.org/plugins/wp-less-to-css/) + +#### WordPress + +This simple plugin will simply make the library available to other plugins and themes and can be used as a dependency using the [TGM Library](http://tgmpluginactivation.com/) + +How to install: + +1. Install the plugin from your WordPress Dashboard: http://wordpress.org/plugins/lessphp/ +2. That's it :) + + +Transitioning from Leafo/lessphp +--- +Projects looking for an easy transition from leafo/lessphp can use the lessc.inc.php adapter. To use, [Download the less.php source code](https://github.com/wikimedia/less.php/archive/master.zip) and unzip the files into your project so that the new 'lessc.inc.php' replaces the existing 'lessc.inc.php'. + +Note, the 'setPreserveComments' will no longer have any effect on the compiled LESS. + +Credits +--- +less.php was originally ported to PHP by [Matt Agar](https://github.com/agar) and then updated by [Martin Jantošovič](https://github.com/Mordred). This Wikimedia-maintained fork was split off from [Josh Schmidt's version](https://github.com/oyejorge/less.php). + diff --git a/vendor/wikimedia/less.php/bin/lessc b/vendor/wikimedia/less.php/bin/lessc new file mode 100755 index 0000000..fa1fb95 --- /dev/null +++ b/vendor/wikimedia/less.php/bin/lessc @@ -0,0 +1,191 @@ +#!/usr/bin/env php + false, 'relativeUrls' => false); +$silent = false; +$watch = false; +$rootpath = ''; + +// Check for arguments +array_shift($argv); +if (!count($argv)) { + $argv[] = '-h'; +} + +// parse arguments +foreach ($argv as $key => $arg) { + if (preg_match('/^--?([a-z][0-9a-z-]*)(?:=([^\s]+))?$/i', $arg, $matches)) { + $option = $matches[1]; + $value = isset($matches[2]) ? $matches[2] : false; + unset($argv[$key]); + + switch ($option) { + case 'h': + case 'help': + echo << 1) { + $output = array_pop($argv); + $inputs = $argv; +} +else { + $inputs = $argv; + $output = false; +} + +if (!count($inputs)) { + echo("lessc: no input files\n"); + exit; +} + +if ($watch) { + if (!$output) { + echo("lessc: you must specify the output file if --watch is given\n"); + exit; + } + + $lastAction = 0; + + echo("lessc: watching input files\n"); + + while (1) { + clearstatcache(); + + $updated = false; + foreach ($inputs as $input) { + if ($input == '-') { + if (count($inputs) == 1) { + echo("lessc: during watching files is not possible to watch stdin\n"); + exit; + } + else { + continue; + } + } + + if (filemtime($input) > $lastAction) { + $updated = true; + break; + } + } + + if ($updated) { + $lastAction = time(); + $parser = new Less_Parser($env); + foreach ($inputs as $input) { + try { + $parser->parseFile($input, $rootpath); + } + catch (Exception $e) { + echo("lessc: " . $e->getMessage() . " \n"); + continue; // Invalid processing + } + } + + file_put_contents($output, $parser->getCss()); + echo("lessc: output file recompiled\n"); + } + + sleep(1); + } +} +else { + $parser = new Less_Parser($env); + foreach ($inputs as $input) { + if ($input == '-') { + $content = file_get_contents('php://stdin'); + $parser->parse($content); + } + else { + try { + $parser->parseFile($input); + } + catch (Exception $e) { + if (!$silent) { + echo("lessc: " . ((string)$e) . " \n"); + } + } + } + } + + if ($output) { + file_put_contents($output, $parser->getCss()); + } + else { + echo $parser->getCss(); + } +} diff --git a/vendor/wikimedia/less.php/composer.json b/vendor/wikimedia/less.php/composer.json new file mode 100755 index 0000000..970dd27 --- /dev/null +++ b/vendor/wikimedia/less.php/composer.json @@ -0,0 +1,49 @@ +{ + "name": "wikimedia/less.php", + "description": "PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)", + "keywords": [ "less", "css", "php", "stylesheet", "less.js", "lesscss" ], + "license": "Apache-2.0", + "authors": [ + { + "name": "Josh Schmidt", + "homepage": "https://github.com/oyejorge" + }, + { + "name": "Matt Agar", + "homepage": "https://github.com/agar" + }, + { + "name": "Martin Jantošovič", + "homepage": "https://github.com/Mordred" + } + ], + "require": { + "php": ">=7.2.9" + }, + "require-dev": { + "mediawiki/mediawiki-codesniffer": "34.0.0", + "mediawiki/minus-x": "1.0.0", + "php-parallel-lint/php-console-highlighter": "0.5.0", + "php-parallel-lint/php-parallel-lint": "1.2.0", + "phpunit/phpunit": "^8.5" + }, + "scripts": { + "test": [ + "parallel-lint . --exclude vendor", + "phpcs -sp", + "phpunit", + "minus-x check ." + ], + "fix": [ + "minus-x fix .", + "phpcbf" + ] + }, + "autoload": { + "psr-0": { "Less": "lib/" }, + "classmap": ["lessc.inc.php"] + }, + "bin": [ + "bin/lessc" + ] +} diff --git a/vendor/wikimedia/less.php/lessc.inc.php b/vendor/wikimedia/less.php/lessc.inc.php new file mode 100755 index 0000000..284445f --- /dev/null +++ b/vendor/wikimedia/less.php/lessc.inc.php @@ -0,0 +1,274 @@ +importDir = (array)$dirs; + } + + public function addImportDir( $dir ) { + $this->importDir = (array)$this->importDir; + $this->importDir[] = $dir; + } + + public function setFormatter( $name ) { + $this->formatterName = $name; + } + + public function setPreserveComments( $preserve ) { + } + + public function registerFunction( $name, $func ) { + $this->libFunctions[$name] = $func; + } + + public function unregisterFunction( $name ) { + unset( $this->libFunctions[$name] ); + } + + public function setVariables( $variables ) { + foreach ( $variables as $name => $value ) { + $this->setVariable( $name, $value ); + } + } + + public function setVariable( $name, $value ) { + $this->registeredVars[$name] = $value; + } + + public function unsetVariable( $name ) { + unset( $this->registeredVars[$name] ); + } + + public function setOptions( $options ) { + foreach ( $options as $name => $value ) { + $this->setOption( $name, $value ); + } + } + + public function setOption( $name, $value ) { + $this->options[$name] = $value; + } + + public function parse( $buffer, $presets = array() ) { + $this->setVariables( $presets ); + + $parser = new Less_Parser( $this->getOptions() ); + $parser->setImportDirs( $this->getImportDirs() ); + foreach ( $this->libFunctions as $name => $func ) { + $parser->registerFunction( $name, $func ); + } + $parser->parse( $buffer ); + if ( count( $this->registeredVars ) ) { + $parser->ModifyVars( $this->registeredVars ); + } + + return $parser->getCss(); + } + + protected function getOptions() { + $options = array( 'relativeUrls' => false ); + switch ( $this->formatterName ) { + case 'compressed': + $options['compress'] = true; + break; + } + if ( is_array( $this->options ) ) { + $options = array_merge( $options, $this->options ); + } + return $options; + } + + protected function getImportDirs() { + $dirs_ = (array)$this->importDir; + $dirs = array(); + foreach ( $dirs_ as $dir ) { + $dirs[$dir] = ''; + } + return $dirs; + } + + public function compile( $string, $name = null ) { + $oldImport = $this->importDir; + $this->importDir = (array)$this->importDir; + + $this->allParsedFiles = array(); + + $parser = new Less_Parser( $this->getOptions() ); + $parser->SetImportDirs( $this->getImportDirs() ); + if ( count( $this->registeredVars ) ) { + $parser->ModifyVars( $this->registeredVars ); + } + foreach ( $this->libFunctions as $name => $func ) { + $parser->registerFunction( $name, $func ); + } + $parser->parse( $string ); + $out = $parser->getCss(); + + $parsed = Less_Parser::AllParsedFiles(); + foreach ( $parsed as $file ) { + $this->addParsedFile( $file ); + } + + $this->importDir = $oldImport; + + return $out; + } + + public function compileFile( $fname, $outFname = null ) { + if ( !is_readable( $fname ) ) { + throw new Exception( 'load error: failed to find '.$fname ); + } + + $pi = pathinfo( $fname ); + + $oldImport = $this->importDir; + + $this->importDir = (array)$this->importDir; + $this->importDir[] = Less_Parser::AbsPath( $pi['dirname'] ).'/'; + + $this->allParsedFiles = array(); + $this->addParsedFile( $fname ); + + $parser = new Less_Parser( $this->getOptions() ); + $parser->SetImportDirs( $this->getImportDirs() ); + if ( count( $this->registeredVars ) ) { + $parser->ModifyVars( $this->registeredVars ); + } + foreach ( $this->libFunctions as $name => $func ) { + $parser->registerFunction( $name, $func ); + } + $parser->parseFile( $fname ); + $out = $parser->getCss(); + + $parsed = Less_Parser::AllParsedFiles(); + foreach ( $parsed as $file ) { + $this->addParsedFile( $file ); + } + + $this->importDir = $oldImport; + + if ( $outFname !== null ) { + return file_put_contents( $outFname, $out ); + } + + return $out; + } + + public function checkedCompile( $in, $out ) { + if ( !is_file( $out ) || filemtime( $in ) > filemtime( $out ) ) { + $this->compileFile( $in, $out ); + return true; + } + return false; + } + + /** + * Execute lessphp on a .less file or a lessphp cache structure + * + * The lessphp cache structure contains information about a specific + * less file having been parsed. It can be used as a hint for future + * calls to determine whether or not a rebuild is required. + * + * The cache structure contains two important keys that may be used + * externally: + * + * compiled: The final compiled CSS + * updated: The time (in seconds) the CSS was last compiled + * + * The cache structure is a plain-ol' PHP associative array and can + * be serialized and unserialized without a hitch. + * + * @param mixed $in Input + * @param bool $force Force rebuild? + * @return array lessphp cache structure + */ + public function cachedCompile( $in, $force = false ) { + // assume no root + $root = null; + + if ( is_string( $in ) ) { + $root = $in; + } elseif ( is_array( $in ) and isset( $in['root'] ) ) { + if ( $force or !isset( $in['files'] ) ) { + // If we are forcing a recompile or if for some reason the + // structure does not contain any file information we should + // specify the root to trigger a rebuild. + $root = $in['root']; + } elseif ( isset( $in['files'] ) and is_array( $in['files'] ) ) { + foreach ( $in['files'] as $fname => $ftime ) { + if ( !file_exists( $fname ) or filemtime( $fname ) > $ftime ) { + // One of the files we knew about previously has changed + // so we should look at our incoming root again. + $root = $in['root']; + break; + } + } + } + } else { + // TODO: Throw an exception? We got neither a string nor something + // that looks like a compatible lessphp cache structure. + return null; + } + + if ( $root !== null ) { + // If we have a root value which means we should rebuild. + $out = array(); + $out['root'] = $root; + $out['compiled'] = $this->compileFile( $root ); + $out['files'] = $this->allParsedFiles(); + $out['updated'] = time(); + return $out; + } else { + // No changes, pass back the structure + // we were given initially. + return $in; + } + } + + public function ccompile( $in, $out, $less = null ) { + if ( $less === null ) { + $less = new self; + } + return $less->checkedCompile( $in, $out ); + } + + public static function cexecute( $in, $force = false, $less = null ) { + if ( $less === null ) { + $less = new self; + } + return $less->cachedCompile( $in, $force ); + } + + public function allParsedFiles() { + return $this->allParsedFiles; + } + + protected function addParsedFile( $file ) { + $this->allParsedFiles[Less_Parser::AbsPath( $file )] = filemtime( $file ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/.easymin/ignore_prefixes b/vendor/wikimedia/less.php/lib/Less/.easymin/ignore_prefixes new file mode 100755 index 0000000..ca953b2 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/.easymin/ignore_prefixes @@ -0,0 +1,2 @@ +.easymin +Autoloader.php diff --git a/vendor/wikimedia/less.php/lib/Less/Autoloader.php b/vendor/wikimedia/less.php/lib/Less/Autoloader.php new file mode 100755 index 0000000..00116f7 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Autoloader.php @@ -0,0 +1,77 @@ + '/' ); + } + + // generate name for compiled css file + $hash = md5( json_encode( $less_files ) ); + $list_file = Less_Cache::$cache_dir . Less_Cache::$prefix . $hash . '.list'; + + // check cached content + if ( !isset( $parser_options['use_cache'] ) || $parser_options['use_cache'] === true ) { + if ( file_exists( $list_file ) ) { + + self::ListFiles( $list_file, $list, $cached_name ); + $compiled_name = self::CompiledName( $list, $hash ); + + // if $cached_name is the same as the $compiled name, don't regenerate + if ( !$cached_name || $cached_name === $compiled_name ) { + + $output_file = self::OutputFile( $compiled_name, $parser_options ); + + if ( $output_file && file_exists( $output_file ) ) { + @touch( $list_file ); + return basename( $output_file ); // for backwards compatibility, we just return the name of the file + } + } + } + } + + $compiled = self::Cache( $less_files, $parser_options ); + if ( !$compiled ) { + return false; + } + + $compiled_name = self::CompiledName( $less_files, $hash ); + $output_file = self::OutputFile( $compiled_name, $parser_options ); + + // save the file list + $list = $less_files; + $list[] = $compiled_name; + $cache = implode( "\n", $list ); + file_put_contents( $list_file, $cache ); + + // save the css + file_put_contents( $output_file, $compiled ); + + // clean up + self::CleanCache(); + + return basename( $output_file ); + } + + /** + * Force the compiler to regenerate the cached css file + * + * @param array $less_files Array of .less files to compile + * @param array $parser_options Array of compiler options + * @param array $modify_vars Array of variables + * @return string Name of the css file + */ + public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ) { + $parser_options['use_cache'] = false; + return self::Get( $less_files, $parser_options, $modify_vars ); + } + + public static function Cache( &$less_files, $parser_options = array() ) { + // get less.php if it exists + $file = dirname( __FILE__ ) . '/Less.php'; + if ( file_exists( $file ) && !class_exists( 'Less_Parser' ) ) { + require_once $file; + } + + $parser_options['cache_dir'] = Less_Cache::$cache_dir; + $parser = new Less_Parser( $parser_options ); + + // combine files + foreach ( $less_files as $file_path => $uri_or_less ) { + + // treat as less markup if there are newline characters + if ( strpos( $uri_or_less, "\n" ) !== false ) { + $parser->Parse( $uri_or_less ); + continue; + } + + $parser->ParseFile( $file_path, $uri_or_less ); + } + + $compiled = $parser->getCss(); + + $less_files = $parser->allParsedFiles(); + + return $compiled; + } + + private static function OutputFile( $compiled_name, $parser_options ) { + // custom output file + if ( !empty( $parser_options['output'] ) ) { + + // relative to cache directory? + if ( preg_match( '#[\\\\/]#', $parser_options['output'] ) ) { + return $parser_options['output']; + } + + return Less_Cache::$cache_dir.$parser_options['output']; + } + + return Less_Cache::$cache_dir.$compiled_name; + } + + private static function CompiledName( $files, $extrahash ) { + // save the file list + $temp = array( Less_Version::cache_version ); + foreach ( $files as $file ) { + $temp[] = filemtime( $file )."\t".filesize( $file )."\t".$file; + } + + return Less_Cache::$prefix.sha1( json_encode( $temp ).$extrahash ).'.css'; + } + + public static function SetCacheDir( $dir ) { + Less_Cache::$cache_dir = $dir; + self::CheckCacheDir(); + } + + public static function CheckCacheDir() { + Less_Cache::$cache_dir = str_replace( '\\', '/', Less_Cache::$cache_dir ); + Less_Cache::$cache_dir = rtrim( Less_Cache::$cache_dir, '/' ).'/'; + + if ( !file_exists( Less_Cache::$cache_dir ) ) { + if ( !mkdir( Less_Cache::$cache_dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory couldn\'t be created: '.Less_Cache::$cache_dir ); + } + + } elseif ( !is_dir( Less_Cache::$cache_dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory doesn\'t exist: '.Less_Cache::$cache_dir ); + + } elseif ( !is_writable( Less_Cache::$cache_dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory isn\'t writable: '.Less_Cache::$cache_dir ); + + } + + } + + /** + * Delete unused less.php files + * + */ + public static function CleanCache() { + static $clean = false; + + if ( $clean || empty( Less_Cache::$cache_dir ) ) { + return; + } + + $clean = true; + + // only remove files with extensions created by less.php + // css files removed based on the list files + $remove_types = array( 'lesscache' => 1,'list' => 1,'less' => 1,'map' => 1 ); + + $files = scandir( Less_Cache::$cache_dir ); + if ( !$files ) { + return; + } + + $check_time = time() - self::$gc_lifetime; + foreach ( $files as $file ) { + + // don't delete if the file wasn't created with less.php + if ( strpos( $file, Less_Cache::$prefix ) !== 0 ) { + continue; + } + + $parts = explode( '.', $file ); + $type = array_pop( $parts ); + + if ( !isset( $remove_types[$type] ) ) { + continue; + } + + $full_path = Less_Cache::$cache_dir . $file; + $mtime = filemtime( $full_path ); + + // don't delete if it's a relatively new file + if ( $mtime > $check_time ) { + continue; + } + + // delete the list file and associated css file + if ( $type === 'list' ) { + self::ListFiles( $full_path, $list, $css_file_name ); + if ( $css_file_name ) { + $css_file = Less_Cache::$cache_dir . $css_file_name; + if ( file_exists( $css_file ) ) { + unlink( $css_file ); + } + } + } + + unlink( $full_path ); + } + + } + + /** + * Get the list of less files and generated css file from a list file + * + */ + static function ListFiles( $list_file, &$list, &$css_file_name ) { + $list = explode( "\n", file_get_contents( $list_file ) ); + + // pop the cached name that should match $compiled_name + $css_file_name = array_pop( $list ); + + if ( !preg_match( '/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/', $css_file_name ) ) { + $list[] = $css_file_name; + $css_file_name = false; + } + + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Colors.php b/vendor/wikimedia/less.php/lib/Less/Colors.php new file mode 100755 index 0000000..9be76cb --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Colors.php @@ -0,0 +1,169 @@ + '#f0f8ff', + 'antiquewhite' => '#faebd7', + 'aqua' => '#00ffff', + 'aquamarine' => '#7fffd4', + 'azure' => '#f0ffff', + 'beige' => '#f5f5dc', + 'bisque' => '#ffe4c4', + 'black' => '#000000', + 'blanchedalmond' => '#ffebcd', + 'blue' => '#0000ff', + 'blueviolet' => '#8a2be2', + 'brown' => '#a52a2a', + 'burlywood' => '#deb887', + 'cadetblue' => '#5f9ea0', + 'chartreuse' => '#7fff00', + 'chocolate' => '#d2691e', + 'coral' => '#ff7f50', + 'cornflowerblue' => '#6495ed', + 'cornsilk' => '#fff8dc', + 'crimson' => '#dc143c', + 'cyan' => '#00ffff', + 'darkblue' => '#00008b', + 'darkcyan' => '#008b8b', + 'darkgoldenrod' => '#b8860b', + 'darkgray' => '#a9a9a9', + 'darkgrey' => '#a9a9a9', + 'darkgreen' => '#006400', + 'darkkhaki' => '#bdb76b', + 'darkmagenta' => '#8b008b', + 'darkolivegreen' => '#556b2f', + 'darkorange' => '#ff8c00', + 'darkorchid' => '#9932cc', + 'darkred' => '#8b0000', + 'darksalmon' => '#e9967a', + 'darkseagreen' => '#8fbc8f', + 'darkslateblue' => '#483d8b', + 'darkslategray' => '#2f4f4f', + 'darkslategrey' => '#2f4f4f', + 'darkturquoise' => '#00ced1', + 'darkviolet' => '#9400d3', + 'deeppink' => '#ff1493', + 'deepskyblue' => '#00bfff', + 'dimgray' => '#696969', + 'dimgrey' => '#696969', + 'dodgerblue' => '#1e90ff', + 'firebrick' => '#b22222', + 'floralwhite' => '#fffaf0', + 'forestgreen' => '#228b22', + 'fuchsia' => '#ff00ff', + 'gainsboro' => '#dcdcdc', + 'ghostwhite' => '#f8f8ff', + 'gold' => '#ffd700', + 'goldenrod' => '#daa520', + 'gray' => '#808080', + 'grey' => '#808080', + 'green' => '#008000', + 'greenyellow' => '#adff2f', + 'honeydew' => '#f0fff0', + 'hotpink' => '#ff69b4', + 'indianred' => '#cd5c5c', + 'indigo' => '#4b0082', + 'ivory' => '#fffff0', + 'khaki' => '#f0e68c', + 'lavender' => '#e6e6fa', + 'lavenderblush' => '#fff0f5', + 'lawngreen' => '#7cfc00', + 'lemonchiffon' => '#fffacd', + 'lightblue' => '#add8e6', + 'lightcoral' => '#f08080', + 'lightcyan' => '#e0ffff', + 'lightgoldenrodyellow' => '#fafad2', + 'lightgray' => '#d3d3d3', + 'lightgrey' => '#d3d3d3', + 'lightgreen' => '#90ee90', + 'lightpink' => '#ffb6c1', + 'lightsalmon' => '#ffa07a', + 'lightseagreen' => '#20b2aa', + 'lightskyblue' => '#87cefa', + 'lightslategray' => '#778899', + 'lightslategrey' => '#778899', + 'lightsteelblue' => '#b0c4de', + 'lightyellow' => '#ffffe0', + 'lime' => '#00ff00', + 'limegreen' => '#32cd32', + 'linen' => '#faf0e6', + 'magenta' => '#ff00ff', + 'maroon' => '#800000', + 'mediumaquamarine' => '#66cdaa', + 'mediumblue' => '#0000cd', + 'mediumorchid' => '#ba55d3', + 'mediumpurple' => '#9370d8', + 'mediumseagreen' => '#3cb371', + 'mediumslateblue' => '#7b68ee', + 'mediumspringgreen' => '#00fa9a', + 'mediumturquoise' => '#48d1cc', + 'mediumvioletred' => '#c71585', + 'midnightblue' => '#191970', + 'mintcream' => '#f5fffa', + 'mistyrose' => '#ffe4e1', + 'moccasin' => '#ffe4b5', + 'navajowhite' => '#ffdead', + 'navy' => '#000080', + 'oldlace' => '#fdf5e6', + 'olive' => '#808000', + 'olivedrab' => '#6b8e23', + 'orange' => '#ffa500', + 'orangered' => '#ff4500', + 'orchid' => '#da70d6', + 'palegoldenrod' => '#eee8aa', + 'palegreen' => '#98fb98', + 'paleturquoise' => '#afeeee', + 'palevioletred' => '#d87093', + 'papayawhip' => '#ffefd5', + 'peachpuff' => '#ffdab9', + 'peru' => '#cd853f', + 'pink' => '#ffc0cb', + 'plum' => '#dda0dd', + 'powderblue' => '#b0e0e6', + 'purple' => '#800080', + 'red' => '#ff0000', + 'rosybrown' => '#bc8f8f', + 'royalblue' => '#4169e1', + 'saddlebrown' => '#8b4513', + 'salmon' => '#fa8072', + 'sandybrown' => '#f4a460', + 'seagreen' => '#2e8b57', + 'seashell' => '#fff5ee', + 'sienna' => '#a0522d', + 'silver' => '#c0c0c0', + 'skyblue' => '#87ceeb', + 'slateblue' => '#6a5acd', + 'slategray' => '#708090', + 'slategrey' => '#708090', + 'snow' => '#fffafa', + 'springgreen' => '#00ff7f', + 'steelblue' => '#4682b4', + 'tan' => '#d2b48c', + 'teal' => '#008080', + 'thistle' => '#d8bfd8', + 'tomato' => '#ff6347', + 'turquoise' => '#40e0d0', + 'violet' => '#ee82ee', + 'wheat' => '#f5deb3', + 'white' => '#ffffff', + 'whitesmoke' => '#f5f5f5', + 'yellow' => '#ffff00', + 'yellowgreen' => '#9acd32' + ); + + public static function hasOwnProperty( $color ) { + return isset( self::$colors[$color] ); + } + + public static function color( $color ) { + return self::$colors[$color]; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Configurable.php b/vendor/wikimedia/less.php/lib/Less/Configurable.php new file mode 100755 index 0000000..7f1348b --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Configurable.php @@ -0,0 +1,66 @@ +defaultOptions ); + $this->options = array_merge( $this->defaultOptions, $this->options, $options ); + } + + /** + * Get an option value by name + * + * If the option is empty or not set a NULL value will be returned. + * + * @param string $name + * @param mixed $default Default value if confiuration of $name is not present + * @return mixed + */ + public function getOption( $name, $default = null ) { + if ( isset( $this->options[$name] ) ) { + return $this->options[$name]; + } + return $default; + } + + /** + * Set an option + * + * @param string $name + * @param mixed $value + */ + public function setOption( $name, $value ) { + $this->options[$name] = $value; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Environment.php b/vendor/wikimedia/less.php/lib/Less/Environment.php new file mode 100755 index 0000000..2555d03 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Environment.php @@ -0,0 +1,157 @@ + ',', + ': ' => ':', + '' => '', + ' ' => ' ', + ':' => ' :', + '+' => '+', + '~' => '~', + '>' => '>', + '|' => '|', + '^' => '^', + '^^' => '^^' + ); + + } else { + + Less_Environment::$_outputMap = array( + ',' => ', ', + ': ' => ': ', + '' => '', + ' ' => ' ', + ':' => ' :', + '+' => ' + ', + '~' => ' ~ ', + '>' => ' > ', + '|' => '|', + '^' => ' ^ ', + '^^' => ' ^^ ' + ); + + } + } + + public function copyEvalEnv( $frames = array() ) { + $new_env = new Less_Environment(); + $new_env->frames = $frames; + return $new_env; + } + + public static function isMathOn() { + return !Less_Parser::$options['strictMath'] || Less_Environment::$parensStack; + } + + public static function isPathRelative( $path ) { + return !preg_match( '/^(?:[a-z-]+:|\/)/', $path ); + } + + /** + * Canonicalize a path by resolving references to '/./', '/../' + * Does not remove leading "../" + * @param string path or url + * @return string Canonicalized path + * + */ + public static function normalizePath( $path ) { + $segments = explode( '/', $path ); + $segments = array_reverse( $segments ); + + $path = array(); + $path_len = 0; + + while ( $segments ) { + $segment = array_pop( $segments ); + switch ( $segment ) { + + case '.': + break; + + case '..': + if ( !$path_len || ( $path[$path_len - 1] === '..' ) ) { + $path[] = $segment; + $path_len++; + } else { + array_pop( $path ); + $path_len--; + } + break; + + default: + $path[] = $segment; + $path_len++; + break; + } + } + + return implode( '/', $path ); + } + + public function unshiftFrame( $frame ) { + array_unshift( $this->frames, $frame ); + } + + public function shiftFrame() { + return array_shift( $this->frames ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php b/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php new file mode 100755 index 0000000..1f1dddb --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php @@ -0,0 +1,203 @@ +message = 'ParseError: Unexpected input'; // default message + + $this->index = $index; + + $this->currentFile = $currentFile; + + $this->input = $input; + $this->input_len = strlen( $input ); + + $this->Chunks(); + $this->genMessage(); + } + + /** + * See less.js chunks() + * We don't actually need the chunks + * + */ + protected function Chunks() { + $level = 0; + $parenLevel = 0; + $lastMultiCommentEndBrace = null; + $lastOpening = null; + $lastMultiComment = null; + $lastParen = null; + + for ( $this->parserCurrentIndex = 0; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) { + $cc = $this->CharCode( $this->parserCurrentIndex ); + if ( ( ( $cc >= 97 ) && ( $cc <= 122 ) ) || ( $cc < 34 ) ) { + // a-z or whitespace + continue; + } + + switch ( $cc ) { + + // ( + case 40: + $parenLevel++; + $lastParen = $this->parserCurrentIndex; + break; + + // ) + case 41: + $parenLevel--; + if ( $parenLevel < 0 ) { + return $this->fail( "missing opening `(`" ); + } + break; + + // ; + case 59: + // if (!$parenLevel) { $this->emitChunk(); } + break; + + // { + case 123: + $level++; + $lastOpening = $this->parserCurrentIndex; + break; + + // } + case 125: + $level--; + if ( $level < 0 ) { + return $this->fail( "missing opening `{`" ); + + } + // if (!$level && !$parenLevel) { $this->emitChunk(); } + break; + // \ + case 92: + if ( $this->parserCurrentIndex < $this->input_len - 1 ) { $this->parserCurrentIndex++; break; + } + return $this->fail( "unescaped `\\`" ); + + // ", ' and ` + case 34: + case 39: + case 96: + $matched = 0; + $currentChunkStartIndex = $this->parserCurrentIndex; + for ( $this->parserCurrentIndex = $this->parserCurrentIndex + 1; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) { + $cc2 = $this->CharCode( $this->parserCurrentIndex ); + if ( $cc2 > 96 ) { continue; + } + if ( $cc2 == $cc ) { $matched = 1; break; + } + if ( $cc2 == 92 ) { // \ + if ( $this->parserCurrentIndex == $this->input_len - 1 ) { + return $this->fail( "unescaped `\\`" ); + } + $this->parserCurrentIndex++; + } + } + if ( $matched ) { break; + } + return $this->fail( "unmatched `" . chr( $cc ) . "`", $currentChunkStartIndex ); + + // /, check for comment + case 47: + if ( $parenLevel || ( $this->parserCurrentIndex == $this->input_len - 1 ) ) { break; + } + $cc2 = $this->CharCode( $this->parserCurrentIndex + 1 ); + if ( $cc2 == 47 ) { + // //, find lnfeed + for ( $this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) { + $cc2 = $this->CharCode( $this->parserCurrentIndex ); + if ( ( $cc2 <= 13 ) && ( ( $cc2 == 10 ) || ( $cc2 == 13 ) ) ) { break; + } + } + } else if ( $cc2 == 42 ) { + // /*, find */ + $lastMultiComment = $currentChunkStartIndex = $this->parserCurrentIndex; + for ( $this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len - 1; $this->parserCurrentIndex++ ) { + $cc2 = $this->CharCode( $this->parserCurrentIndex ); + if ( $cc2 == 125 ) { $lastMultiCommentEndBrace = $this->parserCurrentIndex; + } + if ( $cc2 != 42 ) { continue; + } + if ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) { break; + } + } + if ( $this->parserCurrentIndex == $this->input_len - 1 ) { + return $this->fail( "missing closing `*/`", $currentChunkStartIndex ); + } + } + break; + + // *, check for unmatched */ + case 42: + if ( ( $this->parserCurrentIndex < $this->input_len - 1 ) && ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) ) { + return $this->fail( "unmatched `/*`" ); + } + break; + } + } + + if ( $level !== 0 ) { + if ( ( $lastMultiComment > $lastOpening ) && ( $lastMultiCommentEndBrace > $lastMultiComment ) ) { + return $this->fail( "missing closing `}` or `*/`", $lastOpening ); + } else { + return $this->fail( "missing closing `}`", $lastOpening ); + } + } else if ( $parenLevel !== 0 ) { + return $this->fail( "missing closing `)`", $lastParen ); + } + + // chunk didn't fail + + //$this->emitChunk(true); + } + + public function CharCode( $pos ) { + return ord( $this->input[$pos] ); + } + + public function fail( $msg, $index = null ) { + if ( !$index ) { + $this->index = $this->parserCurrentIndex; + } else { + $this->index = $index; + } + $this->message = 'ParseError: '.$msg; + } + + /* + function emitChunk( $force = false ){ + $len = $this->parserCurrentIndex - $this->emitFrom; + if ((($len < 512) && !$force) || !$len) { + return; + } + $chunks[] = substr($this->input, $this->emitFrom, $this->parserCurrentIndex + 1 - $this->emitFrom ); + $this->emitFrom = $this->parserCurrentIndex + 1; + } + */ + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php b/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php new file mode 100755 index 0000000..1c3727a --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php @@ -0,0 +1,11 @@ +previous = $previous; + parent::__construct( $message, $code ); + } else { + parent::__construct( $message, $code, $previous ); + } + + $this->currentFile = $currentFile; + $this->index = $index; + + $this->genMessage(); + } + + protected function getInput() { + if ( !$this->input && $this->currentFile && $this->currentFile['filename'] && file_exists( $this->currentFile['filename'] ) ) { + $this->input = file_get_contents( $this->currentFile['filename'] ); + } + } + + /** + * Converts the exception to string + * + * @return string + */ + public function genMessage() { + if ( $this->currentFile && $this->currentFile['filename'] ) { + $this->message .= ' in '.basename( $this->currentFile['filename'] ); + } + + if ( $this->index !== null ) { + $this->getInput(); + if ( $this->input ) { + $line = self::getLineNumber(); + $this->message .= ' on line '.$line.', column '.self::getColumn(); + + $lines = explode( "\n", $this->input ); + + $count = count( $lines ); + $start_line = max( 0, $line - 3 ); + $last_line = min( $count, $start_line + 6 ); + $num_len = strlen( $last_line ); + for ( $i = $start_line; $i < $last_line; $i++ ) { + $this->message .= "\n".str_pad( $i + 1, $num_len, '0', STR_PAD_LEFT ).'| '.$lines[$i]; + } + } + } + + } + + /** + * Returns the line number the error was encountered + * + * @return integer + */ + public function getLineNumber() { + if ( $this->index ) { + // https://bugs.php.net/bug.php?id=49790 + if ( ini_get( "mbstring.func_overload" ) ) { + return substr_count( substr( $this->input, 0, $this->index ), "\n" ) + 1; + } else { + return substr_count( $this->input, "\n", 0, $this->index ) + 1; + } + } + return 1; + } + + /** + * Returns the column the error was encountered + * + * @return integer + */ + public function getColumn() { + $part = substr( $this->input, 0, $this->index ); + $pos = strrpos( $part, "\n" ); + return $this->index - $pos; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Functions.php b/vendor/wikimedia/less.php/lib/Less/Functions.php new file mode 100755 index 0000000..c9e97bd --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Functions.php @@ -0,0 +1,1186 @@ +env = $env; + $this->currentFileInfo = $currentFileInfo; + } + + /** + * @param string $op + */ + public static function operate( $op, $a, $b ) { + switch ( $op ) { + case '+': +return $a + $b; + case '-': +return $a - $b; + case '*': +return $a * $b; + case '/': +return $a / $b; + } + } + + public static function clamp( $val, $max = 1 ) { + return min( max( $val, 0 ), $max ); + } + + public static function fround( $value ) { + if ( $value === 0 ) { + return $value; + } + + if ( Less_Parser::$options['numPrecision'] ) { + $p = pow( 10, Less_Parser::$options['numPrecision'] ); + return round( $value * $p ) / $p; + } + return $value; + } + + public static function number( $n ) { + if ( $n instanceof Less_Tree_Dimension ) { + return floatval( $n->unit->is( '%' ) ? $n->value / 100 : $n->value ); + } else if ( is_numeric( $n ) ) { + return $n; + } else { + throw new Less_Exception_Compiler( "color functions take numbers as parameters" ); + } + } + + public static function scaled( $n, $size = 255 ) { + if ( $n instanceof Less_Tree_Dimension && $n->unit->is( '%' ) ) { + return (float)$n->value * $size / 100; + } else { + return Less_Functions::number( $n ); + } + } + + public function rgb( $r = null, $g = null, $b = null ) { + if ( is_null( $r ) || is_null( $g ) || is_null( $b ) ) { + throw new Less_Exception_Compiler( "rgb expects three parameters" ); + } + return $this->rgba( $r, $g, $b, 1.0 ); + } + + public function rgba( $r = null, $g = null, $b = null, $a = null ) { + $rgb = array( $r, $g, $b ); + $rgb = array_map( array( 'Less_Functions','scaled' ), $rgb ); + + $a = self::number( $a ); + return new Less_Tree_Color( $rgb, $a ); + } + + public function hsl( $h, $s, $l ) { + return $this->hsla( $h, $s, $l, 1.0 ); + } + + public function hsla( $h, $s, $l, $a ) { + $h = fmod( self::number( $h ), 360 ) / 360; // Classic % operator will change float to int + $s = self::clamp( self::number( $s ) ); + $l = self::clamp( self::number( $l ) ); + $a = self::clamp( self::number( $a ) ); + + $m2 = $l <= 0.5 ? $l * ( $s + 1 ) : $l + $s - $l * $s; + + $m1 = $l * 2 - $m2; + + return $this->rgba( self::hsla_hue( $h + 1 / 3, $m1, $m2 ) * 255, + self::hsla_hue( $h, $m1, $m2 ) * 255, + self::hsla_hue( $h - 1 / 3, $m1, $m2 ) * 255, + $a ); + } + + /** + * @param double $h + */ + public function hsla_hue( $h, $m1, $m2 ) { + $h = $h < 0 ? $h + 1 : ( $h > 1 ? $h - 1 : $h ); + if ( $h * 6 < 1 ) return $m1 + ( $m2 - $m1 ) * $h * 6; else if ( $h * 2 < 1 ) return $m2; else if ( $h * 3 < 2 ) return $m1 + ( $m2 - $m1 ) * ( 2 / 3 - $h ) * 6; else return $m1; + } + + public function hsv( $h, $s, $v ) { + return $this->hsva( $h, $s, $v, 1.0 ); + } + + /** + * @param double $a + */ + public function hsva( $h, $s, $v, $a ) { + $h = ( ( Less_Functions::number( $h ) % 360 ) / 360 ) * 360; + $s = Less_Functions::number( $s ); + $v = Less_Functions::number( $v ); + $a = Less_Functions::number( $a ); + + $i = floor( ( $h / 60 ) % 6 ); + $f = ( $h / 60 ) - $i; + + $vs = array( $v, + $v * ( 1 - $s ), + $v * ( 1 - $f * $s ), + $v * ( 1 - ( 1 - $f ) * $s ) ); + + $perm = array( array( 0, 3, 1 ), + array( 2, 0, 1 ), + array( 1, 0, 3 ), + array( 1, 2, 0 ), + array( 3, 1, 0 ), + array( 0, 1, 2 ) ); + + return $this->rgba( $vs[$perm[$i][0]] * 255, + $vs[$perm[$i][1]] * 255, + $vs[$perm[$i][2]] * 255, + $a ); + } + + public function hue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $c = $color->toHSL(); + return new Less_Tree_Dimension( Less_Parser::round( $c['h'] ) ); + } + + public function saturation( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to saturation must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $c = $color->toHSL(); + return new Less_Tree_Dimension( Less_Parser::round( $c['s'] * 100 ), '%' ); + } + + public function lightness( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to lightness must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $c = $color->toHSL(); + return new Less_Tree_Dimension( Less_Parser::round( $c['l'] * 100 ), '%' ); + } + + public function hsvhue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hsvhue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsv = $color->toHSV(); + return new Less_Tree_Dimension( Less_Parser::round( $hsv['h'] ) ); + } + + public function hsvsaturation( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hsvsaturation must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsv = $color->toHSV(); + return new Less_Tree_Dimension( Less_Parser::round( $hsv['s'] * 100 ), '%' ); + } + + public function hsvvalue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hsvvalue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsv = $color->toHSV(); + return new Less_Tree_Dimension( Less_Parser::round( $hsv['v'] * 100 ), '%' ); + } + + public function red( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to red must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return new Less_Tree_Dimension( $color->rgb[0] ); + } + + public function green( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to green must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return new Less_Tree_Dimension( $color->rgb[1] ); + } + + public function blue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to blue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return new Less_Tree_Dimension( $color->rgb[2] ); + } + + public function alpha( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to alpha must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $c = $color->toHSL(); + return new Less_Tree_Dimension( $c['a'] ); + } + + public function luma( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to luma must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return new Less_Tree_Dimension( Less_Parser::round( $color->luma() * $color->alpha * 100 ), '%' ); + } + + public function luminance( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to luminance must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $luminance = + ( 0.2126 * $color->rgb[0] / 255 ) + + ( 0.7152 * $color->rgb[1] / 255 ) + + ( 0.0722 * $color->rgb[2] / 255 ); + + return new Less_Tree_Dimension( Less_Parser::round( $luminance * $color->alpha * 100 ), '%' ); + } + + public function saturate( $color = null, $amount = null ) { + // filter: saturate(3.2); + // should be kept as is, so check for color + if ( $color instanceof Less_Tree_Dimension ) { + return null; + } + + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to saturate must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to saturate must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + + $hsl['s'] += $amount->value / 100; + $hsl['s'] = self::clamp( $hsl['s'] ); + + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + /** + * @param Less_Tree_Dimension $amount + */ + public function desaturate( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to desaturate must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to desaturate must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + + $hsl['s'] -= $amount->value / 100; + $hsl['s'] = self::clamp( $hsl['s'] ); + + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + public function lighten( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to lighten must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to lighten must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + + $hsl['l'] += $amount->value / 100; + $hsl['l'] = self::clamp( $hsl['l'] ); + + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + public function darken( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to darken must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to darken must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + $hsl['l'] -= $amount->value / 100; + $hsl['l'] = self::clamp( $hsl['l'] ); + + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + public function fadein( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to fadein must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to fadein must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + $hsl['a'] += $amount->value / 100; + $hsl['a'] = self::clamp( $hsl['a'] ); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + public function fadeout( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to fadeout must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to fadeout must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + $hsl['a'] -= $amount->value / 100; + $hsl['a'] = self::clamp( $hsl['a'] ); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + public function fade( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to fade must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to fade must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + + $hsl['a'] = $amount->value / 100; + $hsl['a'] = self::clamp( $hsl['a'] ); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + public function spin( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to spin must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to spin must be a number' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $hsl = $color->toHSL(); + $hue = fmod( $hsl['h'] + $amount->value, 360 ); + + $hsl['h'] = $hue < 0 ? 360 + $hue : $hue; + + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); + } + + // + // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein + // http://sass-lang.com + // + + /** + * @param Less_Tree_Color $color1 + */ + public function mix( $color1 = null, $color2 = null, $weight = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to mix must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to mix must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$weight ) { + $weight = new Less_Tree_Dimension( '50', '%' ); + } + if ( !$weight instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The third argument to contrast must be a percentage' . ( $weight instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + $p = $weight->value / 100.0; + $w = $p * 2 - 1; + $hsl1 = $color1->toHSL(); + $hsl2 = $color2->toHSL(); + $a = $hsl1['a'] - $hsl2['a']; + + $w1 = ( ( ( ( $w * $a ) == -1 ) ? $w : ( $w + $a ) / ( 1 + $w * $a ) ) + 1 ) / 2; + $w2 = 1 - $w1; + + $rgb = array( $color1->rgb[0] * $w1 + $color2->rgb[0] * $w2, + $color1->rgb[1] * $w1 + $color2->rgb[1] * $w2, + $color1->rgb[2] * $w1 + $color2->rgb[2] * $w2 ); + + $alpha = $color1->alpha * $p + $color2->alpha * ( 1 - $p ); + + return new Less_Tree_Color( $rgb, $alpha ); + } + + public function greyscale( $color ) { + return $this->desaturate( $color, new Less_Tree_Dimension( 100, '%' ) ); + } + + public function contrast( $color, $dark = null, $light = null, $threshold = null ) { + // filter: contrast(3.2); + // should be kept as is, so check for color + if ( !$color instanceof Less_Tree_Color ) { + return null; + } + if ( !$light ) { + $light = $this->rgba( 255, 255, 255, 1.0 ); + } + if ( !$dark ) { + $dark = $this->rgba( 0, 0, 0, 1.0 ); + } + + if ( !$dark instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to contrast must be a color' . ( $dark instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$light instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The third argument to contrast must be a color' . ( $light instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + // Figure out which is actually light and dark! + if ( $dark->luma() > $light->luma() ) { + $t = $light; + $light = $dark; + $dark = $t; + } + if ( !$threshold ) { + $threshold = 0.43; + } else { + $threshold = Less_Functions::number( $threshold ); + } + + if ( $color->luma() < $threshold ) { + return $light; + } else { + return $dark; + } + } + + public function e( $str ) { + if ( is_string( $str ) ) { + return new Less_Tree_Anonymous( $str ); + } + return new Less_Tree_Anonymous( $str instanceof Less_Tree_JavaScript ? $str->expression : $str->value ); + } + + public function escape( $str ) { + $revert = array( '%21' => '!', '%2A' => '*', '%27' => "'",'%3F' => '?','%26' => '&','%2C' => ',','%2F' => '/','%40' => '@','%2B' => '+','%24' => '$' ); + + return new Less_Tree_Anonymous( strtr( rawurlencode( $str->value ), $revert ) ); + } + + /** + * todo: This function will need some additional work to make it work the same as less.js + * + */ + public function replace( $string, $pattern, $replacement, $flags = null ) { + $result = $string->value; + + $expr = '/'.str_replace( '/', '\\/', $pattern->value ).'/'; + if ( $flags && $flags->value ) { + $expr .= self::replace_flags( $flags->value ); + } + + $result = preg_replace( $expr, $replacement->value, $result ); + + if ( property_exists( $string, 'quote' ) ) { + return new Less_Tree_Quoted( $string->quote, $result, $string->escaped ); + } + return new Less_Tree_Quoted( '', $result ); + } + + public static function replace_flags( $flags ) { + $flags = str_split( $flags, 1 ); + $new_flags = ''; + + foreach ( $flags as $flag ) { + switch ( $flag ) { + case 'e': + case 'g': + break; + + default: + $new_flags .= $flag; + break; + } + } + + return $new_flags; + } + + public function _percent() { + $string = func_get_arg( 0 ); + + $args = func_get_args(); + array_shift( $args ); + $result = $string->value; + + foreach ( $args as $arg ) { + if ( preg_match( '/%[sda]/i', $result, $token ) ) { + $token = $token[0]; + $value = stristr( $token, 's' ) ? $arg->value : $arg->toCSS(); + $value = preg_match( '/[A-Z]$/', $token ) ? urlencode( $value ) : $value; + $result = preg_replace( '/%[sda]/i', $value, $result, 1 ); + } + } + $result = str_replace( '%%', '%', $result ); + + return new Less_Tree_Quoted( $string->quote, $result, $string->escaped ); + } + + public function unit( $val, $unit = null ) { + if ( !( $val instanceof Less_Tree_Dimension ) ) { + throw new Less_Exception_Compiler( 'The first argument to unit must be a number' . ( $val instanceof Less_Tree_Operation ? '. Have you forgotten parenthesis?' : '.' ) ); + } + + if ( $unit ) { + if ( $unit instanceof Less_Tree_Keyword ) { + $unit = $unit->value; + } else { + $unit = $unit->toCSS(); + } + } else { + $unit = ""; + } + return new Less_Tree_Dimension( $val->value, $unit ); + } + + public function convert( $val, $unit ) { + return $val->convertTo( $unit->value ); + } + + public function round( $n, $f = false ) { + $fraction = 0; + if ( $f !== false ) { + $fraction = $f->value; + } + + return $this->_math( 'Less_Parser::round', null, $n, $fraction ); + } + + public function pi() { + return new Less_Tree_Dimension( M_PI ); + } + + public function mod( $a, $b ) { + return new Less_Tree_Dimension( $a->value % $b->value, $a->unit ); + } + + public function pow( $x, $y ) { + if ( is_numeric( $x ) && is_numeric( $y ) ) { + $x = new Less_Tree_Dimension( $x ); + $y = new Less_Tree_Dimension( $y ); + } elseif ( !( $x instanceof Less_Tree_Dimension ) || !( $y instanceof Less_Tree_Dimension ) ) { + throw new Less_Exception_Compiler( 'Arguments must be numbers' ); + } + + return new Less_Tree_Dimension( pow( $x->value, $y->value ), $x->unit ); + } + + // var mathFunctions = [{name:"ce ... + public function ceil( $n ) { + return $this->_math( 'ceil', null, $n ); + } + + public function floor( $n ) { + return $this->_math( 'floor', null, $n ); + } + + public function sqrt( $n ) { + return $this->_math( 'sqrt', null, $n ); + } + + public function abs( $n ) { + return $this->_math( 'abs', null, $n ); + } + + public function tan( $n ) { + return $this->_math( 'tan', '', $n ); + } + + public function sin( $n ) { + return $this->_math( 'sin', '', $n ); + } + + public function cos( $n ) { + return $this->_math( 'cos', '', $n ); + } + + public function atan( $n ) { + return $this->_math( 'atan', 'rad', $n ); + } + + public function asin( $n ) { + return $this->_math( 'asin', 'rad', $n ); + } + + public function acos( $n ) { + return $this->_math( 'acos', 'rad', $n ); + } + + private function _math() { + $args = func_get_args(); + $fn = array_shift( $args ); + $unit = array_shift( $args ); + + if ( $args[0] instanceof Less_Tree_Dimension ) { + + if ( $unit === null ) { + $unit = $args[0]->unit; + } else { + $args[0] = $args[0]->unify(); + } + $args[0] = (float)$args[0]->value; + return new Less_Tree_Dimension( call_user_func_array( $fn, $args ), $unit ); + } else if ( is_numeric( $args[0] ) ) { + return call_user_func_array( $fn, $args ); + } else { + throw new Less_Exception_Compiler( "math functions take numbers as parameters" ); + } + } + + /** + * @param boolean $isMin + */ + private function _minmax( $isMin, $args ) { + $arg_count = count( $args ); + + if ( $arg_count < 1 ) { + throw new Less_Exception_Compiler( 'one or more arguments required' ); + } + + $j = null; + $unitClone = null; + $unitStatic = null; + + $order = array(); // elems only contains original argument values. + $values = array(); // key is the unit.toString() for unified tree.Dimension values, + // value is the index into the order array. + + for ( $i = 0; $i < $arg_count; $i++ ) { + $current = $args[$i]; + if ( !( $current instanceof Less_Tree_Dimension ) ) { + if ( is_array( $args[$i]->value ) ) { + $args[] = $args[$i]->value; + } + continue; + } + + if ( $current->unit->toString() === '' && !$unitClone ) { + $temp = new Less_Tree_Dimension( $current->value, $unitClone ); + $currentUnified = $temp->unify(); + } else { + $currentUnified = $current->unify(); + } + + if ( $currentUnified->unit->toString() === "" && !$unitStatic ) { + $unit = $unitStatic; + } else { + $unit = $currentUnified->unit->toString(); + } + + if ( $unit !== '' && !$unitStatic || $unit !== '' && $order[0]->unify()->unit->toString() === "" ) { + $unitStatic = $unit; + } + + if ( $unit != '' && !$unitClone ) { + $unitClone = $current->unit->toString(); + } + + if ( isset( $values[''] ) && $unit !== '' && $unit === $unitStatic ) { + $j = $values['']; + } elseif ( isset( $values[$unit] ) ) { + $j = $values[$unit]; + } else { + + if ( $unitStatic && $unit !== $unitStatic ) { + throw new Less_Exception_Compiler( 'incompatible types' ); + } + $values[$unit] = count( $order ); + $order[] = $current; + continue; + } + + if ( $order[$j]->unit->toString() === "" && $unitClone ) { + $temp = new Less_Tree_Dimension( $order[$j]->value, $unitClone ); + $referenceUnified = $temp->unify(); + } else { + $referenceUnified = $order[$j]->unify(); + } + if ( ( $isMin && $currentUnified->value < $referenceUnified->value ) || ( !$isMin && $currentUnified->value > $referenceUnified->value ) ) { + $order[$j] = $current; + } + } + + if ( count( $order ) == 1 ) { + return $order[0]; + } + $args = array(); + foreach ( $order as $a ) { + $args[] = $a->toCSS( $this->env ); + } + return new Less_Tree_Anonymous( ( $isMin ? 'min(' : 'max(' ) . implode( Less_Environment::$_outputMap[','], $args ).')' ); + } + + public function min() { + $args = func_get_args(); + return $this->_minmax( true, $args ); + } + + public function max() { + $args = func_get_args(); + return $this->_minmax( false, $args ); + } + + public function getunit( $n ) { + return new Less_Tree_Anonymous( $n->unit ); + } + + public function argb( $color ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to argb must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return new Less_Tree_Anonymous( $color->toARGB() ); + } + + public function percentage( $n ) { + return new Less_Tree_Dimension( $n->value * 100, '%' ); + } + + public function color( $n ) { + if ( $n instanceof Less_Tree_Quoted ) { + $colorCandidate = $n->value; + $returnColor = Less_Tree_Color::fromKeyword( $colorCandidate ); + if ( $returnColor ) { + return $returnColor; + } + if ( preg_match( '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/', $colorCandidate ) ) { + return new Less_Tree_Color( substr( $colorCandidate, 1 ) ); + } + throw new Less_Exception_Compiler( "argument must be a color keyword or 3/6 digit hex e.g. #FFF" ); + } else { + throw new Less_Exception_Compiler( "argument must be a string" ); + } + } + + public function iscolor( $n ) { + return $this->_isa( $n, 'Less_Tree_Color' ); + } + + public function isnumber( $n ) { + return $this->_isa( $n, 'Less_Tree_Dimension' ); + } + + public function isstring( $n ) { + return $this->_isa( $n, 'Less_Tree_Quoted' ); + } + + public function iskeyword( $n ) { + return $this->_isa( $n, 'Less_Tree_Keyword' ); + } + + public function isurl( $n ) { + return $this->_isa( $n, 'Less_Tree_Url' ); + } + + public function ispixel( $n ) { + return $this->isunit( $n, 'px' ); + } + + public function ispercentage( $n ) { + return $this->isunit( $n, '%' ); + } + + public function isem( $n ) { + return $this->isunit( $n, 'em' ); + } + + /** + * @param string $unit + */ + public function isunit( $n, $unit ) { + if ( is_object( $unit ) && property_exists( $unit, 'value' ) ) { + $unit = $unit->value; + } + + return ( $n instanceof Less_Tree_Dimension ) && $n->unit->is( $unit ) ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' ); + } + + /** + * @param string $type + */ + private function _isa( $n, $type ) { + return is_a( $n, $type ) ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' ); + } + + public function tint( $color, $amount = null ) { + return $this->mix( $this->rgb( 255, 255, 255 ), $color, $amount ); + } + + public function shade( $color, $amount = null ) { + return $this->mix( $this->rgb( 0, 0, 0 ), $color, $amount ); + } + + public function extract( $values, $index ) { + $index = (int)$index->value - 1; // (1-based index) + // handle non-array values as an array of length 1 + // return 'undefined' if index is invalid + if ( property_exists( $values, 'value' ) && is_array( $values->value ) ) { + if ( isset( $values->value[$index] ) ) { + return $values->value[$index]; + } + return null; + + } elseif ( (int)$index === 0 ) { + return $values; + } + + return null; + } + + public function length( $values ) { + $n = ( property_exists( $values, 'value' ) && is_array( $values->value ) ) ? count( $values->value ) : 1; + return new Less_Tree_Dimension( $n ); + } + + public function datauri( $mimetypeNode, $filePathNode = null ) { + $filePath = ( $filePathNode ? $filePathNode->value : null ); + $mimetype = $mimetypeNode->value; + + $args = 2; + if ( !$filePath ) { + $filePath = $mimetype; + $args = 1; + } + + $filePath = str_replace( '\\', '/', $filePath ); + if ( Less_Environment::isPathRelative( $filePath ) ) { + + if ( Less_Parser::$options['relativeUrls'] ) { + $temp = $this->currentFileInfo['currentDirectory']; + } else { + $temp = $this->currentFileInfo['entryPath']; + } + + if ( !empty( $temp ) ) { + $filePath = Less_Environment::normalizePath( rtrim( $temp, '/' ).'/'.$filePath ); + } + + } + + // detect the mimetype if not given + if ( $args < 2 ) { + + /* incomplete + $mime = require('mime'); + mimetype = mime.lookup(path); + + // use base 64 unless it's an ASCII or UTF-8 format + var charset = mime.charsets.lookup(mimetype); + useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; + if (useBase64) mimetype += ';base64'; + */ + + $mimetype = Less_Mime::lookup( $filePath ); + + $charset = Less_Mime::charsets_lookup( $mimetype ); + $useBase64 = !in_array( $charset, array( 'US-ASCII', 'UTF-8' ) ); + if ( $useBase64 ) { $mimetype .= ';base64'; + } + + } else { + $useBase64 = preg_match( '/;base64$/', $mimetype ); + } + + if ( file_exists( $filePath ) ) { + $buf = @file_get_contents( $filePath ); + } else { + $buf = false; + } + + // IE8 cannot handle a data-uri larger than 32KB. If this is exceeded + // and the --ieCompat flag is enabled, return a normal url() instead. + $DATA_URI_MAX_KB = 32; + $fileSizeInKB = round( strlen( $buf ) / 1024 ); + if ( $fileSizeInKB >= $DATA_URI_MAX_KB ) { + $url = new Less_Tree_Url( ( $filePathNode ? $filePathNode : $mimetypeNode ), $this->currentFileInfo ); + return $url->compile( $this ); + } + + if ( $buf ) { + $buf = $useBase64 ? base64_encode( $buf ) : rawurlencode( $buf ); + $filePath = '"data:' . $mimetype . ',' . $buf . '"'; + } + + return new Less_Tree_Url( new Less_Tree_Anonymous( $filePath ) ); + } + + // svg-gradient + public function svggradient( $direction ) { + $throw_message = 'svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]'; + $arguments = func_get_args(); + + if ( count( $arguments ) < 3 ) { + throw new Less_Exception_Compiler( $throw_message ); + } + + $stops = array_slice( $arguments, 1 ); + $gradientType = 'linear'; + $rectangleDimension = 'x="0" y="0" width="1" height="1"'; + $useBase64 = true; + $directionValue = $direction->toCSS(); + + switch ( $directionValue ) { + case "to bottom": + $gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; + break; + case "to right": + $gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="0%"'; + break; + case "to bottom right": + $gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="100%"'; + break; + case "to top right": + $gradientDirectionSvg = 'x1="0%" y1="100%" x2="100%" y2="0%"'; + break; + case "ellipse": + case "ellipse at center": + $gradientType = "radial"; + $gradientDirectionSvg = 'cx="50%" cy="50%" r="75%"'; + $rectangleDimension = 'x="-50" y="-50" width="101" height="101"'; + break; + default: + throw new Less_Exception_Compiler( "svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'" ); + } + + $returner = '' . + '' . + '<' . $gradientType . 'Gradient id="gradient" gradientUnits="userSpaceOnUse" ' . $gradientDirectionSvg . '>'; + + for ( $i = 0; $i < count( $stops ); $i++ ) { + if ( is_object( $stops[$i] ) && property_exists( $stops[$i], 'value' ) ) { + $color = $stops[$i]->value[0]; + $position = $stops[$i]->value[1]; + } else { + $color = $stops[$i]; + $position = null; + } + + if ( !( $color instanceof Less_Tree_Color ) || ( !( ( $i === 0 || $i + 1 === count( $stops ) ) && $position === null ) && !( $position instanceof Less_Tree_Dimension ) ) ) { + throw new Less_Exception_Compiler( $throw_message ); + } + if ( $position ) { + $positionValue = $position->toCSS(); + } elseif ( $i === 0 ) { + $positionValue = '0%'; + } else { + $positionValue = '100%'; + } + $alpha = $color->alpha; + $returner .= ''; + } + + $returner .= ''; + + if ( $useBase64 ) { + $returner = "'data:image/svg+xml;base64,".base64_encode( $returner )."'"; + } else { + $returner = "'data:image/svg+xml,".$returner."'"; + } + + return new Less_Tree_URL( new Less_Tree_Anonymous( $returner ) ); + } + + /** + * Php version of javascript's `encodeURIComponent` function + * + * @param string $string The string to encode + * @return string The encoded string + */ + public static function encodeURIComponent( $string ) { + $revert = array( '%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')' ); + return strtr( rawurlencode( $string ), $revert ); + } + + // Color Blending + // ref: http://www.w3.org/TR/compositing-1 + + public function colorBlend( $mode, $color1, $color2 ) { + $ab = $color1->alpha; // backdrop + $as = $color2->alpha; // source + $r = array(); // result + + $ar = $as + $ab * ( 1 - $as ); + for ( $i = 0; $i < 3; $i++ ) { + $cb = $color1->rgb[$i] / 255; + $cs = $color2->rgb[$i] / 255; + $cr = call_user_func( $mode, $cb, $cs ); + if ( $ar ) { + $cr = ( $as * $cs + $ab * ( $cb - $as * ( $cb + $cs - $cr ) ) ) / $ar; + } + $r[$i] = $cr * 255; + } + + return new Less_Tree_Color( $r, $ar ); + } + + public function multiply( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to multiply must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to multiply must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendMultiply' ), $color1, $color2 ); + } + + private function colorBlendMultiply( $cb, $cs ) { + return $cb * $cs; + } + + public function screen( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to screen must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to screen must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendScreen' ), $color1, $color2 ); + } + + private function colorBlendScreen( $cb, $cs ) { + return $cb + $cs - $cb * $cs; + } + + public function overlay( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to overlay must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to overlay must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendOverlay' ), $color1, $color2 ); + } + + private function colorBlendOverlay( $cb, $cs ) { + $cb *= 2; + return ( $cb <= 1 ) + ? $this->colorBlendMultiply( $cb, $cs ) + : $this->colorBlendScreen( $cb - 1, $cs ); + } + + public function softlight( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to softlight must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to softlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendSoftlight' ), $color1, $color2 ); + } + + private function colorBlendSoftlight( $cb, $cs ) { + $d = 1; + $e = $cb; + if ( $cs > 0.5 ) { + $e = 1; + $d = ( $cb > 0.25 ) ? sqrt( $cb ) + : ( ( 16 * $cb - 12 ) * $cb + 4 ) * $cb; + } + return $cb - ( 1 - 2 * $cs ) * $e * ( $d - $cb ); + } + + public function hardlight( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hardlight must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to hardlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendHardlight' ), $color1, $color2 ); + } + + private function colorBlendHardlight( $cb, $cs ) { + return $this->colorBlendOverlay( $cs, $cb ); + } + + public function difference( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to difference must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to difference must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendDifference' ), $color1, $color2 ); + } + + private function colorBlendDifference( $cb, $cs ) { + return abs( $cb - $cs ); + } + + public function exclusion( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to exclusion must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to exclusion must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendExclusion' ), $color1, $color2 ); + } + + private function colorBlendExclusion( $cb, $cs ) { + return $cb + $cs - 2 * $cb * $cs; + } + + public function average( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to average must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to average must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendAverage' ), $color1, $color2 ); + } + + // non-w3c functions: + public function colorBlendAverage( $cb, $cs ) { + return ( $cb + $cs ) / 2; + } + + public function negation( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to negation must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to negation must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); + } + + return $this->colorBlend( array( $this,'colorBlendNegation' ), $color1, $color2 ); + } + + public function colorBlendNegation( $cb, $cs ) { + return 1 - abs( $cb + $cs - 1 ); + } + + // ~ End of Color Blending + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Less.php.combine b/vendor/wikimedia/less.php/lib/Less/Less.php.combine new file mode 100755 index 0000000..d63cc78 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Less.php.combine @@ -0,0 +1,17 @@ + +./Parser.php +./Colors.php +./Environment.php +./Functions.php +./Mime.php +./Tree.php +./Output.php +./Visitor.php +./VisitorReplacing.php +./Configurable.php +./Tree +./Visitor +./Exception/Parser.php +./Exception/ +./Output +./SourceMap diff --git a/vendor/wikimedia/less.php/lib/Less/Mime.php b/vendor/wikimedia/less.php/lib/Less/Mime.php new file mode 100755 index 0000000..b4723f9 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Mime.php @@ -0,0 +1,41 @@ + 'text/html', + '.html' => 'text/html', + '.gif' => 'image/gif', + '.jpg' => 'image/jpeg', + '.jpeg' => 'image/jpeg', + '.png' => 'image/png', + '.ttf' => 'application/x-font-ttf', + '.otf' => 'application/x-font-otf', + '.eot' => 'application/vnd.ms-fontobject', + '.woff' => 'application/x-font-woff', + '.svg' => 'image/svg+xml', + ); + + public static function lookup( $filepath ) { + $parts = explode( '.', $filepath ); + $ext = '.'.strtolower( array_pop( $parts ) ); + + if ( !isset( self::$_types[$ext] ) ) { + return null; + } + return self::$_types[$ext]; + } + + public static function charsets_lookup( $type = null ) { + // assumes all text types are UTF-8 + return $type && preg_match( '/^text\//', $type ) ? 'UTF-8' : ''; + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Output.php b/vendor/wikimedia/less.php/lib/Less/Output.php new file mode 100755 index 0000000..8f7dd61 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Output.php @@ -0,0 +1,48 @@ +strs[] = $chunk; + } + + /** + * Is the output empty? + * + * @return boolean + */ + public function isEmpty() { + return count( $this->strs ) === 0; + } + + /** + * Converts the output to string + * + * @return string + */ + public function toString() { + return implode( '', $this->strs ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php b/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php new file mode 100755 index 0000000..e486c98 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php @@ -0,0 +1,119 @@ +contentsMap = $contentsMap; + $this->generator = $generator; + } + + /** + * Adds a chunk to the stack + * The $index for less.php may be different from less.js since less.php does not chunkify inputs + * + * @param string $chunk + * @param string $fileInfo + * @param integer $index + * @param mixed $mapLines + */ + public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) { + // ignore adding empty strings + if ( $chunk === '' ) { + return; + } + + $sourceLines = array(); + $sourceColumns = ' '; + + if ( $fileInfo ) { + + $url = $fileInfo['currentUri']; + + if ( isset( $this->contentsMap[$url] ) ) { + $inputSource = substr( $this->contentsMap[$url], 0, $index ); + $sourceLines = explode( "\n", $inputSource ); + $sourceColumns = end( $sourceLines ); + } else { + throw new Exception( 'Filename '.$url.' not in contentsMap' ); + } + + } + + $lines = explode( "\n", $chunk ); + $columns = end( $lines ); + + if ( $fileInfo ) { + + if ( !$mapLines ) { + $this->generator->addMapping( + $this->lineNumber + 1, // generated_line + $this->column, // generated_column + count( $sourceLines ), // original_line + strlen( $sourceColumns ), // original_column + $fileInfo + ); + } else { + for ( $i = 0, $count = count( $lines ); $i < $count; $i++ ) { + $this->generator->addMapping( + $this->lineNumber + $i + 1, // generated_line + $i === 0 ? $this->column : 0, // generated_column + count( $sourceLines ) + $i, // original_line + $i === 0 ? strlen( $sourceColumns ) : 0, // original_column + $fileInfo + ); + } + } + } + + if ( count( $lines ) === 1 ) { + $this->column += strlen( $columns ); + } else { + $this->lineNumber += count( $lines ) - 1; + $this->column = strlen( $columns ); + } + + // add only chunk + parent::add( $chunk ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Parser.php b/vendor/wikimedia/less.php/lib/Less/Parser.php new file mode 100755 index 0000000..36e0b3e --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Parser.php @@ -0,0 +1,2691 @@ + false, // option - whether to compress + 'strictUnits' => false, // whether units need to evaluate correctly + 'strictMath' => false, // whether math has to be within parenthesis + 'relativeUrls' => true, // option - whether to adjust URL's to be relative + 'urlArgs' => '', // whether to add args into url tokens + 'numPrecision' => 8, + + 'import_dirs' => array(), + 'import_callback' => null, + 'cache_dir' => null, + 'cache_method' => 'php', // false, 'serialize', 'php', 'var_export', 'callback'; + 'cache_callback_get' => null, + 'cache_callback_set' => null, + + 'sourceMap' => false, // whether to output a source map + 'sourceMapBasepath' => null, + 'sourceMapWriteTo' => null, + 'sourceMapURL' => null, + + 'indentation' => ' ', + + 'plugins' => array(), + + ); + + public static $options = array(); + + private $input; // Less input string + private $input_len; // input string length + private $pos; // current index in `input` + private $saveStack = array(); // holds state for backtracking + private $furthest; + private $mb_internal_encoding = ''; // for remember exists value of mbstring.internal_encoding + + /** + * @var Less_Environment + */ + private $env; + + protected $rules = array(); + + private static $imports = array(); + + public static $has_extends = false; + + public static $next_id = 0; + + /** + * Filename to contents of all parsed the files + * + * @var array + */ + public static $contentsMap = array(); + + /** + * @param Less_Environment|array|null $env + */ + public function __construct( $env = null ) { + // Top parser on an import tree must be sure there is one "env" + // which will then be passed around by reference. + if ( $env instanceof Less_Environment ) { + $this->env = $env; + } else { + $this->SetOptions( Less_Parser::$default_options ); + $this->Reset( $env ); + } + + // mbstring.func_overload > 1 bugfix + // The encoding value must be set for each source file, + // therefore, to conserve resources and improve the speed of this design is taken here + if ( ini_get( 'mbstring.func_overload' ) ) { + $this->mb_internal_encoding = ini_get( 'mbstring.internal_encoding' ); + @ini_set( 'mbstring.internal_encoding', 'ascii' ); + } + + } + + /** + * Reset the parser state completely + * + */ + public function Reset( $options = null ) { + $this->rules = array(); + self::$imports = array(); + self::$has_extends = false; + self::$imports = array(); + self::$contentsMap = array(); + + $this->env = new Less_Environment( $options ); + + // set new options + if ( is_array( $options ) ) { + $this->SetOptions( Less_Parser::$default_options ); + $this->SetOptions( $options ); + } + + $this->env->Init(); + } + + /** + * Set one or more compiler options + * options: import_dirs, cache_dir, cache_method + * + */ + public function SetOptions( $options ) { + foreach ( $options as $option => $value ) { + $this->SetOption( $option, $value ); + } + } + + /** + * Set one compiler option + * + */ + public function SetOption( $option, $value ) { + switch ( $option ) { + + case 'import_dirs': + $this->SetImportDirs( $value ); + return; + + case 'cache_dir': + if ( is_string( $value ) ) { + Less_Cache::SetCacheDir( $value ); + Less_Cache::CheckCacheDir(); + } + return; + } + + Less_Parser::$options[$option] = $value; + } + + /** + * Registers a new custom function + * + * @param string $name function name + * @param callable $callback callback + */ + public function registerFunction( $name, $callback ) { + $this->env->functions[$name] = $callback; + } + + /** + * Removed an already registered function + * + * @param string $name function name + */ + public function unregisterFunction( $name ) { + if ( isset( $this->env->functions[$name] ) ) + unset( $this->env->functions[$name] ); + } + + /** + * Get the current css buffer + * + * @return string + */ + public function getCss() { + $precision = ini_get( 'precision' ); + @ini_set( 'precision', 16 ); + $locale = setlocale( LC_NUMERIC, 0 ); + setlocale( LC_NUMERIC, "C" ); + + try { + + $root = new Less_Tree_Ruleset( array(), $this->rules ); + $root->root = true; + $root->firstRoot = true; + + $this->PreVisitors( $root ); + + self::$has_extends = false; + $evaldRoot = $root->compile( $this->env ); + + $this->PostVisitors( $evaldRoot ); + + if ( Less_Parser::$options['sourceMap'] ) { + $generator = new Less_SourceMap_Generator( $evaldRoot, Less_Parser::$contentsMap, Less_Parser::$options ); + // will also save file + // FIXME: should happen somewhere else? + $css = $generator->generateCSS(); + } else { + $css = $evaldRoot->toCSS(); + } + + if ( Less_Parser::$options['compress'] ) { + $css = preg_replace( '/(^(\s)+)|((\s)+$)/', '', $css ); + } + + } catch ( Exception $exc ) { + // Intentional fall-through so we can reset environment + } + + // reset php settings + @ini_set( 'precision', $precision ); + setlocale( LC_NUMERIC, $locale ); + + // If you previously defined $this->mb_internal_encoding + // is required to return the encoding as it was before + if ( $this->mb_internal_encoding != '' ) { + @ini_set( "mbstring.internal_encoding", $this->mb_internal_encoding ); + $this->mb_internal_encoding = ''; + } + + // Rethrow exception after we handled resetting the environment + if ( !empty( $exc ) ) { + throw $exc; + } + + return $css; + } + + public function findValueOf( $varName ) { + foreach ( $this->rules as $rule ) { + if ( isset( $rule->variable ) && ( $rule->variable == true ) && ( str_replace( "@", "", $rule->name ) == $varName ) ) { + return $this->getVariableValue( $rule ); + } + } + return null; + } + + /** + * + * this function gets the private rules variable and returns an array of the found variables + * it uses a helper method getVariableValue() that contains the logic ot fetch the value from the rule object + * + * @return array + */ + public function getVariables() { + $variables = array(); + + $not_variable_type = array( + 'Comment', // this include less comments ( // ) and css comments (/* */) + 'Import', // do not search variables in included files @import + 'Ruleset', // selectors (.someclass, #someid, …) + 'Operation', // + ); + + // @TODO run compilation if not runned yet + foreach ( $this->rules as $key => $rule ) { + if ( in_array( $rule->type, $not_variable_type ) ) { + continue; + } + + // Note: it seems rule->type is always Rule when variable = true + if ( $rule->type == 'Rule' && $rule->variable ) { + $variables[$rule->name] = $this->getVariableValue( $rule ); + } else { + if ( $rule->type == 'Comment' ) { + $variables[] = $this->getVariableValue( $rule ); + } + } + } + return $variables; + } + + public function findVarByName( $var_name ) { + foreach ( $this->rules as $rule ) { + if ( isset( $rule->variable ) && ( $rule->variable == true ) ) { + if ( $rule->name == $var_name ) { + return $this->getVariableValue( $rule ); + } + } + } + return null; + } + + /** + * + * This method gets the value of the less variable from the rules object. + * Since the objects vary here we add the logic for extracting the css/less value. + * + * @param $var + * + * @return bool|string + */ + private function getVariableValue( $var ) { + if ( !is_a( $var, 'Less_Tree' ) ) { + throw new Exception( 'var is not a Less_Tree object' ); + } + + switch ( $var->type ) { + case 'Color': + return $this->rgb2html( $var->rgb ); + case 'Unit': + return $var->value. $var->unit->numerator[0]; + case 'Variable': + return $this->findVarByName( $var->name ); + case 'Keyword': + return $var->value; + case 'Rule': + return $this->getVariableValue( $var->value ); + case 'Value': + $value = ''; + foreach ( $var->value as $sub_value ) { + $value .= $this->getVariableValue( $sub_value ).' '; + } + return $value; + case 'Quoted': + return $var->quote.$var->value.$var->quote; + case 'Dimension': + $value = $var->value; + if ( $var->unit && $var->unit->numerator ) { + $value .= $var->unit->numerator[0]; + } + return $value; + case 'Expression': + $value = ""; + foreach ( $var->value as $item ) { + $value .= $this->getVariableValue( $item )." "; + } + return $value; + case 'Operation': + throw new Exception( 'getVariables() require Less to be compiled. please use $parser->getCss() before calling getVariables()' ); + case 'Comment': + case 'Import': + case 'Ruleset': + default: + throw new Exception( "type missing in switch/case getVariableValue for ".$var->type ); + } + return false; + } + + private function rgb2html( $r, $g = -1, $b = -1 ) { + if ( is_array( $r ) && sizeof( $r ) == 3 ) + list( $r, $g, $b ) = $r; + + $r = intval( $r ); $g = intval( $g ); + $b = intval( $b ); + + $r = dechex( $r < 0 ? 0 : ( $r > 255 ? 255 : $r ) ); + $g = dechex( $g < 0 ? 0 : ( $g > 255 ? 255 : $g ) ); + $b = dechex( $b < 0 ? 0 : ( $b > 255 ? 255 : $b ) ); + + $color = ( strlen( $r ) < 2 ? '0' : '' ).$r; + $color .= ( strlen( $g ) < 2 ? '0' : '' ).$g; + $color .= ( strlen( $b ) < 2 ? '0' : '' ).$b; + return '#'.$color; + } + + /** + * Run pre-compile visitors + * + */ + private function PreVisitors( $root ) { + if ( Less_Parser::$options['plugins'] ) { + foreach ( Less_Parser::$options['plugins'] as $plugin ) { + if ( !empty( $plugin->isPreEvalVisitor ) ) { + $plugin->run( $root ); + } + } + } + } + + /** + * Run post-compile visitors + * + */ + private function PostVisitors( $evaldRoot ) { + $visitors = array(); + $visitors[] = new Less_Visitor_joinSelector(); + if ( self::$has_extends ) { + $visitors[] = new Less_Visitor_processExtends(); + } + $visitors[] = new Less_Visitor_toCSS(); + + if ( Less_Parser::$options['plugins'] ) { + foreach ( Less_Parser::$options['plugins'] as $plugin ) { + if ( property_exists( $plugin, 'isPreEvalVisitor' ) && $plugin->isPreEvalVisitor ) { + continue; + } + + if ( property_exists( $plugin, 'isPreVisitor' ) && $plugin->isPreVisitor ) { + array_unshift( $visitors, $plugin ); + } else { + $visitors[] = $plugin; + } + } + } + + for ( $i = 0; $i < count( $visitors ); $i++ ) { + $visitors[$i]->run( $evaldRoot ); + } + + } + + /** + * Parse a Less string into css + * + * @param string $str The string to convert + * @param string $uri_root The url of the file + * @return Less_Tree_Ruleset|Less_Parser + */ + public function parse( $str, $file_uri = null ) { + if ( !$file_uri ) { + $uri_root = ''; + $filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less'; + } else { + $file_uri = self::WinPath( $file_uri ); + $filename = $file_uri; + $uri_root = dirname( $file_uri ); + } + + $previousFileInfo = $this->env->currentFileInfo; + $uri_root = self::WinPath( $uri_root ); + $this->SetFileInfo( $filename, $uri_root ); + + $this->input = $str; + $this->_parse(); + + if ( $previousFileInfo ) { + $this->env->currentFileInfo = $previousFileInfo; + } + + return $this; + } + + /** + * Parse a Less string from a given file + * + * @throws Less_Exception_Parser + * @param string $filename The file to parse + * @param string $uri_root The url of the file + * @param bool $returnRoot Indicates whether the return value should be a css string a root node + * @return Less_Tree_Ruleset|Less_Parser + */ + public function parseFile( $filename, $uri_root = '', $returnRoot = false ) { + if ( !file_exists( $filename ) ) { + $this->Error( sprintf( 'File `%s` not found.', $filename ) ); + } + + // fix uri_root? + // Instead of The mixture of file path for the first argument and directory path for the second argument has bee + if ( !$returnRoot && !empty( $uri_root ) && basename( $uri_root ) == basename( $filename ) ) { + $uri_root = dirname( $uri_root ); + } + + $previousFileInfo = $this->env->currentFileInfo; + + if ( $filename ) { + $filename = self::AbsPath( $filename, true ); + } + $uri_root = self::WinPath( $uri_root ); + + $this->SetFileInfo( $filename, $uri_root ); + + self::AddParsedFile( $filename ); + + if ( $returnRoot ) { + $rules = $this->GetRules( $filename ); + $return = new Less_Tree_Ruleset( array(), $rules ); + } else { + $this->_parse( $filename ); + $return = $this; + } + + if ( $previousFileInfo ) { + $this->env->currentFileInfo = $previousFileInfo; + } + + return $return; + } + + /** + * Allows a user to set variables values + * @param array $vars + * @return Less_Parser + */ + public function ModifyVars( $vars ) { + $this->input = Less_Parser::serializeVars( $vars ); + $this->_parse(); + + return $this; + } + + /** + * @param string $filename + */ + public function SetFileInfo( $filename, $uri_root = '' ) { + $filename = Less_Environment::normalizePath( $filename ); + $dirname = preg_replace( '/[^\/\\\\]*$/', '', $filename ); + + if ( !empty( $uri_root ) ) { + $uri_root = rtrim( $uri_root, '/' ).'/'; + } + + $currentFileInfo = array(); + + // entry info + if ( isset( $this->env->currentFileInfo ) ) { + $currentFileInfo['entryPath'] = $this->env->currentFileInfo['entryPath']; + $currentFileInfo['entryUri'] = $this->env->currentFileInfo['entryUri']; + $currentFileInfo['rootpath'] = $this->env->currentFileInfo['rootpath']; + + } else { + $currentFileInfo['entryPath'] = $dirname; + $currentFileInfo['entryUri'] = $uri_root; + $currentFileInfo['rootpath'] = $dirname; + } + + $currentFileInfo['currentDirectory'] = $dirname; + $currentFileInfo['currentUri'] = $uri_root.basename( $filename ); + $currentFileInfo['filename'] = $filename; + $currentFileInfo['uri_root'] = $uri_root; + + // inherit reference + if ( isset( $this->env->currentFileInfo['reference'] ) && $this->env->currentFileInfo['reference'] ) { + $currentFileInfo['reference'] = true; + } + + $this->env->currentFileInfo = $currentFileInfo; + } + + /** + * @deprecated 1.5.1.2 + * + */ + public function SetCacheDir( $dir ) { + if ( !file_exists( $dir ) ) { + if ( mkdir( $dir ) ) { + return true; + } + throw new Less_Exception_Parser( 'Less.php cache directory couldn\'t be created: '.$dir ); + + } elseif ( !is_dir( $dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory doesn\'t exist: '.$dir ); + + } elseif ( !is_writable( $dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory isn\'t writable: '.$dir ); + + } else { + $dir = self::WinPath( $dir ); + Less_Cache::$cache_dir = rtrim( $dir, '/' ).'/'; + return true; + } + } + + /** + * Set a list of directories or callbacks the parser should use for determining import paths + * + * @param array $dirs + */ + public function SetImportDirs( $dirs ) { + Less_Parser::$options['import_dirs'] = array(); + + foreach ( $dirs as $path => $uri_root ) { + + $path = self::WinPath( $path ); + if ( !empty( $path ) ) { + $path = rtrim( $path, '/' ).'/'; + } + + if ( !is_callable( $uri_root ) ) { + $uri_root = self::WinPath( $uri_root ); + if ( !empty( $uri_root ) ) { + $uri_root = rtrim( $uri_root, '/' ).'/'; + } + } + + Less_Parser::$options['import_dirs'][$path] = $uri_root; + } + } + + /** + * @param string $file_path + */ + private function _parse( $file_path = null ) { + $this->rules = array_merge( $this->rules, $this->GetRules( $file_path ) ); + } + + /** + * Return the results of parsePrimary for $file_path + * Use cache and save cached results if possible + * + * @param string|null $file_path + */ + private function GetRules( $file_path ) { + $this->SetInput( $file_path ); + + $cache_file = $this->CacheFile( $file_path ); + if ( $cache_file ) { + if ( Less_Parser::$options['cache_method'] == 'callback' ) { + if ( is_callable( Less_Parser::$options['cache_callback_get'] ) ) { + $cache = call_user_func_array( + Less_Parser::$options['cache_callback_get'], + array( $this, $file_path, $cache_file ) + ); + + if ( $cache ) { + $this->UnsetInput(); + return $cache; + } + } + + } elseif ( file_exists( $cache_file ) ) { + switch ( Less_Parser::$options['cache_method'] ) { + + // Using serialize + // Faster but uses more memory + case 'serialize': + $cache = unserialize( file_get_contents( $cache_file ) ); + if ( $cache ) { + touch( $cache_file ); + $this->UnsetInput(); + return $cache; + } + break; + + // Using generated php code + case 'var_export': + case 'php': + $this->UnsetInput(); + return include $cache_file; + } + } + } + + $rules = $this->parsePrimary(); + + if ( $this->pos < $this->input_len ) { + throw new Less_Exception_Chunk( $this->input, null, $this->furthest, $this->env->currentFileInfo ); + } + + $this->UnsetInput(); + + // save the cache + if ( $cache_file ) { + if ( Less_Parser::$options['cache_method'] == 'callback' ) { + if ( is_callable( Less_Parser::$options['cache_callback_set'] ) ) { + call_user_func_array( + Less_Parser::$options['cache_callback_set'], + array( $this, $file_path, $cache_file, $rules ) + ); + } + + } else { + // msg('write cache file'); + switch ( Less_Parser::$options['cache_method'] ) { + case 'serialize': + file_put_contents( $cache_file, serialize( $rules ) ); + break; + case 'php': + file_put_contents( $cache_file, '' ); + break; + case 'var_export': + // Requires __set_state() + file_put_contents( $cache_file, '' ); + break; + } + + Less_Cache::CleanCache(); + } + } + + return $rules; + } + + /** + * Set up the input buffer + * + */ + public function SetInput( $file_path ) { + if ( $file_path ) { + $this->input = file_get_contents( $file_path ); + } + + $this->pos = $this->furthest = 0; + + // Remove potential UTF Byte Order Mark + $this->input = preg_replace( '/\\G\xEF\xBB\xBF/', '', $this->input ); + $this->input_len = strlen( $this->input ); + + if ( Less_Parser::$options['sourceMap'] && $this->env->currentFileInfo ) { + $uri = $this->env->currentFileInfo['currentUri']; + Less_Parser::$contentsMap[$uri] = $this->input; + } + + } + + /** + * Free up some memory + * + */ + public function UnsetInput() { + unset( $this->input, $this->pos, $this->input_len, $this->furthest ); + $this->saveStack = array(); + } + + public function CacheFile( $file_path ) { + if ( $file_path && $this->CacheEnabled() ) { + + $env = get_object_vars( $this->env ); + unset( $env['frames'] ); + + $parts = array(); + $parts[] = $file_path; + $parts[] = filesize( $file_path ); + $parts[] = filemtime( $file_path ); + $parts[] = $env; + $parts[] = Less_Version::cache_version; + $parts[] = Less_Parser::$options['cache_method']; + return Less_Cache::$cache_dir . Less_Cache::$prefix . base_convert( sha1( json_encode( $parts ) ), 16, 36 ) . '.lesscache'; + } + } + + static function AddParsedFile( $file ) { + self::$imports[] = $file; + } + + static function AllParsedFiles() { + return self::$imports; + } + + /** + * @param string $file + */ + static function FileParsed( $file ) { + return in_array( $file, self::$imports ); + } + + function save() { + $this->saveStack[] = $this->pos; + } + + private function restore() { + $this->pos = array_pop( $this->saveStack ); + } + + private function forget() { + array_pop( $this->saveStack ); + } + + /** + * Determine if the character at the specified offset from the current position is a white space. + * + * @param int $offset + * + * @return bool + */ + private function isWhitespace( $offset = 0 ) { + return strpos( " \t\n\r\v\f", $this->input[$this->pos + $offset] ) !== false; + } + + /** + * Parse from a token, regexp or string, and move forward if match + * + * @param array $toks + * @return array + */ + private function match( $toks ) { + // The match is confirmed, add the match length to `this::pos`, + // and consume any extra white-space characters (' ' || '\n') + // which come after that. The reason for this is that LeSS's + // grammar is mostly white-space insensitive. + // + + foreach ( $toks as $tok ) { + + $char = $tok[0]; + + if ( $char === '/' ) { + $match = $this->MatchReg( $tok ); + + if ( $match ) { + return count( $match ) === 1 ? $match[0] : $match; + } + + } elseif ( $char === '#' ) { + $match = $this->MatchChar( $tok[1] ); + + } else { + // Non-terminal, match using a function call + $match = $this->$tok(); + + } + + if ( $match ) { + return $match; + } + } + } + + /** + * @param string[] $toks + * + * @return string + */ + private function MatchFuncs( $toks ) { + if ( $this->pos < $this->input_len ) { + foreach ( $toks as $tok ) { + $match = $this->$tok(); + if ( $match ) { + return $match; + } + } + } + + } + + // Match a single character in the input, + private function MatchChar( $tok ) { + if ( ( $this->pos < $this->input_len ) && ( $this->input[$this->pos] === $tok ) ) { + $this->skipWhitespace( 1 ); + return $tok; + } + } + + // Match a regexp from the current start point + private function MatchReg( $tok ) { + if ( preg_match( $tok, $this->input, $match, 0, $this->pos ) ) { + $this->skipWhitespace( strlen( $match[0] ) ); + return $match; + } + } + + /** + * Same as match(), but don't change the state of the parser, + * just return the match. + * + * @param string $tok + * @return integer + */ + public function PeekReg( $tok ) { + return preg_match( $tok, $this->input, $match, 0, $this->pos ); + } + + /** + * @param string $tok + */ + public function PeekChar( $tok ) { + // return ($this->input[$this->pos] === $tok ); + return ( $this->pos < $this->input_len ) && ( $this->input[$this->pos] === $tok ); + } + + /** + * @param integer $length + */ + public function skipWhitespace( $length ) { + $this->pos += $length; + + for ( ; $this->pos < $this->input_len; $this->pos++ ) { + $c = $this->input[$this->pos]; + + if ( ( $c !== "\n" ) && ( $c !== "\r" ) && ( $c !== "\t" ) && ( $c !== ' ' ) ) { + break; + } + } + } + + /** + * @param string $tok + * @param string|null $msg + */ + public function expect( $tok, $msg = NULL ) { + $result = $this->match( array( $tok ) ); + if ( !$result ) { + $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); + } else { + return $result; + } + } + + /** + * @param string $tok + */ + public function expectChar( $tok, $msg = null ) { + $result = $this->MatchChar( $tok ); + if ( !$result ) { + $msg = $msg ? $msg : "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'"; + $this->Error( $msg ); + } else { + return $result; + } + } + + // + // Here in, the parsing rules/functions + // + // The basic structure of the syntax tree generated is as follows: + // + // Ruleset -> Rule -> Value -> Expression -> Entity + // + // Here's some LESS code: + // + // .class { + // color: #fff; + // border: 1px solid #000; + // width: @w + 4px; + // > .child {...} + // } + // + // And here's what the parse tree might look like: + // + // Ruleset (Selector '.class', [ + // Rule ("color", Value ([Expression [Color #fff]])) + // Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) + // Rule ("width", Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]])) + // Ruleset (Selector [Element '>', '.child'], [...]) + // ]) + // + // In general, most rules will try to parse a token with the `$()` function, and if the return + // value is truly, will return a new node, of the relevant type. Sometimes, we need to check + // first, before parsing, that's when we use `peek()`. + // + + // + // The `primary` rule is the *entry* and *exit* point of the parser. + // The rules here can appear at any level of the parse tree. + // + // The recursive nature of the grammar is an interplay between the `block` + // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, + // as represented by this simplified grammar: + // + // primary → (ruleset | rule)+ + // ruleset → selector+ block + // block → '{' primary '}' + // + // Only at one point is the primary rule not called from the + // block rule: at the root level. + // + private function parsePrimary() { + $root = array(); + + while ( true ) { + + if ( $this->pos >= $this->input_len ) { + break; + } + + $node = $this->parseExtend( true ); + if ( $node ) { + $root = array_merge( $root, $node ); + continue; + } + + // $node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseDirective')); + $node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseNameValue', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseRulesetCall', 'parseDirective' ) ); + + if ( $node ) { + $root[] = $node; + } elseif ( !$this->MatchReg( '/\\G[\s\n;]+/' ) ) { + break; + } + + if ( $this->PeekChar( '}' ) ) { + break; + } + } + + return $root; + } + + // We create a Comment node for CSS comments `/* */`, + // but keep the LeSS comments `//` silent, by just skipping + // over them. + private function parseComment() { + if ( $this->input[$this->pos] !== '/' ) { + return; + } + + if ( $this->input[$this->pos + 1] === '/' ) { + $match = $this->MatchReg( '/\\G\/\/.*/' ); + return $this->NewObj4( 'Less_Tree_Comment', array( $match[0], true, $this->pos, $this->env->currentFileInfo ) ); + } + + // $comment = $this->MatchReg('/\\G\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/'); + $comment = $this->MatchReg( '/\\G\/\*(?s).*?\*+\/\n?/' );// not the same as less.js to prevent fatal errors + if ( $comment ) { + return $this->NewObj4( 'Less_Tree_Comment', array( $comment[0], false, $this->pos, $this->env->currentFileInfo ) ); + } + } + + private function parseComments() { + $comments = array(); + + while ( $this->pos < $this->input_len ) { + $comment = $this->parseComment(); + if ( !$comment ) { + break; + } + + $comments[] = $comment; + } + + return $comments; + } + + // + // A string, which supports escaping " and ' + // + // "milky way" 'he\'s the one!' + // + private function parseEntitiesQuoted() { + $j = $this->pos; + $e = false; + $index = $this->pos; + + if ( $this->input[$this->pos] === '~' ) { + $j++; + $e = true; // Escaped strings + } + + $char = $this->input[$j]; + if ( $char !== '"' && $char !== "'" ) { + return; + } + + if ( $e ) { + $this->MatchChar( '~' ); + } + + $matched = $this->MatchQuoted( $char, $j + 1 ); + if ( $matched === false ) { + return; + } + + $quoted = $char.$matched.$char; + return $this->NewObj5( 'Less_Tree_Quoted', array( $quoted, $matched, $e, $index, $this->env->currentFileInfo ) ); + } + + /** + * When PCRE JIT is enabled in php, regular expressions don't work for matching quoted strings + * + * $regex = '/\\G\'((?:[^\'\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)\'/'; + * $regex = '/\\G"((?:[^"\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)"/'; + * + */ + private function MatchQuoted( $quote_char, $i ) { + $matched = ''; + while ( $i < $this->input_len ) { + $c = $this->input[$i]; + + // escaped character + if ( $c === '\\' ) { + $matched .= $c . $this->input[$i + 1]; + $i += 2; + continue; + } + + if ( $c === $quote_char ) { + $this->pos = $i + 1; + $this->skipWhitespace( 0 ); + return $matched; + } + + if ( $c === "\r" || $c === "\n" ) { + return false; + } + + $i++; + $matched .= $c; + } + + return false; + } + + // + // A catch-all word, such as: + // + // black border-collapse + // + private function parseEntitiesKeyword() { + // $k = $this->MatchReg('/\\G[_A-Za-z-][_A-Za-z0-9-]*/'); + $k = $this->MatchReg( '/\\G%|\\G[_A-Za-z-][_A-Za-z0-9-]*/' ); + if ( $k ) { + $k = $k[0]; + $color = $this->fromKeyword( $k ); + if ( $color ) { + return $color; + } + return $this->NewObj1( 'Less_Tree_Keyword', $k ); + } + } + + // duplicate of Less_Tree_Color::FromKeyword + private function FromKeyword( $keyword ) { + $keyword = strtolower( $keyword ); + + if ( Less_Colors::hasOwnProperty( $keyword ) ) { + // detect named color + return $this->NewObj1( 'Less_Tree_Color', substr( Less_Colors::color( $keyword ), 1 ) ); + } + + if ( $keyword === 'transparent' ) { + return $this->NewObj3( 'Less_Tree_Color', array( array( 0, 0, 0 ), 0, true ) ); + } + } + + // + // A function call + // + // rgb(255, 0, 255) + // + // We also try to catch IE's `alpha()`, but let the `alpha` parser + // deal with the details. + // + // The arguments are parsed with the `entities.arguments` parser. + // + private function parseEntitiesCall() { + $index = $this->pos; + + if ( !preg_match( '/\\G([\w-]+|%|progid:[\w\.]+)\(/', $this->input, $name, 0, $this->pos ) ) { + return; + } + $name = $name[1]; + $nameLC = strtolower( $name ); + + if ( $nameLC === 'url' ) { + return null; + } + + $this->pos += strlen( $name ); + + if ( $nameLC === 'alpha' ) { + $alpha_ret = $this->parseAlpha(); + if ( $alpha_ret ) { + return $alpha_ret; + } + } + + $this->MatchChar( '(' ); // Parse the '(' and consume whitespace. + + $args = $this->parseEntitiesArguments(); + + if ( !$this->MatchChar( ')' ) ) { + return; + } + + if ( $name ) { + return $this->NewObj4( 'Less_Tree_Call', array( $name, $args, $index, $this->env->currentFileInfo ) ); + } + } + + /** + * Parse a list of arguments + * + * @return array + */ + private function parseEntitiesArguments() { + $args = array(); + while ( true ) { + $arg = $this->MatchFuncs( array( 'parseEntitiesAssignment','parseExpression' ) ); + if ( !$arg ) { + break; + } + + $args[] = $arg; + if ( !$this->MatchChar( ',' ) ) { + break; + } + } + return $args; + } + + private function parseEntitiesLiteral() { + return $this->MatchFuncs( array( 'parseEntitiesDimension','parseEntitiesColor','parseEntitiesQuoted','parseUnicodeDescriptor' ) ); + } + + // Assignments are argument entities for calls. + // They are present in ie filter properties as shown below. + // + // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) + // + private function parseEntitiesAssignment() { + $key = $this->MatchReg( '/\\G\w+(?=\s?=)/' ); + if ( !$key ) { + return; + } + + if ( !$this->MatchChar( '=' ) ) { + return; + } + + $value = $this->parseEntity(); + if ( $value ) { + return $this->NewObj2( 'Less_Tree_Assignment', array( $key[0], $value ) ); + } + } + + // + // Parse url() tokens + // + // We use a specific rule for urls, because they don't really behave like + // standard function calls. The difference is that the argument doesn't have + // to be enclosed within a string, so it can't be parsed as an Expression. + // + private function parseEntitiesUrl() { + if ( $this->input[$this->pos] !== 'u' || !$this->matchReg( '/\\Gurl\(/' ) ) { + return; + } + + $value = $this->match( array( 'parseEntitiesQuoted','parseEntitiesVariable','/\\Gdata\:.*?[^\)]+/','/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/' ) ); + if ( !$value ) { + $value = ''; + } + + $this->expectChar( ')' ); + + if ( isset( $value->value ) || $value instanceof Less_Tree_Variable ) { + return $this->NewObj2( 'Less_Tree_Url', array( $value, $this->env->currentFileInfo ) ); + } + + return $this->NewObj2( 'Less_Tree_Url', array( $this->NewObj1( 'Less_Tree_Anonymous', $value ), $this->env->currentFileInfo ) ); + } + + // + // A Variable entity, such as `@fink`, in + // + // width: @fink + 2px + // + // We use a different parser for variable definitions, + // see `parsers.variable`. + // + private function parseEntitiesVariable() { + $index = $this->pos; + if ( $this->PeekChar( '@' ) && ( $name = $this->MatchReg( '/\\G@@?[\w-]+/' ) ) ) { + return $this->NewObj3( 'Less_Tree_Variable', array( $name[0], $index, $this->env->currentFileInfo ) ); + } + } + + // A variable entity using the protective {} e.g. @{var} + private function parseEntitiesVariableCurly() { + $index = $this->pos; + + if ( $this->input_len > ( $this->pos + 1 ) && $this->input[$this->pos] === '@' && ( $curly = $this->MatchReg( '/\\G@\{([\w-]+)\}/' ) ) ) { + return $this->NewObj3( 'Less_Tree_Variable', array( '@'.$curly[1], $index, $this->env->currentFileInfo ) ); + } + } + + // + // A Hexadecimal color + // + // #4F3C2F + // + // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // + private function parseEntitiesColor() { + if ( $this->PeekChar( '#' ) && ( $rgb = $this->MatchReg( '/\\G#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/' ) ) ) { + return $this->NewObj1( 'Less_Tree_Color', $rgb[1] ); + } + } + + // + // A Dimension, that is, a number and a unit + // + // 0.5em 95% + // + private function parseEntitiesDimension() { + $c = @ord( $this->input[$this->pos] ); + + // Is the first char of the dimension 0-9, '.', '+' or '-' + if ( ( $c > 57 || $c < 43 ) || $c === 47 || $c == 44 ) { + return; + } + + $value = $this->MatchReg( '/\\G([+-]?\d*\.?\d+)(%|[a-z]+)?/' ); + if ( $value ) { + + if ( isset( $value[2] ) ) { + return $this->NewObj2( 'Less_Tree_Dimension', array( $value[1],$value[2] ) ); + } + return $this->NewObj1( 'Less_Tree_Dimension', $value[1] ); + } + } + + // + // A unicode descriptor, as is used in unicode-range + // + // U+0?? or U+00A1-00A9 + // + function parseUnicodeDescriptor() { + $ud = $this->MatchReg( '/\\G(U\+[0-9a-fA-F?]+)(\-[0-9a-fA-F?]+)?/' ); + if ( $ud ) { + return $this->NewObj1( 'Less_Tree_UnicodeDescriptor', $ud[0] ); + } + } + + // + // JavaScript code to be evaluated + // + // `window.location.href` + // + private function parseEntitiesJavascript() { + $e = false; + $j = $this->pos; + if ( $this->input[$j] === '~' ) { + $j++; + $e = true; + } + if ( $this->input[$j] !== '`' ) { + return; + } + if ( $e ) { + $this->MatchChar( '~' ); + } + $str = $this->MatchReg( '/\\G`([^`]*)`/' ); + if ( $str ) { + return $this->NewObj3( 'Less_Tree_Javascript', array( $str[1], $this->pos, $e ) ); + } + } + + // + // The variable part of a variable definition. Used in the `rule` parser + // + // @fink: + // + private function parseVariable() { + if ( $this->PeekChar( '@' ) && ( $name = $this->MatchReg( '/\\G(@[\w-]+)\s*:/' ) ) ) { + return $name[1]; + } + } + + // + // The variable part of a variable definition. Used in the `rule` parser + // + // @fink(); + // + private function parseRulesetCall() { + if ( $this->input[$this->pos] === '@' && ( $name = $this->MatchReg( '/\\G(@[\w-]+)\s*\(\s*\)\s*;/' ) ) ) { + return $this->NewObj1( 'Less_Tree_RulesetCall', $name[1] ); + } + } + + // + // extend syntax - used to extend selectors + // + function parseExtend( $isRule = false ) { + $index = $this->pos; + $extendList = array(); + + if ( !$this->MatchReg( $isRule ? '/\\G&:extend\(/' : '/\\G:extend\(/' ) ) { return; + } + + do{ + $option = null; + $elements = array(); + while ( true ) { + $option = $this->MatchReg( '/\\G(all)(?=\s*(\)|,))/' ); + if ( $option ) { break; + } + $e = $this->parseElement(); + if ( !$e ) { break; + } + $elements[] = $e; + } + + if ( $option ) { + $option = $option[1]; + } + + $extendList[] = $this->NewObj3( 'Less_Tree_Extend', array( $this->NewObj1( 'Less_Tree_Selector', $elements ), $option, $index ) ); + + }while ( $this->MatchChar( "," ) ); + + $this->expect( '/\\G\)/' ); + + if ( $isRule ) { + $this->expect( '/\\G;/' ); + } + + return $extendList; + } + + // + // A Mixin call, with an optional argument list + // + // #mixins > .square(#fff); + // .rounded(4px, black); + // .button; + // + // The `while` loop is there because mixins can be + // namespaced, but we only support the child and descendant + // selector for now. + // + private function parseMixinCall() { + $char = $this->input[$this->pos]; + if ( $char !== '.' && $char !== '#' ) { + return; + } + + $index = $this->pos; + $this->save(); // stop us absorbing part of an invalid selector + + $elements = $this->parseMixinCallElements(); + + if ( $elements ) { + + if ( $this->MatchChar( '(' ) ) { + $returned = $this->parseMixinArgs( true ); + $args = $returned['args']; + $this->expectChar( ')' ); + } else { + $args = array(); + } + + $important = $this->parseImportant(); + + if ( $this->parseEnd() ) { + $this->forget(); + return $this->NewObj5( 'Less_Tree_Mixin_Call', array( $elements, $args, $index, $this->env->currentFileInfo, $important ) ); + } + } + + $this->restore(); + } + + private function parseMixinCallElements() { + $elements = array(); + $c = null; + + while ( true ) { + $elemIndex = $this->pos; + $e = $this->MatchReg( '/\\G[#.](?:[\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/' ); + if ( !$e ) { + break; + } + $elements[] = $this->NewObj4( 'Less_Tree_Element', array( $c, $e[0], $elemIndex, $this->env->currentFileInfo ) ); + $c = $this->MatchChar( '>' ); + } + + return $elements; + } + + /** + * @param boolean $isCall + */ + private function parseMixinArgs( $isCall ) { + $expressions = array(); + $argsSemiColon = array(); + $isSemiColonSeperated = null; + $argsComma = array(); + $expressionContainsNamed = null; + $name = null; + $returner = array( 'args' => array(), 'variadic' => false ); + + $this->save(); + + while ( true ) { + if ( $isCall ) { + $arg = $this->MatchFuncs( array( 'parseDetachedRuleset','parseExpression' ) ); + } else { + $this->parseComments(); + if ( $this->input[ $this->pos ] === '.' && $this->MatchReg( '/\\G\.{3}/' ) ) { + $returner['variadic'] = true; + if ( $this->MatchChar( ";" ) && !$isSemiColonSeperated ) { + $isSemiColonSeperated = true; + } + + if ( $isSemiColonSeperated ) { + $argsSemiColon[] = array( 'variadic' => true ); + } else { + $argsComma[] = array( 'variadic' => true ); + } + break; + } + $arg = $this->MatchFuncs( array( 'parseEntitiesVariable','parseEntitiesLiteral','parseEntitiesKeyword' ) ); + } + + if ( !$arg ) { + break; + } + + $nameLoop = null; + if ( $arg instanceof Less_Tree_Expression ) { + $arg->throwAwayComments(); + } + $value = $arg; + $val = null; + + if ( $isCall ) { + // Variable + if ( property_exists( $arg, 'value' ) && count( $arg->value ) == 1 ) { + $val = $arg->value[0]; + } + } else { + $val = $arg; + } + + if ( $val instanceof Less_Tree_Variable ) { + + if ( $this->MatchChar( ':' ) ) { + if ( $expressions ) { + if ( $isSemiColonSeperated ) { + $this->Error( 'Cannot mix ; and , as delimiter types' ); + } + $expressionContainsNamed = true; + } + + // we do not support setting a ruleset as a default variable - it doesn't make sense + // However if we do want to add it, there is nothing blocking it, just don't error + // and remove isCall dependency below + $value = null; + if ( $isCall ) { + $value = $this->parseDetachedRuleset(); + } + if ( !$value ) { + $value = $this->parseExpression(); + } + + if ( !$value ) { + if ( $isCall ) { + $this->Error( 'could not understand value for named argument' ); + } else { + $this->restore(); + $returner['args'] = array(); + return $returner; + } + } + + $nameLoop = ( $name = $val->name ); + } elseif ( !$isCall && $this->MatchReg( '/\\G\.{3}/' ) ) { + $returner['variadic'] = true; + if ( $this->MatchChar( ";" ) && !$isSemiColonSeperated ) { + $isSemiColonSeperated = true; + } + if ( $isSemiColonSeperated ) { + $argsSemiColon[] = array( 'name' => $arg->name, 'variadic' => true ); + } else { + $argsComma[] = array( 'name' => $arg->name, 'variadic' => true ); + } + break; + } elseif ( !$isCall ) { + $name = $nameLoop = $val->name; + $value = null; + } + } + + if ( $value ) { + $expressions[] = $value; + } + + $argsComma[] = array( 'name' => $nameLoop, 'value' => $value ); + + if ( $this->MatchChar( ',' ) ) { + continue; + } + + if ( $this->MatchChar( ';' ) || $isSemiColonSeperated ) { + + if ( $expressionContainsNamed ) { + $this->Error( 'Cannot mix ; and , as delimiter types' ); + } + + $isSemiColonSeperated = true; + + if ( count( $expressions ) > 1 ) { + $value = $this->NewObj1( 'Less_Tree_Value', $expressions ); + } + $argsSemiColon[] = array( 'name' => $name, 'value' => $value ); + + $name = null; + $expressions = array(); + $expressionContainsNamed = false; + } + } + + $this->forget(); + $returner['args'] = ( $isSemiColonSeperated ? $argsSemiColon : $argsComma ); + return $returner; + } + + // + // A Mixin definition, with a list of parameters + // + // .rounded (@radius: 2px, @color) { + // ... + // } + // + // Until we have a finer grained state-machine, we have to + // do a look-ahead, to make sure we don't have a mixin call. + // See the `rule` function for more information. + // + // We start by matching `.rounded (`, and then proceed on to + // the argument list, which has optional default values. + // We store the parameters in `params`, with a `value` key, + // if there is a value, such as in the case of `@radius`. + // + // Once we've got our params list, and a closing `)`, we parse + // the `{...}` block. + // + private function parseMixinDefinition() { + $cond = null; + + $char = $this->input[$this->pos]; + if ( ( $char !== '.' && $char !== '#' ) || ( $char === '{' && $this->PeekReg( '/\\G[^{]*\}/' ) ) ) { + return; + } + + $this->save(); + + $match = $this->MatchReg( '/\\G([#.](?:[\w-]|\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/' ); + if ( $match ) { + $name = $match[1]; + + $argInfo = $this->parseMixinArgs( false ); + $params = $argInfo['args']; + $variadic = $argInfo['variadic']; + + // .mixincall("@{a}"); + // looks a bit like a mixin definition.. + // also + // .mixincall(@a: {rule: set;}); + // so we have to be nice and restore + if ( !$this->MatchChar( ')' ) ) { + $this->furthest = $this->pos; + $this->restore(); + return; + } + + $this->parseComments(); + + if ( $this->MatchReg( '/\\Gwhen/' ) ) { // Guard + $cond = $this->expect( 'parseConditions', 'Expected conditions' ); + } + + $ruleset = $this->parseBlock(); + + if ( is_array( $ruleset ) ) { + $this->forget(); + return $this->NewObj5( 'Less_Tree_Mixin_Definition', array( $name, $params, $ruleset, $cond, $variadic ) ); + } + + $this->restore(); + } else { + $this->forget(); + } + } + + // + // Entities are the smallest recognized token, + // and can be found inside a rule's value. + // + private function parseEntity() { + return $this->MatchFuncs( array( 'parseEntitiesLiteral','parseEntitiesVariable','parseEntitiesUrl','parseEntitiesCall','parseEntitiesKeyword','parseEntitiesJavascript','parseComment' ) ); + } + + // + // A Rule terminator. Note that we use `peek()` to check for '}', + // because the `block` rule will be expecting it, but we still need to make sure + // it's there, if ';' was omitted. + // + private function parseEnd() { + return $this->MatchChar( ';' ) || $this->PeekChar( '}' ); + } + + // + // IE's alpha function + // + // alpha(opacity=88) + // + private function parseAlpha() { + if ( !$this->MatchReg( '/\\G\(opacity=/i' ) ) { + return; + } + + $value = $this->MatchReg( '/\\G[0-9]+/' ); + if ( $value ) { + $value = $value[0]; + } else { + $value = $this->parseEntitiesVariable(); + if ( !$value ) { + return; + } + } + + $this->expectChar( ')' ); + return $this->NewObj1( 'Less_Tree_Alpha', $value ); + } + + // + // A Selector Element + // + // div + // + h1 + // #socks + // input[type="text"] + // + // Elements are the building blocks for Selectors, + // they are made out of a `Combinator` (see combinator rule), + // and an element name, such as a tag a class, or `*`. + // + private function parseElement() { + $c = $this->parseCombinator(); + $index = $this->pos; + + $e = $this->match( array( '/\\G(?:\d+\.\d+|\d+)%/', '/\\G(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/', + '#*', '#&', 'parseAttribute', '/\\G\([^()@]+\)/', '/\\G[\.#](?=@)/', 'parseEntitiesVariableCurly' ) ); + + if ( is_null( $e ) ) { + $this->save(); + if ( $this->MatchChar( '(' ) ) { + if ( ( $v = $this->parseSelector() ) && $this->MatchChar( ')' ) ) { + $e = $this->NewObj1( 'Less_Tree_Paren', $v ); + $this->forget(); + } else { + $this->restore(); + } + } else { + $this->forget(); + } + } + + if ( !is_null( $e ) ) { + return $this->NewObj4( 'Less_Tree_Element', array( $c, $e, $index, $this->env->currentFileInfo ) ); + } + } + + // + // Combinators combine elements together, in a Selector. + // + // Because our parser isn't white-space sensitive, special care + // has to be taken, when parsing the descendant combinator, ` `, + // as it's an empty space. We have to check the previous character + // in the input, to see if it's a ` ` character. + // + private function parseCombinator() { + if ( $this->pos < $this->input_len ) { + $c = $this->input[$this->pos]; + if ( $c === '>' || $c === '+' || $c === '~' || $c === '|' || $c === '^' ) { + + $this->pos++; + if ( $this->input[$this->pos] === '^' ) { + $c = '^^'; + $this->pos++; + } + + $this->skipWhitespace( 0 ); + + return $c; + } + + if ( $this->pos > 0 && $this->isWhitespace( -1 ) ) { + return ' '; + } + } + } + + // + // A CSS selector (see selector below) + // with less extensions e.g. the ability to extend and guard + // + private function parseLessSelector() { + return $this->parseSelector( true ); + } + + // + // A CSS Selector + // + // .class > div + h1 + // li a:hover + // + // Selectors are made out of one or more Elements, see above. + // + private function parseSelector( $isLess = false ) { + $elements = array(); + $extendList = array(); + $condition = null; + $when = false; + $extend = false; + $e = null; + $c = null; + $index = $this->pos; + + while ( ( $isLess && ( $extend = $this->parseExtend() ) ) || ( $isLess && ( $when = $this->MatchReg( '/\\Gwhen/' ) ) ) || ( $e = $this->parseElement() ) ) { + if ( $when ) { + $condition = $this->expect( 'parseConditions', 'expected condition' ); + } elseif ( $condition ) { + // error("CSS guard can only be used at the end of selector"); + } elseif ( $extend ) { + $extendList = array_merge( $extendList, $extend ); + } else { + // if( count($extendList) ){ + //error("Extend can only be used at the end of selector"); + //} + if ( $this->pos < $this->input_len ) { + $c = $this->input[ $this->pos ]; + } + $elements[] = $e; + $e = null; + } + + if ( $c === '{' || $c === '}' || $c === ';' || $c === ',' || $c === ')' ) { break; + } + } + + if ( $elements ) { + return $this->NewObj5( 'Less_Tree_Selector', array( $elements, $extendList, $condition, $index, $this->env->currentFileInfo ) ); + } + if ( $extendList ) { + $this->Error( 'Extend must be used to extend a selector, it cannot be used on its own' ); + } + } + + private function parseTag() { + return ( $tag = $this->MatchReg( '/\\G[A-Za-z][A-Za-z-]*[0-9]?/' ) ) ? $tag : $this->MatchChar( '*' ); + } + + private function parseAttribute() { + $val = null; + + if ( !$this->MatchChar( '[' ) ) { + return; + } + + $key = $this->parseEntitiesVariableCurly(); + if ( !$key ) { + $key = $this->expect( '/\\G(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\\\.)+/' ); + } + + $op = $this->MatchReg( '/\\G[|~*$^]?=/' ); + if ( $op ) { + $val = $this->match( array( 'parseEntitiesQuoted','/\\G[0-9]+%/','/\\G[\w-]+/','parseEntitiesVariableCurly' ) ); + } + + $this->expectChar( ']' ); + + return $this->NewObj3( 'Less_Tree_Attribute', array( $key, $op === null ? null : $op[0], $val ) ); + } + + // + // The `block` rule is used by `ruleset` and `mixin.definition`. + // It's a wrapper around the `primary` rule, with added `{}`. + // + private function parseBlock() { + if ( $this->MatchChar( '{' ) ) { + $content = $this->parsePrimary(); + if ( $this->MatchChar( '}' ) ) { + return $content; + } + } + } + + private function parseBlockRuleset() { + $block = $this->parseBlock(); + + if ( $block ) { + $block = $this->NewObj2( 'Less_Tree_Ruleset', array( null, $block ) ); + } + + return $block; + } + + private function parseDetachedRuleset() { + $blockRuleset = $this->parseBlockRuleset(); + if ( $blockRuleset ) { + return $this->NewObj1( 'Less_Tree_DetachedRuleset', $blockRuleset ); + } + } + + // + // div, .class, body > p {...} + // + private function parseRuleset() { + $selectors = array(); + + $this->save(); + + while ( true ) { + $s = $this->parseLessSelector(); + if ( !$s ) { + break; + } + $selectors[] = $s; + $this->parseComments(); + + if ( $s->condition && count( $selectors ) > 1 ) { + $this->Error( 'Guards are only currently allowed on a single selector.' ); + } + + if ( !$this->MatchChar( ',' ) ) { + break; + } + if ( $s->condition ) { + $this->Error( 'Guards are only currently allowed on a single selector.' ); + } + $this->parseComments(); + } + + if ( $selectors ) { + $rules = $this->parseBlock(); + if ( is_array( $rules ) ) { + $this->forget(); + return $this->NewObj2( 'Less_Tree_Ruleset', array( $selectors, $rules ) ); // Less_Environment::$strictImports + } + } + + // Backtrack + $this->furthest = $this->pos; + $this->restore(); + } + + /** + * Custom less.php parse function for finding simple name-value css pairs + * ex: width:100px; + * + */ + private function parseNameValue() { + $index = $this->pos; + $this->save(); + + // $match = $this->MatchReg('/\\G([a-zA-Z\-]+)\s*:\s*((?:\'")?[a-zA-Z0-9\-% \.,!]+?(?:\'")?)\s*([;}])/'); + $match = $this->MatchReg( '/\\G([a-zA-Z\-]+)\s*:\s*([\'"]?[#a-zA-Z0-9\-%\.,]+?[\'"]?) *(! *important)?\s*([;}])/' ); + if ( $match ) { + + if ( $match[4] == '}' ) { + $this->pos = $index + strlen( $match[0] ) - 1; + } + + if ( $match[3] ) { + $match[2] .= ' !important'; + } + + return $this->NewObj4( 'Less_Tree_NameValue', array( $match[1], $match[2], $index, $this->env->currentFileInfo ) ); + } + + $this->restore(); + } + + private function parseRule( $tryAnonymous = null ) { + $merge = false; + $startOfRule = $this->pos; + + $c = $this->input[$this->pos]; + if ( $c === '.' || $c === '#' || $c === '&' ) { + return; + } + + $this->save(); + $name = $this->MatchFuncs( array( 'parseVariable','parseRuleProperty' ) ); + + if ( $name ) { + + $isVariable = is_string( $name ); + + $value = null; + if ( $isVariable ) { + $value = $this->parseDetachedRuleset(); + } + + $important = null; + if ( !$value ) { + + // prefer to try to parse first if its a variable or we are compressing + // but always fallback on the other one + //if( !$tryAnonymous && is_string($name) && $name[0] === '@' ){ + if ( !$tryAnonymous && ( Less_Parser::$options['compress'] || $isVariable ) ) { + $value = $this->MatchFuncs( array( 'parseValue','parseAnonymousValue' ) ); + } else { + $value = $this->MatchFuncs( array( 'parseAnonymousValue','parseValue' ) ); + } + + $important = $this->parseImportant(); + + // a name returned by this.ruleProperty() is always an array of the form: + // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] + // where each item is a tree.Keyword or tree.Variable + if ( !$isVariable && is_array( $name ) ) { + $nm = array_pop( $name ); + if ( $nm->value ) { + $merge = $nm->value; + } + } + } + + if ( $value && $this->parseEnd() ) { + $this->forget(); + return $this->NewObj6( 'Less_Tree_Rule', array( $name, $value, $important, $merge, $startOfRule, $this->env->currentFileInfo ) ); + } else { + $this->furthest = $this->pos; + $this->restore(); + if ( $value && !$tryAnonymous ) { + return $this->parseRule( true ); + } + } + } else { + $this->forget(); + } + } + + function parseAnonymousValue() { + if ( preg_match( '/\\G([^@+\/\'"*`(;{}-]*);/', $this->input, $match, 0, $this->pos ) ) { + $this->pos += strlen( $match[1] ); + return $this->NewObj1( 'Less_Tree_Anonymous', $match[1] ); + } + } + + // + // An @import directive + // + // @import "lib"; + // + // Depending on our environment, importing is done differently: + // In the browser, it's an XHR request, in Node, it would be a + // file-system operation. The function used for importing is + // stored in `import`, which we pass to the Import constructor. + // + private function parseImport() { + $this->save(); + + $dir = $this->MatchReg( '/\\G@import?\s+/' ); + + if ( $dir ) { + $options = $this->parseImportOptions(); + $path = $this->MatchFuncs( array( 'parseEntitiesQuoted','parseEntitiesUrl' ) ); + + if ( $path ) { + $features = $this->parseMediaFeatures(); + if ( $this->MatchChar( ';' ) ) { + if ( $features ) { + $features = $this->NewObj1( 'Less_Tree_Value', $features ); + } + + $this->forget(); + return $this->NewObj5( 'Less_Tree_Import', array( $path, $features, $options, $this->pos, $this->env->currentFileInfo ) ); + } + } + } + + $this->restore(); + } + + private function parseImportOptions() { + $options = array(); + + // list of options, surrounded by parens + if ( !$this->MatchChar( '(' ) ) { + return $options; + } + do{ + $optionName = $this->parseImportOption(); + if ( $optionName ) { + $value = true; + switch ( $optionName ) { + case "css": + $optionName = "less"; + $value = false; + break; + case "once": + $optionName = "multiple"; + $value = false; + break; + } + $options[$optionName] = $value; + if ( !$this->MatchChar( ',' ) ) { break; + } + } + }while ( $optionName ); + $this->expectChar( ')' ); + return $options; + } + + private function parseImportOption() { + $opt = $this->MatchReg( '/\\G(less|css|multiple|once|inline|reference|optional)/' ); + if ( $opt ) { + return $opt[1]; + } + } + + private function parseMediaFeature() { + $nodes = array(); + + do{ + $e = $this->MatchFuncs( array( 'parseEntitiesKeyword','parseEntitiesVariable' ) ); + if ( $e ) { + $nodes[] = $e; + } elseif ( $this->MatchChar( '(' ) ) { + $p = $this->parseProperty(); + $e = $this->parseValue(); + if ( $this->MatchChar( ')' ) ) { + if ( $p && $e ) { + $r = $this->NewObj7( 'Less_Tree_Rule', array( $p, $e, null, null, $this->pos, $this->env->currentFileInfo, true ) ); + $nodes[] = $this->NewObj1( 'Less_Tree_Paren', $r ); + } elseif ( $e ) { + $nodes[] = $this->NewObj1( 'Less_Tree_Paren', $e ); + } else { + return null; + } + } else return null; + } + } while ( $e ); + + if ( $nodes ) { + return $this->NewObj1( 'Less_Tree_Expression', $nodes ); + } + } + + private function parseMediaFeatures() { + $features = array(); + + do{ + $e = $this->parseMediaFeature(); + if ( $e ) { + $features[] = $e; + if ( !$this->MatchChar( ',' ) ) break; + } else { + $e = $this->parseEntitiesVariable(); + if ( $e ) { + $features[] = $e; + if ( !$this->MatchChar( ',' ) ) break; + } + } + } while ( $e ); + + return $features ? $features : null; + } + + private function parseMedia() { + if ( $this->MatchReg( '/\\G@media/' ) ) { + $features = $this->parseMediaFeatures(); + $rules = $this->parseBlock(); + + if ( is_array( $rules ) ) { + return $this->NewObj4( 'Less_Tree_Media', array( $rules, $features, $this->pos, $this->env->currentFileInfo ) ); + } + } + } + + // + // A CSS Directive + // + // @charset "utf-8"; + // + private function parseDirective() { + if ( !$this->PeekChar( '@' ) ) { + return; + } + + $rules = null; + $index = $this->pos; + $hasBlock = true; + $hasIdentifier = false; + $hasExpression = false; + $hasUnknown = false; + + $value = $this->MatchFuncs( array( 'parseImport','parseMedia' ) ); + if ( $value ) { + return $value; + } + + $this->save(); + + $name = $this->MatchReg( '/\\G@[a-z-]+/' ); + + if ( !$name ) return; + $name = $name[0]; + + $nonVendorSpecificName = $name; + $pos = strpos( $name, '-', 2 ); + if ( $name[1] == '-' && $pos > 0 ) { + $nonVendorSpecificName = "@" . substr( $name, $pos + 1 ); + } + + switch ( $nonVendorSpecificName ) { + /* + case "@font-face": + case "@viewport": + case "@top-left": + case "@top-left-corner": + case "@top-center": + case "@top-right": + case "@top-right-corner": + case "@bottom-left": + case "@bottom-left-corner": + case "@bottom-center": + case "@bottom-right": + case "@bottom-right-corner": + case "@left-top": + case "@left-middle": + case "@left-bottom": + case "@right-top": + case "@right-middle": + case "@right-bottom": + hasBlock = true; + break; + */ + case "@charset": + $hasIdentifier = true; + $hasBlock = false; + break; + case "@namespace": + $hasExpression = true; + $hasBlock = false; + break; + case "@keyframes": + $hasIdentifier = true; + break; + case "@host": + case "@page": + case "@document": + case "@supports": + $hasUnknown = true; + break; + } + + if ( $hasIdentifier ) { + $value = $this->parseEntity(); + if ( !$value ) { + $this->error( "expected " . $name . " identifier" ); + } + } else if ( $hasExpression ) { + $value = $this->parseExpression(); + if ( !$value ) { + $this->error( "expected " . $name. " expression" ); + } + } else if ( $hasUnknown ) { + + $value = $this->MatchReg( '/\\G[^{;]+/' ); + if ( $value ) { + $value = $this->NewObj1( 'Less_Tree_Anonymous', trim( $value[0] ) ); + } + } + + if ( $hasBlock ) { + $rules = $this->parseBlockRuleset(); + } + + if ( $rules || ( !$hasBlock && $value && $this->MatchChar( ';' ) ) ) { + $this->forget(); + return $this->NewObj5( 'Less_Tree_Directive', array( $name, $value, $rules, $index, $this->env->currentFileInfo ) ); + } + + $this->restore(); + } + + // + // A Value is a comma-delimited list of Expressions + // + // font-family: Baskerville, Georgia, serif; + // + // In a Rule, a Value represents everything after the `:`, + // and before the `;`. + // + private function parseValue() { + $expressions = array(); + + do{ + $e = $this->parseExpression(); + if ( $e ) { + $expressions[] = $e; + if ( !$this->MatchChar( ',' ) ) { + break; + } + } + }while ( $e ); + + if ( $expressions ) { + return $this->NewObj1( 'Less_Tree_Value', $expressions ); + } + } + + private function parseImportant() { + if ( $this->PeekChar( '!' ) && $this->MatchReg( '/\\G! *important/' ) ) { + return ' !important'; + } + } + + private function parseSub() { + if ( $this->MatchChar( '(' ) ) { + $a = $this->parseAddition(); + if ( $a ) { + $this->expectChar( ')' ); + return $this->NewObj2( 'Less_Tree_Expression', array( array( $a ), true ) ); // instead of $e->parens = true so the value is cached + } + } + } + + /** + * Parses multiplication operation + * + * @return Less_Tree_Operation|null + */ + function parseMultiplication() { + $return = $m = $this->parseOperand(); + if ( $return ) { + while ( true ) { + + $isSpaced = $this->isWhitespace( -1 ); + + if ( $this->PeekReg( '/\\G\/[*\/]/' ) ) { + break; + } + + $op = $this->MatchChar( '/' ); + if ( !$op ) { + $op = $this->MatchChar( '*' ); + if ( !$op ) { + break; + } + } + + $a = $this->parseOperand(); + + if ( !$a ) { break; + } + + $m->parensInOp = true; + $a->parensInOp = true; + $return = $this->NewObj3( 'Less_Tree_Operation', array( $op, array( $return, $a ), $isSpaced ) ); + } + } + return $return; + + } + + /** + * Parses an addition operation + * + * @return Less_Tree_Operation|null + */ + private function parseAddition() { + $return = $m = $this->parseMultiplication(); + if ( $return ) { + while ( true ) { + + $isSpaced = $this->isWhitespace( -1 ); + + $op = $this->MatchReg( '/\\G[-+]\s+/' ); + if ( $op ) { + $op = $op[0]; + } else { + if ( !$isSpaced ) { + $op = $this->match( array( '#+','#-' ) ); + } + if ( !$op ) { + break; + } + } + + $a = $this->parseMultiplication(); + if ( !$a ) { + break; + } + + $m->parensInOp = true; + $a->parensInOp = true; + $return = $this->NewObj3( 'Less_Tree_Operation', array( $op, array( $return, $a ), $isSpaced ) ); + } + } + + return $return; + } + + /** + * Parses the conditions + * + * @return Less_Tree_Condition|null + */ + private function parseConditions() { + $index = $this->pos; + $return = $a = $this->parseCondition(); + if ( $a ) { + while ( true ) { + if ( !$this->PeekReg( '/\\G,\s*(not\s*)?\(/' ) || !$this->MatchChar( ',' ) ) { + break; + } + $b = $this->parseCondition(); + if ( !$b ) { + break; + } + + $return = $this->NewObj4( 'Less_Tree_Condition', array( 'or', $return, $b, $index ) ); + } + return $return; + } + } + + private function parseCondition() { + $index = $this->pos; + $negate = false; + $c = null; + + if ( $this->MatchReg( '/\\Gnot/' ) ) $negate = true; + $this->expectChar( '(' ); + $a = $this->MatchFuncs( array( 'parseAddition','parseEntitiesKeyword','parseEntitiesQuoted' ) ); + + if ( $a ) { + $op = $this->MatchReg( '/\\G(?:>=|<=|=<|[<=>])/' ); + if ( $op ) { + $b = $this->MatchFuncs( array( 'parseAddition','parseEntitiesKeyword','parseEntitiesQuoted' ) ); + if ( $b ) { + $c = $this->NewObj5( 'Less_Tree_Condition', array( $op[0], $a, $b, $index, $negate ) ); + } else { + $this->Error( 'Unexpected expression' ); + } + } else { + $k = $this->NewObj1( 'Less_Tree_Keyword', 'true' ); + $c = $this->NewObj5( 'Less_Tree_Condition', array( '=', $a, $k, $index, $negate ) ); + } + $this->expectChar( ')' ); + return $this->MatchReg( '/\\Gand/' ) ? $this->NewObj3( 'Less_Tree_Condition', array( 'and', $c, $this->parseCondition() ) ) : $c; + } + } + + /** + * An operand is anything that can be part of an operation, + * such as a Color, or a Variable + * + */ + private function parseOperand() { + $negate = false; + $offset = $this->pos + 1; + if ( $offset >= $this->input_len ) { + return; + } + $char = $this->input[$offset]; + if ( $char === '@' || $char === '(' ) { + $negate = $this->MatchChar( '-' ); + } + + $o = $this->MatchFuncs( array( 'parseSub','parseEntitiesDimension','parseEntitiesColor','parseEntitiesVariable','parseEntitiesCall' ) ); + + if ( $negate ) { + $o->parensInOp = true; + $o = $this->NewObj1( 'Less_Tree_Negative', $o ); + } + + return $o; + } + + /** + * Expressions either represent mathematical operations, + * or white-space delimited Entities. + * + * 1px solid black + * @var * 2 + * + * @return Less_Tree_Expression|null + */ + private function parseExpression() { + $entities = array(); + + do{ + $e = $this->MatchFuncs( array( 'parseAddition','parseEntity' ) ); + if ( $e ) { + $entities[] = $e; + // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here + if ( !$this->PeekReg( '/\\G\/[\/*]/' ) ) { + $delim = $this->MatchChar( '/' ); + if ( $delim ) { + $entities[] = $this->NewObj1( 'Less_Tree_Anonymous', $delim ); + } + } + } + }while ( $e ); + + if ( $entities ) { + return $this->NewObj1( 'Less_Tree_Expression', $entities ); + } + } + + /** + * Parse a property + * eg: 'min-width', 'orientation', etc + * + * @return string + */ + private function parseProperty() { + $name = $this->MatchReg( '/\\G(\*?-?[_a-zA-Z0-9-]+)\s*:/' ); + if ( $name ) { + return $name[1]; + } + } + + /** + * Parse a rule property + * eg: 'color', 'width', 'height', etc + * + * @return string + */ + private function parseRuleProperty() { + $offset = $this->pos; + $name = array(); + $index = array(); + $length = 0; + + $this->rulePropertyMatch( '/\\G(\*?)/', $offset, $length, $index, $name ); + while ( $this->rulePropertyMatch( '/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $offset, $length, $index, $name ) ); // ! + + if ( ( count( $name ) > 1 ) && $this->rulePropertyMatch( '/\\G\s*((?:\+_|\+)?)\s*:/', $offset, $length, $index, $name ) ) { + // at last, we have the complete match now. move forward, + // convert name particles to tree objects and return: + $this->skipWhitespace( $length ); + + if ( $name[0] === '' ) { + array_shift( $name ); + array_shift( $index ); + } + foreach ( $name as $k => $s ) { + if ( !$s || $s[0] !== '@' ) { + $name[$k] = $this->NewObj1( 'Less_Tree_Keyword', $s ); + } else { + $name[$k] = $this->NewObj3( 'Less_Tree_Variable', array( '@' . substr( $s, 2, -1 ), $index[$k], $this->env->currentFileInfo ) ); + } + } + return $name; + } + + } + + private function rulePropertyMatch( $re, &$offset, &$length, &$index, &$name ) { + preg_match( $re, $this->input, $a, 0, $offset ); + if ( $a ) { + $index[] = $this->pos + $length; + $length += strlen( $a[0] ); + $offset += strlen( $a[0] ); + $name[] = $a[1]; + return true; + } + } + + public static function serializeVars( $vars ) { + $s = ''; + + foreach ( $vars as $name => $value ) { + $s .= ( ( $name[0] === '@' ) ? '' : '@' ) . $name .': '. $value . ( ( substr( $value, -1 ) === ';' ) ? '' : ';' ); + } + + return $s; + } + + /** + * Some versions of php have trouble with method_exists($a,$b) if $a is not an object + * + * @param string $b + */ + public static function is_method( $a, $b ) { + return is_object( $a ) && method_exists( $a, $b ); + } + + /** + * Round numbers similarly to javascript + * eg: 1.499999 to 1 instead of 2 + * + */ + public static function round( $i, $precision = 0 ) { + $precision = pow( 10, $precision ); + $i = $i * $precision; + + $ceil = ceil( $i ); + $floor = floor( $i ); + if ( ( $ceil - $i ) <= ( $i - $floor ) ) { + return $ceil / $precision; + } else { + return $floor / $precision; + } + } + + /** + * Create Less_Tree_* objects and optionally generate a cache string + * + * @return mixed + */ + public function NewObj0( $class ) { + $obj = new $class(); + if ( $this->CacheEnabled() ) { + $obj->cache_string = ' new '.$class.'()'; + } + return $obj; + } + + public function NewObj1( $class, $arg ) { + $obj = new $class( $arg ); + if ( $this->CacheEnabled() ) { + $obj->cache_string = ' new '.$class.'('.Less_Parser::ArgString( $arg ).')'; + } + return $obj; + } + + public function NewObj2( $class, $args ) { + $obj = new $class( $args[0], $args[1] ); + if ( $this->CacheEnabled() ) { + $this->ObjCache( $obj, $class, $args ); + } + return $obj; + } + + public function NewObj3( $class, $args ) { + $obj = new $class( $args[0], $args[1], $args[2] ); + if ( $this->CacheEnabled() ) { + $this->ObjCache( $obj, $class, $args ); + } + return $obj; + } + + public function NewObj4( $class, $args ) { + $obj = new $class( $args[0], $args[1], $args[2], $args[3] ); + if ( $this->CacheEnabled() ) { + $this->ObjCache( $obj, $class, $args ); + } + return $obj; + } + + public function NewObj5( $class, $args ) { + $obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4] ); + if ( $this->CacheEnabled() ) { + $this->ObjCache( $obj, $class, $args ); + } + return $obj; + } + + public function NewObj6( $class, $args ) { + $obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5] ); + if ( $this->CacheEnabled() ) { + $this->ObjCache( $obj, $class, $args ); + } + return $obj; + } + + public function NewObj7( $class, $args ) { + $obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6] ); + if ( $this->CacheEnabled() ) { + $this->ObjCache( $obj, $class, $args ); + } + return $obj; + } + + // caching + public function ObjCache( $obj, $class, $args = array() ) { + $obj->cache_string = ' new '.$class.'('. self::ArgCache( $args ).')'; + } + + public function ArgCache( $args ) { + return implode( ',', array_map( array( 'Less_Parser','ArgString' ), $args ) ); + } + + /** + * Convert an argument to a string for use in the parser cache + * + * @return string + */ + public static function ArgString( $arg ) { + $type = gettype( $arg ); + + if ( $type === 'object' ) { + $string = $arg->cache_string; + unset( $arg->cache_string ); + return $string; + + } elseif ( $type === 'array' ) { + $string = ' Array('; + foreach ( $arg as $k => $a ) { + $string .= var_export( $k, true ).' => '.self::ArgString( $a ).','; + } + return $string . ')'; + } + + return var_export( $arg, true ); + } + + public function Error( $msg ) { + throw new Less_Exception_Parser( $msg, null, $this->furthest, $this->env->currentFileInfo ); + } + + public static function WinPath( $path ) { + return str_replace( '\\', '/', $path ); + } + + public static function AbsPath( $path, $winPath = false ) { + if ( strpos( $path, '//' ) !== false && preg_match( '_^(https?:)?//\\w+(\\.\\w+)+/\\w+_i', $path ) ) { + return $winPath ? '' : false; + } else { + $path = realpath( $path ); + if ( $winPath ) { + $path = self::WinPath( $path ); + } + return $path; + } + } + + public function CacheEnabled() { + return ( Less_Parser::$options['cache_method'] && ( Less_Cache::$cache_dir || ( Less_Parser::$options['cache_method'] == 'callback' ) ) ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php b/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php new file mode 100755 index 0000000..989a4ce --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php @@ -0,0 +1,187 @@ + 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, + 'H' => 7,'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, + 'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20, + 'V' => 21, 'W' => 22, 'X' => 23, 'Y' => 24, 'Z' => 25, 'a' => 26, 'b' => 27, + 'c' => 28, 'd' => 29, 'e' => 30, 'f' => 31, 'g' => 32, 'h' => 33, 'i' => 34, + 'j' => 35, 'k' => 36, 'l' => 37, 'm' => 38, 'n' => 39, 'o' => 40, 'p' => 41, + 'q' => 42, 'r' => 43, 's' => 44, 't' => 45, 'u' => 46, 'v' => 47, 'w' => 48, + 'x' => 49, 'y' => 50, 'z' => 51, 0 => 52, 1 => 53, 2 => 54, 3 => 55, 4 => 56, + 5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63, + ); + + /** + * Integer to char map + * + * @var array + */ + private $intToCharMap = array( + 0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', 4 => 'E', 5 => 'F', 6 => 'G', + 7 => 'H', 8 => 'I', 9 => 'J', 10 => 'K', 11 => 'L', 12 => 'M', 13 => 'N', + 14 => 'O', 15 => 'P', 16 => 'Q', 17 => 'R', 18 => 'S', 19 => 'T', 20 => 'U', + 21 => 'V', 22 => 'W', 23 => 'X', 24 => 'Y', 25 => 'Z', 26 => 'a', 27 => 'b', + 28 => 'c', 29 => 'd', 30 => 'e', 31 => 'f', 32 => 'g', 33 => 'h', 34 => 'i', + 35 => 'j', 36 => 'k', 37 => 'l', 38 => 'm', 39 => 'n', 40 => 'o', 41 => 'p', + 42 => 'q', 43 => 'r', 44 => 's', 45 => 't', 46 => 'u', 47 => 'v', 48 => 'w', + 49 => 'x', 50 => 'y', 51 => 'z', 52 => '0', 53 => '1', 54 => '2', 55 => '3', + 56 => '4', 57 => '5', 58 => '6', 59 => '7', 60 => '8', 61 => '9', 62 => '+', + 63 => '/', + ); + + /** + * Constructor + */ + public function __construct() { + // I leave it here for future reference + // foreach(str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/') as $i => $char) + // { + // $this->charToIntMap[$char] = $i; + // $this->intToCharMap[$i] = $char; + // } + } + + /** + * Convert from a two-complement value to a value where the sign bit is + * is placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + * We generate the value for 32 bit machines, hence -2147483648 becomes 1, not 4294967297, + * even on a 64 bit machine. + * @param string $aValue + */ + public function toVLQSigned( $aValue ) { + return 0xffffffff & ( $aValue < 0 ? ( ( -$aValue ) << 1 ) + 1 : ( $aValue << 1 ) + 0 ); + } + + /** + * Convert to a two-complement value from a value where the sign bit is + * is placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + * We assume that the value was generated with a 32 bit machine in mind. + * Hence + * 1 becomes -2147483648 + * even on a 64 bit machine. + * @param integer $aValue + */ + public function fromVLQSigned( $aValue ) { + return $aValue & 1 ? $this->zeroFill( ~$aValue + 2, 1 ) | ( -1 - 0x7fffffff ) : $this->zeroFill( $aValue, 1 ); + } + + /** + * Return the base 64 VLQ encoded value. + * + * @param string $aValue The value to encode + * @return string The encoded value + */ + public function encode( $aValue ) { + $encoded = ''; + $vlq = $this->toVLQSigned( $aValue ); + do + { + $digit = $vlq & $this->mask; + $vlq = $this->zeroFill( $vlq, $this->shift ); + if ( $vlq > 0 ) { + $digit |= $this->continuationBit; + } + $encoded .= $this->base64Encode( $digit ); + } while ( $vlq > 0 ); + + return $encoded; + } + + /** + * Return the value decoded from base 64 VLQ. + * + * @param string $encoded The encoded value to decode + * @return integer The decoded value + */ + public function decode( $encoded ) { + $vlq = 0; + $i = 0; + do + { + $digit = $this->base64Decode( $encoded[$i] ); + $vlq |= ( $digit & $this->mask ) << ( $i * $this->shift ); + $i++; + } while ( $digit & $this->continuationBit ); + + return $this->fromVLQSigned( $vlq ); + } + + /** + * Right shift with zero fill. + * + * @param integer $a number to shift + * @param integer $b number of bits to shift + * @return integer + */ + public function zeroFill( $a, $b ) { + return ( $a >= 0 ) ? ( $a >> $b ) : ( $a >> $b ) & ( PHP_INT_MAX >> ( $b - 1 ) ); + } + + /** + * Encode single 6-bit digit as base64. + * + * @param integer $number + * @return string + * @throws Exception If the number is invalid + */ + public function base64Encode( $number ) { + if ( $number < 0 || $number > 63 ) { + throw new Exception( sprintf( 'Invalid number "%s" given. Must be between 0 and 63.', $number ) ); + } + return $this->intToCharMap[$number]; + } + + /** + * Decode single 6-bit digit from base64 + * + * @param string $char + * @return number + * @throws Exception If the number is invalid + */ + public function base64Decode( $char ) { + if ( !array_key_exists( $char, $this->charToIntMap ) ) { + throw new Exception( sprintf( 'Invalid base 64 digit "%s" given.', $char ) ); + } + return $this->charToIntMap[$char]; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php b/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php new file mode 100755 index 0000000..eded501 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php @@ -0,0 +1,354 @@ + '', + + // an optional name of the generated code that this source map is associated with. + 'sourceMapFilename' => null, + + // url of the map + 'sourceMapURL' => null, + + // absolute path to a file to write the map to + 'sourceMapWriteTo' => null, + + // output source contents? + 'outputSourceFiles' => false, + + // base path for filename normalization + 'sourceMapRootpath' => '', + + // base path for filename normalization + 'sourceMapBasepath' => '' + ); + + /** + * The base64 VLQ encoder + * + * @var Less_SourceMap_Base64VLQ + */ + protected $encoder; + + /** + * Array of mappings + * + * @var array + */ + protected $mappings = array(); + + /** + * The root node + * + * @var Less_Tree_Ruleset + */ + protected $root; + + /** + * Array of contents map + * + * @var array + */ + protected $contentsMap = array(); + + /** + * File to content map + * + * @var array + */ + protected $sources = array(); + protected $source_keys = array(); + + /** + * Constructor + * + * @param Less_Tree_Ruleset $root The root node + * @param array $options Array of options + */ + public function __construct( Less_Tree_Ruleset $root, $contentsMap, $options = array() ) { + $this->root = $root; + $this->contentsMap = $contentsMap; + $this->encoder = new Less_SourceMap_Base64VLQ(); + + $this->SetOptions( $options ); + + $this->options['sourceMapRootpath'] = $this->fixWindowsPath( $this->options['sourceMapRootpath'], true ); + $this->options['sourceMapBasepath'] = $this->fixWindowsPath( $this->options['sourceMapBasepath'], true ); + } + + /** + * Generates the CSS + * + * @return string + */ + public function generateCSS() { + $output = new Less_Output_Mapped( $this->contentsMap, $this ); + + // catch the output + $this->root->genCSS( $output ); + + $sourceMapUrl = $this->getOption( 'sourceMapURL' ); + $sourceMapFilename = $this->getOption( 'sourceMapFilename' ); + $sourceMapContent = $this->generateJson(); + $sourceMapWriteTo = $this->getOption( 'sourceMapWriteTo' ); + + if ( !$sourceMapUrl && $sourceMapFilename ) { + $sourceMapUrl = $this->normalizeFilename( $sourceMapFilename ); + } + + // write map to a file + if ( $sourceMapWriteTo ) { + $this->saveMap( $sourceMapWriteTo, $sourceMapContent ); + } + + // inline the map + if ( !$sourceMapUrl ) { + $sourceMapUrl = sprintf( 'data:application/json,%s', Less_Functions::encodeURIComponent( $sourceMapContent ) ); + } + + if ( $sourceMapUrl ) { + $output->add( sprintf( '/*# sourceMappingURL=%s */', $sourceMapUrl ) ); + } + + return $output->toString(); + } + + /** + * Saves the source map to a file + * + * @param string $file The absolute path to a file + * @param string $content The content to write + * @throws Exception If the file could not be saved + */ + protected function saveMap( $file, $content ) { + $dir = dirname( $file ); + // directory does not exist + if ( !is_dir( $dir ) ) { + // FIXME: create the dir automatically? + throw new Exception( sprintf( 'The directory "%s" does not exist. Cannot save the source map.', $dir ) ); + } + // FIXME: proper saving, with dir write check! + if ( file_put_contents( $file, $content ) === false ) { + throw new Exception( sprintf( 'Cannot save the source map to "%s"', $file ) ); + } + return true; + } + + /** + * Normalizes the filename + * + * @param string $filename + * @return string + */ + protected function normalizeFilename( $filename ) { + $filename = $this->fixWindowsPath( $filename ); + + $rootpath = $this->getOption( 'sourceMapRootpath' ); + $basePath = $this->getOption( 'sourceMapBasepath' ); + + // "Trim" the 'sourceMapBasepath' from the output filename. + if ( is_string( $basePath ) && strpos( $filename, $basePath ) === 0 ) { + $filename = substr( $filename, strlen( $basePath ) ); + } + + // Remove extra leading path separators. + if ( strpos( $filename, '\\' ) === 0 || strpos( $filename, '/' ) === 0 ) { + $filename = substr( $filename, 1 ); + } + + return $rootpath . $filename; + } + + /** + * Adds a mapping + * + * @param integer $generatedLine The line number in generated file + * @param integer $generatedColumn The column number in generated file + * @param integer $originalLine The line number in original file + * @param integer $originalColumn The column number in original file + * @param string $sourceFile The original source file + */ + public function addMapping( $generatedLine, $generatedColumn, $originalLine, $originalColumn, $fileInfo ) { + $this->mappings[] = array( + 'generated_line' => $generatedLine, + 'generated_column' => $generatedColumn, + 'original_line' => $originalLine, + 'original_column' => $originalColumn, + 'source_file' => $fileInfo['currentUri'] + ); + + $this->sources[$fileInfo['currentUri']] = $fileInfo['filename']; + } + + /** + * Generates the JSON source map + * + * @return string + * @see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit# + */ + protected function generateJson() { + $sourceMap = array(); + $mappings = $this->generateMappings(); + + // File version (always the first entry in the object) and must be a positive integer. + $sourceMap['version'] = self::VERSION; + + // An optional name of the generated code that this source map is associated with. + $file = $this->getOption( 'sourceMapFilename' ); + if ( $file ) { + $sourceMap['file'] = $file; + } + + // An optional source root, useful for relocating source files on a server or removing repeated values in the 'sources' entry. This value is prepended to the individual entries in the 'source' field. + $root = $this->getOption( 'sourceRoot' ); + if ( $root ) { + $sourceMap['sourceRoot'] = $root; + } + + // A list of original sources used by the 'mappings' entry. + $sourceMap['sources'] = array(); + foreach ( $this->sources as $source_uri => $source_filename ) { + $sourceMap['sources'][] = $this->normalizeFilename( $source_filename ); + } + + // A list of symbol names used by the 'mappings' entry. + $sourceMap['names'] = array(); + + // A string with the encoded mapping data. + $sourceMap['mappings'] = $mappings; + + if ( $this->getOption( 'outputSourceFiles' ) ) { + // An optional list of source content, useful when the 'source' can't be hosted. + // The contents are listed in the same order as the sources above. + // 'null' may be used if some original sources should be retrieved by name. + $sourceMap['sourcesContent'] = $this->getSourcesContent(); + } + + // less.js compat fixes + if ( count( $sourceMap['sources'] ) && empty( $sourceMap['sourceRoot'] ) ) { + unset( $sourceMap['sourceRoot'] ); + } + + return json_encode( $sourceMap ); + } + + /** + * Returns the sources contents + * + * @return array|null + */ + protected function getSourcesContent() { + if ( empty( $this->sources ) ) { + return; + } + $content = array(); + foreach ( $this->sources as $sourceFile ) { + $content[] = file_get_contents( $sourceFile ); + } + return $content; + } + + /** + * Generates the mappings string + * + * @return string + */ + public function generateMappings() { + if ( !count( $this->mappings ) ) { + return ''; + } + + $this->source_keys = array_flip( array_keys( $this->sources ) ); + + // group mappings by generated line number. + $groupedMap = $groupedMapEncoded = array(); + foreach ( $this->mappings as $m ) { + $groupedMap[$m['generated_line']][] = $m; + } + ksort( $groupedMap ); + + $lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0; + + foreach ( $groupedMap as $lineNumber => $line_map ) { + while ( ++$lastGeneratedLine < $lineNumber ) { + $groupedMapEncoded[] = ';'; + } + + $lineMapEncoded = array(); + $lastGeneratedColumn = 0; + + foreach ( $line_map as $m ) { + $mapEncoded = $this->encoder->encode( $m['generated_column'] - $lastGeneratedColumn ); + $lastGeneratedColumn = $m['generated_column']; + + // find the index + if ( $m['source_file'] ) { + $index = $this->findFileIndex( $m['source_file'] ); + if ( $index !== false ) { + $mapEncoded .= $this->encoder->encode( $index - $lastOriginalIndex ); + $lastOriginalIndex = $index; + + // lines are stored 0-based in SourceMap spec version 3 + $mapEncoded .= $this->encoder->encode( $m['original_line'] - 1 - $lastOriginalLine ); + $lastOriginalLine = $m['original_line'] - 1; + + $mapEncoded .= $this->encoder->encode( $m['original_column'] - $lastOriginalColumn ); + $lastOriginalColumn = $m['original_column']; + } + } + + $lineMapEncoded[] = $mapEncoded; + } + + $groupedMapEncoded[] = implode( ',', $lineMapEncoded ) . ';'; + } + + return rtrim( implode( $groupedMapEncoded ), ';' ); + } + + /** + * Finds the index for the filename + * + * @param string $filename + * @return integer|false + */ + protected function findFileIndex( $filename ) { + return $this->source_keys[$filename]; + } + + /** + * fix windows paths + * @param string $path + * @return string + */ + public function fixWindowsPath( $path, $addEndSlash = false ) { + $slash = ( $addEndSlash ) ? '/' : ''; + if ( !empty( $path ) ) { + $path = str_replace( '\\', '/', $path ); + $path = rtrim( $path, '/' ) . $slash; + } + + return $path; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree.php b/vendor/wikimedia/less.php/lib/Less/Tree.php new file mode 100755 index 0000000..7b48e9a --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree.php @@ -0,0 +1,84 @@ +genCSS( $output ); + return $output->toString(); + } + + /** + * Generate CSS by adding it to the output object + * + * @param Less_Output $output The output + * @return void + */ + public function genCSS( $output ) { + } + + /** + * @param Less_Tree_Ruleset[] $rules + */ + public static function outputRuleset( $output, $rules ) { + $ruleCnt = count( $rules ); + Less_Environment::$tabLevel++; + + // Compressed + if ( Less_Parser::$options['compress'] ) { + $output->add( '{' ); + for ( $i = 0; $i < $ruleCnt; $i++ ) { + $rules[$i]->genCSS( $output ); + } + + $output->add( '}' ); + Less_Environment::$tabLevel--; + return; + } + + // Non-compressed + $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel - 1 ); + $tabRuleStr = $tabSetStr.Less_Parser::$options['indentation']; + + $output->add( " {" ); + for ( $i = 0; $i < $ruleCnt; $i++ ) { + $output->add( $tabRuleStr ); + $rules[$i]->genCSS( $output ); + } + Less_Environment::$tabLevel--; + $output->add( $tabSetStr.'}' ); + + } + + public function accept( $visitor ) { + } + + public static function ReferencedArray( $rules ) { + foreach ( $rules as $rule ) { + if ( method_exists( $rule, 'markReferenced' ) ) { + $rule->markReferenced(); + } + } + } + + /** + * Requires php 5.3+ + */ + public static function __set_state( $args ) { + $class = get_called_class(); + $obj = new $class( null, null, null, null ); + foreach ( $args as $key => $val ) { + $obj->$key = $val; + } + return $obj; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php b/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php new file mode 100755 index 0000000..cd38c91 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php @@ -0,0 +1,48 @@ +value = $val; + } + + // function accept( $visitor ){ + // $this->value = $visitor->visit( $this->value ); + //} + + public function compile( $env ) { + if ( is_object( $this->value ) ) { + $this->value = $this->value->compile( $env ); + } + + return $this; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( "alpha(opacity=" ); + + if ( is_string( $this->value ) ) { + $output->add( $this->value ); + } else { + $this->value->genCSS( $output ); + } + + $output->add( ')' ); + } + + public function toCSS() { + return "alpha(opacity=" . ( is_string( $this->value ) ? $this->value : $this->value->toCSS() ) . ")"; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php b/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php new file mode 100755 index 0000000..1dc9bab --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php @@ -0,0 +1,58 @@ +value = $value; + $this->index = $index; + $this->mapLines = $mapLines; + $this->currentFileInfo = $currentFileInfo; + } + + public function compile() { + return new Less_Tree_Anonymous( $this->value, $this->index, $this->currentFileInfo, $this->mapLines ); + } + + public function compare( $x ) { + if ( !is_object( $x ) ) { + return -1; + } + + $left = $this->toCSS(); + $right = $x->toCSS(); + + if ( $left === $right ) { + return 0; + } + + return $left < $right ? -1 : 1; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines ); + } + + public function toCSS() { + return $this->value; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php b/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php new file mode 100755 index 0000000..69c7a4e --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php @@ -0,0 +1,39 @@ +key = $key; + $this->value = $val; + } + + public function accept( $visitor ) { + $this->value = $visitor->visitObj( $this->value ); + } + + public function compile( $env ) { + return new Less_Tree_Assignment( $this->key, $this->value->compile( $env ) ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->key . '=' ); + $this->value->genCSS( $output ); + } + + public function toCss() { + return $this->key . '=' . $this->value->toCSS(); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php b/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php new file mode 100755 index 0000000..c47abb9 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php @@ -0,0 +1,53 @@ +key = $key; + $this->op = $op; + $this->value = $value; + } + + public function compile( $env ) { + $key_obj = is_object( $this->key ); + $val_obj = is_object( $this->value ); + + if ( !$key_obj && !$val_obj ) { + return $this; + } + + return new Less_Tree_Attribute( + $key_obj ? $this->key->compile( $env ) : $this->key, + $this->op, + $val_obj ? $this->value->compile( $env ) : $this->value ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->toCSS() ); + } + + public function toCSS() { + $value = $this->key; + + if ( $this->op ) { + $value .= $this->op; + $value .= ( is_object( $this->value ) ? $this->value->toCSS() : $this->value ); + } + + return '[' . $value . ']'; + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Call.php b/vendor/wikimedia/less.php/lib/Less/Tree/Call.php new file mode 100755 index 0000000..5341b74 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Call.php @@ -0,0 +1,117 @@ +name = $name; + $this->args = $args; + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + } + + public function accept( $visitor ) { + $this->args = $visitor->visitArray( $this->args ); + } + + // + // When evaluating a function call, + // we either find the function in `tree.functions` [1], + // in which case we call it, passing the evaluated arguments, + // or we simply print it out as it appeared originally [2]. + // + // The *functions.js* file contains the built-in functions. + // + // The reason why we evaluate the arguments, is in the case where + // we try to pass a variable to a function, like: `saturate(@color)`. + // The function should receive the value, not the variable. + // + public function compile( $env = null ) { + $args = array(); + foreach ( $this->args as $a ) { + $args[] = $a->compile( $env ); + } + + $nameLC = strtolower( $this->name ); + switch ( $nameLC ) { + case '%': + $nameLC = '_percent'; + break; + + case 'get-unit': + $nameLC = 'getunit'; + break; + + case 'data-uri': + $nameLC = 'datauri'; + break; + + case 'svg-gradient': + $nameLC = 'svggradient'; + break; + } + + $result = null; + if ( $nameLC === 'default' ) { + $result = Less_Tree_DefaultFunc::compile(); + + } else { + + if ( method_exists( 'Less_Functions', $nameLC ) ) { // 1. + try { + + $func = new Less_Functions( $env, $this->currentFileInfo ); + $result = call_user_func_array( array( $func,$nameLC ), $args ); + + } catch ( Exception $e ) { + throw new Less_Exception_Compiler( 'error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index ); + } + } elseif ( isset( $env->functions[$nameLC] ) && is_callable( $env->functions[$nameLC] ) ) { + try { + $result = call_user_func_array( $env->functions[$nameLC], $args ); + } catch ( Exception $e ) { + throw new Less_Exception_Compiler( 'error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index ); + } + } + } + + if ( $result !== null ) { + return $result; + } + + return new Less_Tree_Call( $this->name, $args, $this->index, $this->currentFileInfo ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->name . '(', $this->currentFileInfo, $this->index ); + $args_len = count( $this->args ); + for ( $i = 0; $i < $args_len; $i++ ) { + $this->args[$i]->genCSS( $output ); + if ( $i + 1 < $args_len ) { + $output->add( ', ' ); + } + } + + $output->add( ')' ); + } + + // public function toCSS(){ + // return $this->compile()->toCSS(); + //} + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Color.php b/vendor/wikimedia/less.php/lib/Less/Tree/Color.php new file mode 100755 index 0000000..b0f79db --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Color.php @@ -0,0 +1,230 @@ +rgb = $rgb; + $this->alpha = $a; + $this->isTransparentKeyword = true; + return; + } + + $this->rgb = array(); + if ( is_array( $rgb ) ) { + $this->rgb = $rgb; + } else if ( strlen( $rgb ) == 6 ) { + foreach ( str_split( $rgb, 2 ) as $c ) { + $this->rgb[] = hexdec( $c ); + } + } else { + foreach ( str_split( $rgb, 1 ) as $c ) { + $this->rgb[] = hexdec( $c.$c ); + } + } + $this->alpha = is_numeric( $a ) ? $a : 1; + } + + public function compile() { + return $this; + } + + public function luma() { + $r = $this->rgb[0] / 255; + $g = $this->rgb[1] / 255; + $b = $this->rgb[2] / 255; + + $r = ( $r <= 0.03928 ) ? $r / 12.92 : pow( ( ( $r + 0.055 ) / 1.055 ), 2.4 ); + $g = ( $g <= 0.03928 ) ? $g / 12.92 : pow( ( ( $g + 0.055 ) / 1.055 ), 2.4 ); + $b = ( $b <= 0.03928 ) ? $b / 12.92 : pow( ( ( $b + 0.055 ) / 1.055 ), 2.4 ); + + return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->toCSS() ); + } + + public function toCSS( $doNotCompress = false ) { + $compress = Less_Parser::$options['compress'] && !$doNotCompress; + $alpha = Less_Functions::fround( $this->alpha ); + + // + // If we have some transparency, the only way to represent it + // is via `rgba`. Otherwise, we use the hex representation, + // which has better compatibility with older browsers. + // Values are capped between `0` and `255`, rounded and zero-padded. + // + if ( $alpha < 1 ) { + if ( ( $alpha === 0 || $alpha === 0.0 ) && isset( $this->isTransparentKeyword ) && $this->isTransparentKeyword ) { + return 'transparent'; + } + + $values = array(); + foreach ( $this->rgb as $c ) { + $values[] = Less_Functions::clamp( round( $c ), 255 ); + } + $values[] = $alpha; + + $glue = ( $compress ? ',' : ', ' ); + return "rgba(" . implode( $glue, $values ) . ")"; + } else { + + $color = $this->toRGB(); + + if ( $compress ) { + + // Convert color to short format + if ( $color[1] === $color[2] && $color[3] === $color[4] && $color[5] === $color[6] ) { + $color = '#'.$color[1] . $color[3] . $color[5]; + } + } + + return $color; + } + } + + // + // Operations have to be done per-channel, if not, + // channels will spill onto each other. Once we have + // our result, in the form of an integer triplet, + // we create a new Color node to hold the result. + // + + /** + * @param string $op + */ + public function operate( $op, $other ) { + $rgb = array(); + $alpha = $this->alpha * ( 1 - $other->alpha ) + $other->alpha; + for ( $c = 0; $c < 3; $c++ ) { + $rgb[$c] = Less_Functions::operate( $op, $this->rgb[$c], $other->rgb[$c] ); + } + return new Less_Tree_Color( $rgb, $alpha ); + } + + public function toRGB() { + return $this->toHex( $this->rgb ); + } + + public function toHSL() { + $r = $this->rgb[0] / 255; + $g = $this->rgb[1] / 255; + $b = $this->rgb[2] / 255; + $a = $this->alpha; + + $max = max( $r, $g, $b ); + $min = min( $r, $g, $b ); + $l = ( $max + $min ) / 2; + $d = $max - $min; + + $h = $s = 0; + if ( $max !== $min ) { + $s = $l > 0.5 ? $d / ( 2 - $max - $min ) : $d / ( $max + $min ); + + switch ( $max ) { + case $r: $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 ); +break; + case $g: $h = ( $b - $r ) / $d + 2; +break; + case $b: $h = ( $r - $g ) / $d + 4; +break; + } + $h /= 6; + } + return array( 'h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a ); + } + + // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + public function toHSV() { + $r = $this->rgb[0] / 255; + $g = $this->rgb[1] / 255; + $b = $this->rgb[2] / 255; + $a = $this->alpha; + + $max = max( $r, $g, $b ); + $min = min( $r, $g, $b ); + + $v = $max; + + $d = $max - $min; + if ( $max === 0 ) { + $s = 0; + } else { + $s = $d / $max; + } + + $h = 0; + if ( $max !== $min ) { + switch ( $max ) { + case $r: $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 ); +break; + case $g: $h = ( $b - $r ) / $d + 2; +break; + case $b: $h = ( $r - $g ) / $d + 4; +break; + } + $h /= 6; + } + return array( 'h' => $h * 360, 's' => $s, 'v' => $v, 'a' => $a ); + } + + public function toARGB() { + $argb = array_merge( (array)Less_Parser::round( $this->alpha * 255 ), $this->rgb ); + return $this->toHex( $argb ); + } + + public function compare( $x ) { + if ( !property_exists( $x, 'rgb' ) ) { + return -1; + } + + return ( $x->rgb[0] === $this->rgb[0] && + $x->rgb[1] === $this->rgb[1] && + $x->rgb[2] === $this->rgb[2] && + $x->alpha === $this->alpha ) ? 0 : -1; + } + + public function toHex( $v ) { + $ret = '#'; + foreach ( $v as $c ) { + $c = Less_Functions::clamp( Less_Parser::round( $c ), 255 ); + if ( $c < 16 ) { + $ret .= '0'; + } + $ret .= dechex( $c ); + } + + return $ret; + } + + /** + * @param string $keyword + */ + public static function fromKeyword( $keyword ) { + $keyword = strtolower( $keyword ); + + if ( Less_Colors::hasOwnProperty( $keyword ) ) { + // detect named color + return new Less_Tree_Color( substr( Less_Colors::color( $keyword ), 1 ) ); + } + + if ( $keyword === 'transparent' ) { + return new Less_Tree_Color( array( 0, 0, 0 ), 0, true ); + } + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php b/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php new file mode 100755 index 0000000..c7e6c0f --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php @@ -0,0 +1,51 @@ +value = $value; + $this->silent = !!$silent; + $this->currentFileInfo = $currentFileInfo; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + // if( $this->debugInfo ){ + //$output->add( tree.debugInfo($env, $this), $this->currentFileInfo, $this->index); + //} + $output->add( trim( $this->value ) );// TODO shouldn't need to trim, we shouldn't grab the \n + } + + public function toCSS() { + return Less_Parser::$options['compress'] ? '' : $this->value; + } + + public function isSilent() { + $isReference = ( $this->currentFileInfo && isset( $this->currentFileInfo['reference'] ) && ( !isset( $this->isReferenced ) || !$this->isReferenced ) ); + $isCompressed = Less_Parser::$options['compress'] && !preg_match( '/^\/\*!/', $this->value ); + return $this->silent || $isReference || $isCompressed; + } + + public function compile() { + return $this; + } + + public function markReferenced() { + $this->isReferenced = true; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php b/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php new file mode 100755 index 0000000..355de8c --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php @@ -0,0 +1,72 @@ +op = trim( $op ); + $this->lvalue = $l; + $this->rvalue = $r; + $this->index = $i; + $this->negate = $negate; + } + + public function accept( $visitor ) { + $this->lvalue = $visitor->visitObj( $this->lvalue ); + $this->rvalue = $visitor->visitObj( $this->rvalue ); + } + + public function compile( $env ) { + $a = $this->lvalue->compile( $env ); + $b = $this->rvalue->compile( $env ); + + switch ( $this->op ) { + case 'and': + $result = $a && $b; + break; + + case 'or': + $result = $a || $b; + break; + + default: + if ( Less_Parser::is_method( $a, 'compare' ) ) { + $result = $a->compare( $b ); + } elseif ( Less_Parser::is_method( $b, 'compare' ) ) { + $result = $b->compare( $a ); + } else { + throw new Less_Exception_Compiler( 'Unable to perform comparison', null, $this->index ); + } + + switch ( $result ) { + case -1: + $result = $this->op === '<' || $this->op === '=<' || $this->op === '<='; + break; + + case 0: + $result = $this->op === '=' || $this->op === '>=' || $this->op === '=<' || $this->op === '<='; + break; + + case 1: + $result = $this->op === '>' || $this->op === '>='; + break; + } + break; + } + + return $this->negate ? !$result : $result; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php b/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php new file mode 100755 index 0000000..41b78b6 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php @@ -0,0 +1,34 @@ +ruleset = $ruleset; + $this->frames = $frames; + } + + public function accept( $visitor ) { + $this->ruleset = $visitor->visitObj( $this->ruleset ); + } + + public function compile( $env ) { + if ( $this->frames ) { + $frames = $this->frames; + } else { + $frames = $env->frames; + } + return new Less_Tree_DetachedRuleset( $this->ruleset, $frames ); + } + + public function callEval( $env ) { + if ( $this->frames ) { + return $this->ruleset->compile( $env->copyEvalEnv( array_merge( $this->frames, $env->frames ) ) ); + } + return $this->ruleset->compile( $env ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php b/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php new file mode 100755 index 0000000..70c71b4 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php @@ -0,0 +1,198 @@ +value = floatval( $value ); + + if ( $unit && ( $unit instanceof Less_Tree_Unit ) ) { + $this->unit = $unit; + } elseif ( $unit ) { + $this->unit = new Less_Tree_Unit( array( $unit ) ); + } else { + $this->unit = new Less_Tree_Unit(); + } + } + + public function accept( $visitor ) { + $this->unit = $visitor->visitObj( $this->unit ); + } + + public function compile() { + return $this; + } + + public function toColor() { + return new Less_Tree_Color( array( $this->value, $this->value, $this->value ) ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( Less_Parser::$options['strictUnits'] && !$this->unit->isSingular() ) { + throw new Less_Exception_Compiler( "Multiple units in dimension. Correct the units or use the unit function. Bad unit: ".$this->unit->toString() ); + } + + $value = Less_Functions::fround( $this->value ); + $strValue = (string)$value; + + if ( $value !== 0 && $value < 0.000001 && $value > -0.000001 ) { + // would be output 1e-6 etc. + $strValue = number_format( $strValue, 10 ); + $strValue = preg_replace( '/\.?0+$/', '', $strValue ); + } + + if ( Less_Parser::$options['compress'] ) { + // Zero values doesn't need a unit + if ( $value === 0 && $this->unit->isLength() ) { + $output->add( $strValue ); + return $strValue; + } + + // Float values doesn't need a leading zero + if ( $value > 0 && $value < 1 && $strValue[0] === '0' ) { + $strValue = substr( $strValue, 1 ); + } + } + + $output->add( $strValue ); + $this->unit->genCSS( $output ); + } + + public function __toString() { + return $this->toCSS(); + } + + // In an operation between two Dimensions, + // we default to the first Dimension's unit, + // so `1px + 2em` will yield `3px`. + + /** + * @param string $op + */ + public function operate( $op, $other ) { + $value = Less_Functions::operate( $op, $this->value, $other->value ); + $unit = clone $this->unit; + + if ( $op === '+' || $op === '-' ) { + + if ( !$unit->numerator && !$unit->denominator ) { + $unit->numerator = $other->unit->numerator; + $unit->denominator = $other->unit->denominator; + } elseif ( !$other->unit->numerator && !$other->unit->denominator ) { + // do nothing + } else { + $other = $other->convertTo( $this->unit->usedUnits() ); + + if ( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ) { + throw new Less_Exception_Compiler( "Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() . "'." ); + } + + $value = Less_Functions::operate( $op, $this->value, $other->value ); + } + } elseif ( $op === '*' ) { + $unit->numerator = array_merge( $unit->numerator, $other->unit->numerator ); + $unit->denominator = array_merge( $unit->denominator, $other->unit->denominator ); + sort( $unit->numerator ); + sort( $unit->denominator ); + $unit->cancel(); + } elseif ( $op === '/' ) { + $unit->numerator = array_merge( $unit->numerator, $other->unit->denominator ); + $unit->denominator = array_merge( $unit->denominator, $other->unit->numerator ); + sort( $unit->numerator ); + sort( $unit->denominator ); + $unit->cancel(); + } + return new Less_Tree_Dimension( $value, $unit ); + } + + public function compare( $other ) { + if ( $other instanceof Less_Tree_Dimension ) { + + if ( $this->unit->isEmpty() || $other->unit->isEmpty() ) { + $a = $this; + $b = $other; + } else { + $a = $this->unify(); + $b = $other->unify(); + if ( $a->unit->compare( $b->unit ) !== 0 ) { + return -1; + } + } + $aValue = $a->value; + $bValue = $b->value; + + if ( $bValue > $aValue ) { + return -1; + } elseif ( $bValue < $aValue ) { + return 1; + } else { + return 0; + } + } else { + return -1; + } + } + + public function unify() { + return $this->convertTo( array( 'length' => 'px', 'duration' => 's', 'angle' => 'rad' ) ); + } + + public function convertTo( $conversions ) { + $value = $this->value; + $unit = clone $this->unit; + + if ( is_string( $conversions ) ) { + $derivedConversions = array(); + foreach ( Less_Tree_UnitConversions::$groups as $i ) { + if ( isset( Less_Tree_UnitConversions::${$i}[$conversions] ) ) { + $derivedConversions = array( $i => $conversions ); + } + } + $conversions = $derivedConversions; + } + + foreach ( $conversions as $groupName => $targetUnit ) { + $group = Less_Tree_UnitConversions::${$groupName}; + + // numerator + foreach ( $unit->numerator as $i => $atomicUnit ) { + $atomicUnit = $unit->numerator[$i]; + if ( !isset( $group[$atomicUnit] ) ) { + continue; + } + + $value = $value * ( $group[$atomicUnit] / $group[$targetUnit] ); + + $unit->numerator[$i] = $targetUnit; + } + + // denominator + foreach ( $unit->denominator as $i => $atomicUnit ) { + $atomicUnit = $unit->denominator[$i]; + if ( !isset( $group[$atomicUnit] ) ) { + continue; + } + + $value = $value / ( $group[$atomicUnit] / $group[$targetUnit] ); + + $unit->denominator[$i] = $targetUnit; + } + } + + $unit->cancel(); + + return new Less_Tree_Dimension( $value, $unit ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php b/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php new file mode 100755 index 0000000..6c6a94f --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php @@ -0,0 +1,96 @@ +name = $name; + $this->value = $value; + if ( $rules ) { + $this->rules = $rules; + $this->rules->allowImports = true; + } + + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + $this->debugInfo = $debugInfo; + } + + public function accept( $visitor ) { + if ( $this->rules ) { + $this->rules = $visitor->visitObj( $this->rules ); + } + if ( $this->value ) { + $this->value = $visitor->visitObj( $this->value ); + } + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $value = $this->value; + $rules = $this->rules; + $output->add( $this->name, $this->currentFileInfo, $this->index ); + if ( $this->value ) { + $output->add( ' ' ); + $this->value->genCSS( $output ); + } + if ( $this->rules ) { + Less_Tree::outputRuleset( $output, array( $this->rules ) ); + } else { + $output->add( ';' ); + } + } + + public function compile( $env ) { + $value = $this->value; + $rules = $this->rules; + if ( $value ) { + $value = $value->compile( $env ); + } + + if ( $rules ) { + $rules = $rules->compile( $env ); + $rules->root = true; + } + + return new Less_Tree_Directive( $this->name, $value, $rules, $this->index, $this->currentFileInfo, $this->debugInfo ); + } + + public function variable( $name ) { + if ( $this->rules ) { + return $this->rules->variable( $name ); + } + } + + public function find( $selector ) { + if ( $this->rules ) { + return $this->rules->find( $selector, $this ); + } + } + + // rulesets: function () { if (this.rules) return tree.Ruleset.prototype.rulesets.apply(this.rules); }, + + public function markReferenced() { + $this->isReferenced = true; + if ( $this->rules ) { + Less_Tree::ReferencedArray( $this->rules->rules ); + } + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Element.php b/vendor/wikimedia/less.php/lib/Less/Tree/Element.php new file mode 100755 index 0000000..5e25bc0 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Element.php @@ -0,0 +1,70 @@ +value = $value; + $this->value_is_object = is_object( $value ); + + if ( $combinator ) { + $this->combinator = $combinator; + } + + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + } + + public function accept( $visitor ) { + if ( $this->value_is_object ) { // object or string + $this->value = $visitor->visitObj( $this->value ); + } + } + + public function compile( $env ) { + if ( Less_Environment::$mixin_stack ) { + return new Less_Tree_Element( $this->combinator, ( $this->value_is_object ? $this->value->compile( $env ) : $this->value ), $this->index, $this->currentFileInfo ); + } + + if ( $this->value_is_object ) { + $this->value = $this->value->compile( $env ); + } + + return $this; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->toCSS(), $this->currentFileInfo, $this->index ); + } + + public function toCSS() { + if ( $this->value_is_object ) { + $value = $this->value->toCSS(); + } else { + $value = $this->value; + } + + if ( $value === '' && $this->combinator && $this->combinator === '&' ) { + return ''; + } + + return Less_Environment::$_outputMap[$this->combinator] . $value; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php b/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php new file mode 100755 index 0000000..cf06315 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php @@ -0,0 +1,95 @@ +value = $value; + $this->parens = $parens; + } + + public function accept( $visitor ) { + $this->value = $visitor->visitArray( $this->value ); + } + + public function compile( $env ) { + $doubleParen = false; + + if ( $this->parens && !$this->parensInOp ) { + Less_Environment::$parensStack++; + } + + $returnValue = null; + if ( $this->value ) { + + $count = count( $this->value ); + + if ( $count > 1 ) { + + $ret = array(); + foreach ( $this->value as $e ) { + $ret[] = $e->compile( $env ); + } + $returnValue = new Less_Tree_Expression( $ret ); + + } else { + + if ( ( $this->value[0] instanceof Less_Tree_Expression ) && $this->value[0]->parens && !$this->value[0]->parensInOp ) { + $doubleParen = true; + } + + $returnValue = $this->value[0]->compile( $env ); + } + + } else { + $returnValue = $this; + } + + if ( $this->parens ) { + if ( !$this->parensInOp ) { + Less_Environment::$parensStack--; + + } elseif ( !Less_Environment::isMathOn() && !$doubleParen ) { + $returnValue = new Less_Tree_Paren( $returnValue ); + + } + } + return $returnValue; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $val_len = count( $this->value ); + for ( $i = 0; $i < $val_len; $i++ ) { + $this->value[$i]->genCSS( $output ); + if ( $i + 1 < $val_len ) { + $output->add( ' ' ); + } + } + } + + public function throwAwayComments() { + if ( is_array( $this->value ) ) { + $new_value = array(); + foreach ( $this->value as $v ) { + if ( $v instanceof Less_Tree_Comment ) { + continue; + } + $new_value[] = $v; + } + $this->value = $new_value; + } + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php b/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php new file mode 100755 index 0000000..4dd3665 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php @@ -0,0 +1,80 @@ +selector = $selector; + $this->option = $option; + $this->index = $index; + + switch ( $option ) { + case "all": + $this->allowBefore = true; + $this->allowAfter = true; + break; + default: + $this->allowBefore = false; + $this->allowAfter = false; + break; + } + + // This must use a string (instead of int) so that array_merge() + // preserves keys on arrays that use IDs in their keys. + $this->object_id = 'id_' . $i++; + + $this->parent_ids = array( + $this->object_id => true + ); + } + + public function accept( $visitor ) { + $this->selector = $visitor->visitObj( $this->selector ); + } + + public function compile( $env ) { + Less_Parser::$has_extends = true; + $this->selector = $this->selector->compile( $env ); + return $this; + // return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index); + } + + public function findSelfSelectors( $selectors ) { + $selfElements = array(); + + for ( $i = 0, $selectors_len = count( $selectors ); $i < $selectors_len; $i++ ) { + $selectorElements = $selectors[$i]->elements; + // duplicate the logic in genCSS function inside the selector node. + // future TODO - move both logics into the selector joiner visitor + if ( $i && $selectorElements && $selectorElements[0]->combinator === "" ) { + $selectorElements[0]->combinator = ' '; + } + $selfElements = array_merge( $selfElements, $selectors[$i]->elements ); + } + + $this->selfSelectors = array( new Less_Tree_Selector( $selfElements ) ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Import.php b/vendor/wikimedia/less.php/lib/Less/Tree/Import.php new file mode 100755 index 0000000..ffdac64 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Import.php @@ -0,0 +1,291 @@ +options = $options; + $this->index = $index; + $this->path = $path; + $this->features = $features; + $this->currentFileInfo = $currentFileInfo; + + if ( is_array( $options ) ) { + $this->options += array( 'inline' => false ); + + if ( isset( $this->options['less'] ) || $this->options['inline'] ) { + $this->css = !isset( $this->options['less'] ) || !$this->options['less'] || $this->options['inline']; + } else { + $pathValue = $this->getPath(); + if ( $pathValue && preg_match( '/css([\?;].*)?$/', $pathValue ) ) { + $this->css = true; + } + } + } + } + +// +// The actual import node doesn't return anything, when converted to CSS. +// The reason is that it's used at the evaluation stage, so that the rules +// it imports can be treated like any other rules. +// +// In `eval`, we make sure all Import nodes get evaluated, recursively, so +// we end up with a flat structure, which can easily be imported in the parent +// ruleset. +// + + public function accept( $visitor ) { + if ( $this->features ) { + $this->features = $visitor->visitObj( $this->features ); + } + $this->path = $visitor->visitObj( $this->path ); + + if ( !$this->options['inline'] && $this->root ) { + $this->root = $visitor->visit( $this->root ); + } + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( $this->css ) { + + $output->add( '@import ', $this->currentFileInfo, $this->index ); + + $this->path->genCSS( $output ); + if ( $this->features ) { + $output->add( ' ' ); + $this->features->genCSS( $output ); + } + $output->add( ';' ); + } + } + + public function toCSS() { + $features = $this->features ? ' ' . $this->features->toCSS() : ''; + + if ( $this->css ) { + return "@import " . $this->path->toCSS() . $features . ";\n"; + } else { + return ""; + } + } + + /** + * @return string + */ + public function getPath() { + if ( $this->path instanceof Less_Tree_Quoted ) { + $path = $this->path->value; + $path = ( isset( $this->css ) || preg_match( '/(\.[a-z]*$)|([\?;].*)$/', $path ) ) ? $path : $path . '.less'; + } else if ( $this->path instanceof Less_Tree_URL ) { + $path = $this->path->value->value; + } else { + return null; + } + + // remove query string and fragment + return preg_replace( '/[\?#][^\?]*$/', '', $path ); + } + + public function compileForImport( $env ) { + return new Less_Tree_Import( $this->path->compile( $env ), $this->features, $this->options, $this->index, $this->currentFileInfo ); + } + + public function compilePath( $env ) { + $path = $this->path->compile( $env ); + $rootpath = ''; + if ( $this->currentFileInfo && $this->currentFileInfo['rootpath'] ) { + $rootpath = $this->currentFileInfo['rootpath']; + } + + if ( !( $path instanceof Less_Tree_URL ) ) { + if ( $rootpath ) { + $pathValue = $path->value; + // Add the base path if the import is relative + if ( $pathValue && Less_Environment::isPathRelative( $pathValue ) ) { + $path->value = $this->currentFileInfo['uri_root'].$pathValue; + } + } + $path->value = Less_Environment::normalizePath( $path->value ); + } + + return $path; + } + + public function compile( $env ) { + $evald = $this->compileForImport( $env ); + + // get path & uri + $path_and_uri = null; + if ( is_callable( Less_Parser::$options['import_callback'] ) ) { + $path_and_uri = call_user_func( Less_Parser::$options['import_callback'], $evald ); + } + + if ( !$path_and_uri ) { + $path_and_uri = $evald->PathAndUri(); + } + + if ( $path_and_uri ) { + list( $full_path, $uri ) = $path_and_uri; + } else { + $full_path = $uri = $evald->getPath(); + } + + // import once + if ( $evald->skip( $full_path, $env ) ) { + return array(); + } + + if ( $this->options['inline'] ) { + // todo needs to reference css file not import + //$contents = new Less_Tree_Anonymous($this->root, 0, array('filename'=>$this->importedFilename), true ); + + Less_Parser::AddParsedFile( $full_path ); + $contents = new Less_Tree_Anonymous( file_get_contents( $full_path ), 0, array(), true ); + + if ( $this->features ) { + return new Less_Tree_Media( array( $contents ), $this->features->value ); + } + + return array( $contents ); + } + + // optional (need to be before "CSS" to support optional CSS imports. CSS should be checked only if empty($this->currentFileInfo)) + if ( isset( $this->options['optional'] ) && $this->options['optional'] && !file_exists( $full_path ) && ( !$evald->css || !empty( $this->currentFileInfo ) ) ) { + return array(); + } + + // css ? + if ( $evald->css ) { + $features = ( $evald->features ? $evald->features->compile( $env ) : null ); + return new Less_Tree_Import( $this->compilePath( $env ), $features, $this->options, $this->index ); + } + + return $this->ParseImport( $full_path, $uri, $env ); + } + + /** + * Using the import directories, get the full absolute path and uri of the import + * + * @param Less_Tree_Import $evald + */ + public function PathAndUri() { + $evald_path = $this->getPath(); + + if ( $evald_path ) { + + $import_dirs = array(); + + if ( Less_Environment::isPathRelative( $evald_path ) ) { + // if the path is relative, the file should be in the current directory + if ( $this->currentFileInfo ) { + $import_dirs[ $this->currentFileInfo['currentDirectory'] ] = $this->currentFileInfo['uri_root']; + } + + } else { + // otherwise, the file should be relative to the server root + if ( $this->currentFileInfo ) { + $import_dirs[ $this->currentFileInfo['entryPath'] ] = $this->currentFileInfo['entryUri']; + } + // if the user supplied entryPath isn't the actual root + $import_dirs[ $_SERVER['DOCUMENT_ROOT'] ] = ''; + + } + + // always look in user supplied import directories + $import_dirs = array_merge( $import_dirs, Less_Parser::$options['import_dirs'] ); + + foreach ( $import_dirs as $rootpath => $rooturi ) { + if ( is_callable( $rooturi ) ) { + list( $path, $uri ) = call_user_func( $rooturi, $evald_path ); + if ( is_string( $path ) ) { + $full_path = $path; + return array( $full_path, $uri ); + } + } elseif ( !empty( $rootpath ) ) { + + $path = rtrim( $rootpath, '/\\' ).'/'.ltrim( $evald_path, '/\\' ); + + if ( file_exists( $path ) ) { + $full_path = Less_Environment::normalizePath( $path ); + $uri = Less_Environment::normalizePath( dirname( $rooturi.$evald_path ) ); + return array( $full_path, $uri ); + } elseif ( file_exists( $path.'.less' ) ) { + $full_path = Less_Environment::normalizePath( $path.'.less' ); + $uri = Less_Environment::normalizePath( dirname( $rooturi.$evald_path.'.less' ) ); + return array( $full_path, $uri ); + } + } + } + } + } + + /** + * Parse the import url and return the rules + * + * @return Less_Tree_Media|array + */ + public function ParseImport( $full_path, $uri, $env ) { + $import_env = clone $env; + if ( ( isset( $this->options['reference'] ) && $this->options['reference'] ) || isset( $this->currentFileInfo['reference'] ) ) { + $import_env->currentFileInfo['reference'] = true; + } + + if ( ( isset( $this->options['multiple'] ) && $this->options['multiple'] ) ) { + $import_env->importMultiple = true; + } + + $parser = new Less_Parser( $import_env ); + $root = $parser->parseFile( $full_path, $uri, true ); + + $ruleset = new Less_Tree_Ruleset( array(), $root->rules ); + $ruleset->evalImports( $import_env ); + + return $this->features ? new Less_Tree_Media( $ruleset->rules, $this->features->value ) : $ruleset->rules; + } + + /** + * Should the import be skipped? + * + * @return boolean|null + */ + private function Skip( $path, $env ) { + $path = Less_Parser::AbsPath( $path, true ); + + if ( $path && Less_Parser::FileParsed( $path ) ) { + + if ( isset( $this->currentFileInfo['reference'] ) ) { + return true; + } + + return !isset( $this->options['multiple'] ) && !$env->importMultiple; + } + + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php b/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php new file mode 100755 index 0000000..179781a --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php @@ -0,0 +1,30 @@ +escaped = $escaped; + $this->expression = $string; + $this->index = $index; + } + + public function compile() { + return new Less_Tree_Anonymous( '/* Sorry, can not do JavaScript evaluation in PHP... :( */' ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php b/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php new file mode 100755 index 0000000..ed217cf --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php @@ -0,0 +1,43 @@ +value = $value; + } + + public function compile() { + return $this; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( $this->value === '%' ) { + throw new Less_Exception_Compiler( "Invalid % without number" ); + } + + $output->add( $this->value ); + } + + public function compare( $other ) { + if ( $other instanceof Less_Tree_Keyword ) { + return $other->value === $this->value ? 0 : 1; + } else { + return -1; + } + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Media.php b/vendor/wikimedia/less.php/lib/Less/Tree/Media.php new file mode 100755 index 0000000..ba25a67 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Media.php @@ -0,0 +1,173 @@ +index = $index; + $this->currentFileInfo = $currentFileInfo; + + $selectors = $this->emptySelectors(); + + $this->features = new Less_Tree_Value( $features ); + + $this->rules = array( new Less_Tree_Ruleset( $selectors, $value ) ); + $this->rules[0]->allowImports = true; + } + + public function accept( $visitor ) { + $this->features = $visitor->visitObj( $this->features ); + $this->rules = $visitor->visitArray( $this->rules ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( '@media ', $this->currentFileInfo, $this->index ); + $this->features->genCSS( $output ); + Less_Tree::outputRuleset( $output, $this->rules ); + + } + + public function compile( $env ) { + $media = new Less_Tree_Media( array(), array(), $this->index, $this->currentFileInfo ); + + $strictMathBypass = false; + if ( Less_Parser::$options['strictMath'] === false ) { + $strictMathBypass = true; + Less_Parser::$options['strictMath'] = true; + } + + $media->features = $this->features->compile( $env ); + + if ( $strictMathBypass ) { + Less_Parser::$options['strictMath'] = false; + } + + $env->mediaPath[] = $media; + $env->mediaBlocks[] = $media; + + array_unshift( $env->frames, $this->rules[0] ); + $media->rules = array( $this->rules[0]->compile( $env ) ); + array_shift( $env->frames ); + + array_pop( $env->mediaPath ); + + return !$env->mediaPath ? $media->compileTop( $env ) : $media->compileNested( $env ); + } + + public function variable( $name ) { + return $this->rules[0]->variable( $name ); + } + + public function find( $selector ) { + return $this->rules[0]->find( $selector, $this ); + } + + public function emptySelectors() { + $el = new Less_Tree_Element( '', '&', $this->index, $this->currentFileInfo ); + $sels = array( new Less_Tree_Selector( array( $el ), array(), null, $this->index, $this->currentFileInfo ) ); + $sels[0]->mediaEmpty = true; + return $sels; + } + + public function markReferenced() { + $this->rules[0]->markReferenced(); + $this->isReferenced = true; + Less_Tree::ReferencedArray( $this->rules[0]->rules ); + } + + // evaltop + public function compileTop( $env ) { + $result = $this; + + if ( count( $env->mediaBlocks ) > 1 ) { + $selectors = $this->emptySelectors(); + $result = new Less_Tree_Ruleset( $selectors, $env->mediaBlocks ); + $result->multiMedia = true; + } + + $env->mediaBlocks = array(); + $env->mediaPath = array(); + + return $result; + } + + public function compileNested( $env ) { + $path = array_merge( $env->mediaPath, array( $this ) ); + + // Extract the media-query conditions separated with `,` (OR). + foreach ( $path as $key => $p ) { + $value = $p->features instanceof Less_Tree_Value ? $p->features->value : $p->features; + $path[$key] = is_array( $value ) ? $value : array( $value ); + } + + // Trace all permutations to generate the resulting media-query. + // + // (a, b and c) with nested (d, e) -> + // a and d + // a and e + // b and c and d + // b and c and e + + $permuted = $this->permute( $path ); + $expressions = array(); + foreach ( $permuted as $path ) { + + for ( $i = 0, $len = count( $path ); $i < $len; $i++ ) { + $path[$i] = Less_Parser::is_method( $path[$i], 'toCSS' ) ? $path[$i] : new Less_Tree_Anonymous( $path[$i] ); + } + + for ( $i = count( $path ) - 1; $i > 0; $i-- ) { + array_splice( $path, $i, 0, array( new Less_Tree_Anonymous( 'and' ) ) ); + } + + $expressions[] = new Less_Tree_Expression( $path ); + } + $this->features = new Less_Tree_Value( $expressions ); + + // Fake a tree-node that doesn't output anything. + return new Less_Tree_Ruleset( array(), array() ); + } + + public function permute( $arr ) { + if ( !$arr ) + return array(); + + if ( count( $arr ) == 1 ) + return $arr[0]; + + $result = array(); + $rest = $this->permute( array_slice( $arr, 1 ) ); + foreach ( $rest as $r ) { + foreach ( $arr[0] as $a ) { + $result[] = array_merge( + is_array( $a ) ? $a : array( $a ), + is_array( $r ) ? $r : array( $r ) + ); + } + } + + return $result; + } + + public function bubbleSelectors( $selectors ) { + if ( !$selectors ) return; + + $this->rules = array( new Less_Tree_Ruleset( $selectors, array( $this->rules[0] ) ) ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php new file mode 100755 index 0000000..8e1eece --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php @@ -0,0 +1,193 @@ +selector = new Less_Tree_Selector( $elements ); + $this->arguments = $args; + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + $this->important = $important; + } + + // function accept($visitor){ + // $this->selector = $visitor->visit($this->selector); + // $this->arguments = $visitor->visit($this->arguments); + //} + + public function compile( $env ) { + $rules = array(); + $match = false; + $isOneFound = false; + $candidates = array(); + $defaultUsed = false; + $conditionResult = array(); + + $args = array(); + foreach ( $this->arguments as $a ) { + $args[] = array( 'name' => $a['name'], 'value' => $a['value']->compile( $env ) ); + } + + foreach ( $env->frames as $frame ) { + + $mixins = $frame->find( $this->selector ); + + if ( !$mixins ) { + continue; + } + + $isOneFound = true; + $defNone = 0; + $defTrue = 1; + $defFalse = 2; + + // To make `default()` function independent of definition order we have two "subpasses" here. + // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`), + // and build candidate list with corresponding flags. Then, when we know all possible matches, + // we make a final decision. + + $mixins_len = count( $mixins ); + for ( $m = 0; $m < $mixins_len; $m++ ) { + $mixin = $mixins[$m]; + + if ( $this->IsRecursive( $env, $mixin ) ) { + continue; + } + + if ( $mixin->matchArgs( $args, $env ) ) { + + $candidate = array( 'mixin' => $mixin, 'group' => $defNone ); + + if ( $mixin instanceof Less_Tree_Ruleset ) { + + for ( $f = 0; $f < 2; $f++ ) { + Less_Tree_DefaultFunc::value( $f ); + $conditionResult[$f] = $mixin->matchCondition( $args, $env ); + } + if ( $conditionResult[0] || $conditionResult[1] ) { + if ( $conditionResult[0] != $conditionResult[1] ) { + $candidate['group'] = $conditionResult[1] ? $defTrue : $defFalse; + } + + $candidates[] = $candidate; + } + } else { + $candidates[] = $candidate; + } + + $match = true; + } + } + + Less_Tree_DefaultFunc::reset(); + + $count = array( 0, 0, 0 ); + for ( $m = 0; $m < count( $candidates ); $m++ ) { + $count[ $candidates[$m]['group'] ]++; + } + + if ( $count[$defNone] > 0 ) { + $defaultResult = $defFalse; + } else { + $defaultResult = $defTrue; + if ( ( $count[$defTrue] + $count[$defFalse] ) > 1 ) { + throw new Exception( 'Ambiguous use of `default()` found when matching for `' . $this->format( $args ) . '`' ); + } + } + + $candidates_length = count( $candidates ); + $length_1 = ( $candidates_length == 1 ); + + for ( $m = 0; $m < $candidates_length; $m++ ) { + $candidate = $candidates[$m]['group']; + if ( ( $candidate === $defNone ) || ( $candidate === $defaultResult ) ) { + try{ + $mixin = $candidates[$m]['mixin']; + if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) { + $mixin = new Less_Tree_Mixin_Definition( '', array(), $mixin->rules, null, false ); + $mixin->originalRuleset = $mixins[$m]->originalRuleset; + } + $rules = array_merge( $rules, $mixin->evalCall( $env, $args, $this->important )->rules ); + } catch ( Exception $e ) { + // throw new Less_Exception_Compiler($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']); + throw new Less_Exception_Compiler( $e->getMessage(), null, null, $this->currentFileInfo ); + } + } + } + + if ( $match ) { + if ( !$this->currentFileInfo || !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] ) { + Less_Tree::ReferencedArray( $rules ); + } + + return $rules; + } + } + + if ( $isOneFound ) { + throw new Less_Exception_Compiler( 'No matching definition was found for `'.$this->Format( $args ).'`', null, $this->index, $this->currentFileInfo ); + + } else { + throw new Less_Exception_Compiler( trim( $this->selector->toCSS() ) . " is undefined in ".$this->currentFileInfo['filename'], null, $this->index ); + } + + } + + /** + * Format the args for use in exception messages + * + */ + private function Format( $args ) { + $message = array(); + if ( $args ) { + foreach ( $args as $a ) { + $argValue = ''; + if ( $a['name'] ) { + $argValue .= $a['name'] . ':'; + } + if ( is_object( $a['value'] ) ) { + $argValue .= $a['value']->toCSS(); + } else { + $argValue .= '???'; + } + $message[] = $argValue; + } + } + return implode( ', ', $message ); + } + + /** + * Are we in a recursive mixin call? + * + * @return bool + */ + private function IsRecursive( $env, $mixin ) { + foreach ( $env->frames as $recur_frame ) { + if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) { + + if ( $mixin === $recur_frame ) { + return true; + } + + if ( isset( $recur_frame->originalRuleset ) && $mixin->ruleset_id === $recur_frame->originalRuleset ) { + return true; + } + } + } + + return false; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php new file mode 100755 index 0000000..f9f2eb4 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php @@ -0,0 +1,233 @@ +name = $name; + $this->selectors = array( new Less_Tree_Selector( array( new Less_Tree_Element( null, $name ) ) ) ); + + $this->params = $params; + $this->condition = $condition; + $this->variadic = $variadic; + $this->rules = $rules; + + if ( $params ) { + $this->arity = count( $params ); + foreach ( $params as $p ) { + if ( !isset( $p['name'] ) || ( $p['name'] && !isset( $p['value'] ) ) ) { + $this->required++; + } + } + } + + $this->frames = $frames; + $this->SetRulesetIndex(); + } + + // function accept( $visitor ){ + // $this->params = $visitor->visit($this->params); + // $this->rules = $visitor->visit($this->rules); + // $this->condition = $visitor->visit($this->condition); + //} + + public function toCSS() { + return ''; + } + + // less.js : /lib/less/tree/mixin.js : tree.mixin.Definition.evalParams + public function compileParams( $env, $mixinFrames, $args = array(), &$evaldArguments = array() ) { + $frame = new Less_Tree_Ruleset( null, array() ); + $params = $this->params; + $mixinEnv = null; + $argsLength = 0; + + if ( $args ) { + $argsLength = count( $args ); + for ( $i = 0; $i < $argsLength; $i++ ) { + $arg = $args[$i]; + + if ( $arg && $arg['name'] ) { + $isNamedFound = false; + + foreach ( $params as $j => $param ) { + if ( !isset( $evaldArguments[$j] ) && $arg['name'] === $params[$j]['name'] ) { + $evaldArguments[$j] = $arg['value']->compile( $env ); + array_unshift( $frame->rules, new Less_Tree_Rule( $arg['name'], $arg['value']->compile( $env ) ) ); + $isNamedFound = true; + break; + } + } + if ( $isNamedFound ) { + array_splice( $args, $i, 1 ); + $i--; + $argsLength--; + continue; + } else { + throw new Less_Exception_Compiler( "Named argument for " . $this->name .' '.$args[$i]['name'] . ' not found' ); + } + } + } + } + + $argIndex = 0; + foreach ( $params as $i => $param ) { + + if ( isset( $evaldArguments[$i] ) ) { continue; + } + + $arg = null; + if ( isset( $args[$argIndex] ) ) { + $arg = $args[$argIndex]; + } + + if ( isset( $param['name'] ) && $param['name'] ) { + + if ( isset( $param['variadic'] ) ) { + $varargs = array(); + for ( $j = $argIndex; $j < $argsLength; $j++ ) { + $varargs[] = $args[$j]['value']->compile( $env ); + } + $expression = new Less_Tree_Expression( $varargs ); + array_unshift( $frame->rules, new Less_Tree_Rule( $param['name'], $expression->compile( $env ) ) ); + } else { + $val = ( $arg && $arg['value'] ) ? $arg['value'] : false; + + if ( $val ) { + $val = $val->compile( $env ); + } else if ( isset( $param['value'] ) ) { + + if ( !$mixinEnv ) { + $mixinEnv = new Less_Environment(); + $mixinEnv->frames = array_merge( array( $frame ), $mixinFrames ); + } + + $val = $param['value']->compile( $mixinEnv ); + $frame->resetCache(); + } else { + throw new Less_Exception_Compiler( "Wrong number of arguments for " . $this->name . " (" . $argsLength . ' for ' . $this->arity . ")" ); + } + + array_unshift( $frame->rules, new Less_Tree_Rule( $param['name'], $val ) ); + $evaldArguments[$i] = $val; + } + } + + if ( isset( $param['variadic'] ) && $args ) { + for ( $j = $argIndex; $j < $argsLength; $j++ ) { + $evaldArguments[$j] = $args[$j]['value']->compile( $env ); + } + } + $argIndex++; + } + + ksort( $evaldArguments ); + $evaldArguments = array_values( $evaldArguments ); + + return $frame; + } + + public function compile( $env ) { + if ( $this->frames ) { + return new Less_Tree_Mixin_Definition( $this->name, $this->params, $this->rules, $this->condition, $this->variadic, $this->frames ); + } + return new Less_Tree_Mixin_Definition( $this->name, $this->params, $this->rules, $this->condition, $this->variadic, $env->frames ); + } + + public function evalCall( $env, $args = NULL, $important = NULL ) { + Less_Environment::$mixin_stack++; + + $_arguments = array(); + + if ( $this->frames ) { + $mixinFrames = array_merge( $this->frames, $env->frames ); + } else { + $mixinFrames = $env->frames; + } + + $frame = $this->compileParams( $env, $mixinFrames, $args, $_arguments ); + + $ex = new Less_Tree_Expression( $_arguments ); + array_unshift( $frame->rules, new Less_Tree_Rule( '@arguments', $ex->compile( $env ) ) ); + + $ruleset = new Less_Tree_Ruleset( null, $this->rules ); + $ruleset->originalRuleset = $this->ruleset_id; + + $ruleSetEnv = new Less_Environment(); + $ruleSetEnv->frames = array_merge( array( $this, $frame ), $mixinFrames ); + $ruleset = $ruleset->compile( $ruleSetEnv ); + + if ( $important ) { + $ruleset = $ruleset->makeImportant(); + } + + Less_Environment::$mixin_stack--; + + return $ruleset; + } + + public function matchCondition( $args, $env ) { + if ( !$this->condition ) { + return true; + } + + // set array to prevent error on array_merge + if ( !is_array( $this->frames ) ) { + $this->frames = array(); + } + + $frame = $this->compileParams( $env, array_merge( $this->frames, $env->frames ), $args ); + + $compile_env = new Less_Environment(); + $compile_env->frames = array_merge( + array( $frame ), // the parameter variables + $this->frames, // the parent namespace/mixin frames + $env->frames // the current environment frames + ); + + $compile_env->functions = $env->functions; + + return (bool)$this->condition->compile( $compile_env ); + } + + public function matchArgs( $args, $env = NULL ) { + $argsLength = count( $args ); + + if ( !$this->variadic ) { + if ( $argsLength < $this->required ) { + return false; + } + if ( $argsLength > count( $this->params ) ) { + return false; + } + } else { + if ( $argsLength < ( $this->required - 1 ) ) { + return false; + } + } + + $len = min( $argsLength, $this->arity ); + + for ( $i = 0; $i < $len; $i++ ) { + if ( !isset( $this->params[$i]['name'] ) && !isset( $this->params[$i]['variadic'] ) ) { + if ( $args[$i]['value']->compile( $env )->toCSS() != $this->params[$i]['value']->compile( $env )->toCSS() ) { + return false; + } + } + } + + return true; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php b/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php new file mode 100755 index 0000000..4f9aa97 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php @@ -0,0 +1,49 @@ + color:#FF0000; + * + * @package Less + * @subpackage tree + */ +class Less_Tree_NameValue extends Less_Tree { + + public $name; + public $value; + public $index; + public $currentFileInfo; + public $type = 'NameValue'; + public $important = ''; + + public function __construct( $name, $value = null, $index = null, $currentFileInfo = null ) { + $this->name = $name; + $this->value = $value; + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + } + + public function genCSS( $output ) { + $output->add( + $this->name + . Less_Environment::$_outputMap[': '] + . $this->value + . $this->important + . ( ( ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ), + $this->currentFileInfo, $this->index ); + } + + public function compile( $env ) { + return $this; + } + + public function makeImportant() { + $new = new Less_Tree_NameValue( $this->name, $this->value, $this->index, $this->currentFileInfo ); + $new->important = ' !important'; + return $new; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php b/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php new file mode 100755 index 0000000..f0f36c8 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php @@ -0,0 +1,37 @@ +value = $node; + } + + // function accept($visitor) { + // $this->value = $visitor->visit($this->value); + //} + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( '-' ); + $this->value->genCSS( $output ); + } + + public function compile( $env ) { + if ( Less_Environment::isMathOn() ) { + $ret = new Less_Tree_Operation( '*', array( new Less_Tree_Dimension( -1 ), $this->value ) ); + return $ret->compile( $env ); + } + return new Less_Tree_Negative( $this->value->compile( $env ) ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php b/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php new file mode 100755 index 0000000..d4eb9ac --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php @@ -0,0 +1,68 @@ +op = trim( $op ); + $this->operands = $operands; + $this->isSpaced = $isSpaced; + } + + public function accept( $visitor ) { + $this->operands = $visitor->visitArray( $this->operands ); + } + + public function compile( $env ) { + $a = $this->operands[0]->compile( $env ); + $b = $this->operands[1]->compile( $env ); + + if ( Less_Environment::isMathOn() ) { + + if ( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ) { + $a = $a->toColor(); + + } elseif ( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ) { + $b = $b->toColor(); + + } + + if ( !method_exists( $a, 'operate' ) ) { + throw new Less_Exception_Compiler( "Operation on an invalid type" ); + } + + return $a->operate( $this->op, $b ); + } + + return new Less_Tree_Operation( $this->op, array( $a, $b ), $this->isSpaced ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $this->operands[0]->genCSS( $output ); + if ( $this->isSpaced ) { + $output->add( " " ); + } + $output->add( $this->op ); + if ( $this->isSpaced ) { + $output->add( ' ' ); + } + $this->operands[1]->genCSS( $output ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php b/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php new file mode 100755 index 0000000..77ee48c --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php @@ -0,0 +1,35 @@ +value = $value; + } + + public function accept( $visitor ) { + $this->value = $visitor->visitObj( $this->value ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( '(' ); + $this->value->genCSS( $output ); + $output->add( ')' ); + } + + public function compile( $env ) { + return new Less_Tree_Paren( $this->value->compile( $env ) ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php b/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php new file mode 100755 index 0000000..d01598b --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php @@ -0,0 +1,79 @@ +escaped = $escaped; + $this->value = $content; + if ( $str ) { + $this->quote = $str[0]; + } + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( !$this->escaped ) { + $output->add( $this->quote, $this->currentFileInfo, $this->index ); + } + $output->add( $this->value ); + if ( !$this->escaped ) { + $output->add( $this->quote ); + } + } + + public function compile( $env ) { + $value = $this->value; + if ( preg_match_all( '/`([^`]+)`/', $this->value, $matches ) ) { + foreach ( $matches as $i => $match ) { + $js = new Less_Tree_JavaScript( $matches[1], $this->index, true ); + $js = $js->compile()->value; + $value = str_replace( $matches[0][$i], $js, $value ); + } + } + + if ( preg_match_all( '/@\{([\w-]+)\}/', $value, $matches ) ) { + foreach ( $matches[1] as $i => $match ) { + $v = new Less_Tree_Variable( '@' . $match, $this->index, $this->currentFileInfo ); + $v = $v->compile( $env ); + $v = ( $v instanceof Less_Tree_Quoted ) ? $v->value : $v->toCSS(); + $value = str_replace( $matches[0][$i], $v, $value ); + } + } + + return new Less_Tree_Quoted( $this->quote . $value . $this->quote, $value, $this->escaped, $this->index, $this->currentFileInfo ); + } + + public function compare( $x ) { + if ( !Less_Parser::is_method( $x, 'toCSS' ) ) { + return -1; + } + + $left = $this->toCSS(); + $right = $x->toCSS(); + + if ( $left === $right ) { + return 0; + } + + return $left < $right ? -1 : 1; + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php b/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php new file mode 100755 index 0000000..5f393eb --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php @@ -0,0 +1,112 @@ +name = $name; + $this->value = ( $value instanceof Less_Tree_Value || $value instanceof Less_Tree_Ruleset ) ? $value : new Less_Tree_Value( array( $value ) ); + $this->important = $important ? ' ' . trim( $important ) : ''; + $this->merge = $merge; + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + $this->inline = $inline; + $this->variable = ( is_string( $name ) && $name[0] === '@' ); + } + + public function accept( $visitor ) { + $this->value = $visitor->visitObj( $this->value ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->name . Less_Environment::$_outputMap[': '], $this->currentFileInfo, $this->index ); + try{ + $this->value->genCSS( $output ); + + }catch ( Less_Exception_Parser $e ) { + $e->index = $this->index; + $e->currentFile = $this->currentFileInfo; + throw $e; + } + $output->add( $this->important . ( ( $this->inline || ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ), $this->currentFileInfo, $this->index ); + } + + public function compile( $env ) { + $name = $this->name; + if ( is_array( $name ) ) { + // expand 'primitive' name directly to get + // things faster (~10% for benchmark.less): + if ( count( $name ) === 1 && $name[0] instanceof Less_Tree_Keyword ) { + $name = $name[0]->value; + } else { + $name = $this->CompileName( $env, $name ); + } + } + + $strictMathBypass = Less_Parser::$options['strictMath']; + if ( $name === "font" && !Less_Parser::$options['strictMath'] ) { + Less_Parser::$options['strictMath'] = true; + } + + try { + $evaldValue = $this->value->compile( $env ); + + if ( !$this->variable && $evaldValue->type === "DetachedRuleset" ) { + throw new Less_Exception_Compiler( "Rulesets cannot be evaluated on a property.", null, $this->index, $this->currentFileInfo ); + } + + if ( Less_Environment::$mixin_stack ) { + $return = new Less_Tree_Rule( $name, $evaldValue, $this->important, $this->merge, $this->index, $this->currentFileInfo, $this->inline ); + } else { + $this->name = $name; + $this->value = $evaldValue; + $return = $this; + } + + }catch ( Less_Exception_Parser $e ) { + if ( !is_numeric( $e->index ) ) { + $e->index = $this->index; + $e->currentFile = $this->currentFileInfo; + } + throw $e; + } + + Less_Parser::$options['strictMath'] = $strictMathBypass; + + return $return; + } + + public function CompileName( $env, $name ) { + $output = new Less_Output(); + foreach ( $name as $n ) { + $n->compile( $env )->genCSS( $output ); + } + return $output->toString(); + } + + public function makeImportant() { + return new Less_Tree_Rule( $this->name, $this->value, '!important', $this->merge, $this->index, $this->currentFileInfo, $this->inline ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php b/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php new file mode 100755 index 0000000..9bc8243 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php @@ -0,0 +1,621 @@ +ruleset_id = Less_Parser::$next_id++; + $this->originalRuleset = $this->ruleset_id; + + if ( $this->selectors ) { + foreach ( $this->selectors as $sel ) { + if ( $sel->_oelements ) { + $this->first_oelements[$sel->_oelements[0]] = true; + } + } + } + } + + public function __construct( $selectors, $rules, $strictImports = null ) { + $this->selectors = $selectors; + $this->rules = $rules; + $this->lookups = array(); + $this->strictImports = $strictImports; + $this->SetRulesetIndex(); + } + + public function accept( $visitor ) { + if ( $this->paths ) { + $paths_len = count( $this->paths ); + for ( $i = 0,$paths_len; $i < $paths_len; $i++ ) { + $this->paths[$i] = $visitor->visitArray( $this->paths[$i] ); + } + } elseif ( $this->selectors ) { + $this->selectors = $visitor->visitArray( $this->selectors ); + } + + if ( $this->rules ) { + $this->rules = $visitor->visitArray( $this->rules ); + } + } + + public function compile( $env ) { + $ruleset = $this->PrepareRuleset( $env ); + + // Store the frames around mixin definitions, + // so they can be evaluated like closures when the time comes. + $rsRuleCnt = count( $ruleset->rules ); + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { + if ( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ) { + $ruleset->rules[$i] = $ruleset->rules[$i]->compile( $env ); + } + } + + $mediaBlockCount = 0; + if ( $env instanceof Less_Environment ) { + $mediaBlockCount = count( $env->mediaBlocks ); + } + + // Evaluate mixin calls. + $this->EvalMixinCalls( $ruleset, $env, $rsRuleCnt ); + + // Evaluate everything else + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { + if ( !( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ) ) { + $ruleset->rules[$i] = $ruleset->rules[$i]->compile( $env ); + } + } + + // Evaluate everything else + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { + $rule = $ruleset->rules[$i]; + + // for rulesets, check if it is a css guard and can be removed + if ( $rule instanceof Less_Tree_Ruleset && $rule->selectors && count( $rule->selectors ) === 1 ) { + + // check if it can be folded in (e.g. & where) + if ( $rule->selectors[0]->isJustParentSelector() ) { + array_splice( $ruleset->rules, $i--, 1 ); + $rsRuleCnt--; + + for ( $j = 0; $j < count( $rule->rules ); $j++ ) { + $subRule = $rule->rules[$j]; + if ( !( $subRule instanceof Less_Tree_Rule ) || !$subRule->variable ) { + array_splice( $ruleset->rules, ++$i, 0, array( $subRule ) ); + $rsRuleCnt++; + } + } + + } + } + } + + // Pop the stack + $env->shiftFrame(); + + if ( $mediaBlockCount ) { + $len = count( $env->mediaBlocks ); + for ( $i = $mediaBlockCount; $i < $len; $i++ ) { + $env->mediaBlocks[$i]->bubbleSelectors( $ruleset->selectors ); + } + } + + return $ruleset; + } + + /** + * Compile Less_Tree_Mixin_Call objects + * + * @param Less_Tree_Ruleset $ruleset + * @param integer $rsRuleCnt + */ + private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ) { + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { + $rule = $ruleset->rules[$i]; + + if ( $rule instanceof Less_Tree_Mixin_Call ) { + $rule = $rule->compile( $env ); + + $temp = array(); + foreach ( $rule as $r ) { + if ( ( $r instanceof Less_Tree_Rule ) && $r->variable ) { + // do not pollute the scope if the variable is + // already there. consider returning false here + // but we need a way to "return" variable from mixins + if ( !$ruleset->variable( $r->name ) ) { + $temp[] = $r; + } + } else { + $temp[] = $r; + } + } + $temp_count = count( $temp ) - 1; + array_splice( $ruleset->rules, $i, 1, $temp ); + $rsRuleCnt += $temp_count; + $i += $temp_count; + $ruleset->resetCache(); + + } elseif ( $rule instanceof Less_Tree_RulesetCall ) { + + $rule = $rule->compile( $env ); + $rules = array(); + foreach ( $rule->rules as $r ) { + if ( ( $r instanceof Less_Tree_Rule ) && $r->variable ) { + continue; + } + $rules[] = $r; + } + + array_splice( $ruleset->rules, $i, 1, $rules ); + $temp_count = count( $rules ); + $rsRuleCnt += $temp_count - 1; + $i += $temp_count - 1; + $ruleset->resetCache(); + } + + } + } + + /** + * Compile the selectors and create a new ruleset object for the compile() method + * + */ + private function PrepareRuleset( $env ) { + $hasOnePassingSelector = false; + $selectors = array(); + if ( $this->selectors ) { + Less_Tree_DefaultFunc::error( "it is currently only allowed in parametric mixin guards," ); + + foreach ( $this->selectors as $s ) { + $selector = $s->compile( $env ); + $selectors[] = $selector; + if ( $selector->evaldCondition ) { + $hasOnePassingSelector = true; + } + } + + Less_Tree_DefaultFunc::reset(); + } else { + $hasOnePassingSelector = true; + } + + if ( $this->rules && $hasOnePassingSelector ) { + $rules = $this->rules; + } else { + $rules = array(); + } + + $ruleset = new Less_Tree_Ruleset( $selectors, $rules, $this->strictImports ); + + $ruleset->originalRuleset = $this->ruleset_id; + + $ruleset->root = $this->root; + $ruleset->firstRoot = $this->firstRoot; + $ruleset->allowImports = $this->allowImports; + + // push the current ruleset to the frames stack + $env->unshiftFrame( $ruleset ); + + // Evaluate imports + if ( $ruleset->root || $ruleset->allowImports || !$ruleset->strictImports ) { + $ruleset->evalImports( $env ); + } + + return $ruleset; + } + + function evalImports( $env ) { + $rules_len = count( $this->rules ); + for ( $i = 0; $i < $rules_len; $i++ ) { + $rule = $this->rules[$i]; + + if ( $rule instanceof Less_Tree_Import ) { + $rules = $rule->compile( $env ); + if ( is_array( $rules ) ) { + array_splice( $this->rules, $i, 1, $rules ); + $temp_count = count( $rules ) - 1; + $i += $temp_count; + $rules_len += $temp_count; + } else { + array_splice( $this->rules, $i, 1, array( $rules ) ); + } + + $this->resetCache(); + } + } + } + + function makeImportant() { + $important_rules = array(); + foreach ( $this->rules as $rule ) { + if ( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ) { + $important_rules[] = $rule->makeImportant(); + } else { + $important_rules[] = $rule; + } + } + + return new Less_Tree_Ruleset( $this->selectors, $important_rules, $this->strictImports ); + } + + public function matchArgs( $args ) { + return !$args; + } + + // lets you call a css selector with a guard + public function matchCondition( $args, $env ) { + $lastSelector = end( $this->selectors ); + + if ( !$lastSelector->evaldCondition ) { + return false; + } + if ( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ) { + return false; + } + return true; + } + + function resetCache() { + $this->_rulesets = null; + $this->_variables = null; + $this->lookups = array(); + } + + public function variables() { + $this->_variables = array(); + foreach ( $this->rules as $r ) { + if ( $r instanceof Less_Tree_Rule && $r->variable === true ) { + $this->_variables[$r->name] = $r; + } + } + } + + public function variable( $name ) { + if ( is_null( $this->_variables ) ) { + $this->variables(); + } + return isset( $this->_variables[$name] ) ? $this->_variables[$name] : null; + } + + public function find( $selector, $self = null ) { + $key = implode( ' ', $selector->_oelements ); + + if ( !isset( $this->lookups[$key] ) ) { + + if ( !$self ) { + $self = $this->ruleset_id; + } + + $this->lookups[$key] = array(); + + $first_oelement = $selector->_oelements[0]; + + foreach ( $this->rules as $rule ) { + if ( $rule instanceof Less_Tree_Ruleset && $rule->ruleset_id != $self ) { + + if ( isset( $rule->first_oelements[$first_oelement] ) ) { + + foreach ( $rule->selectors as $ruleSelector ) { + $match = $selector->match( $ruleSelector ); + if ( $match ) { + if ( $selector->elements_len > $match ) { + $this->lookups[$key] = array_merge( $this->lookups[$key], $rule->find( new Less_Tree_Selector( array_slice( $selector->elements, $match ) ), $self ) ); + } else { + $this->lookups[$key][] = $rule; + } + break; + } + } + } + } + } + } + + return $this->lookups[$key]; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( !$this->root ) { + Less_Environment::$tabLevel++; + } + + $tabRuleStr = $tabSetStr = ''; + if ( !Less_Parser::$options['compress'] ) { + if ( Less_Environment::$tabLevel ) { + $tabRuleStr = "\n".str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel ); + $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel - 1 ); + } else { + $tabSetStr = $tabRuleStr = "\n"; + } + } + + $ruleNodes = array(); + $rulesetNodes = array(); + foreach ( $this->rules as $rule ) { + + $class = get_class( $rule ); + if ( ( $class === 'Less_Tree_Media' ) || ( $class === 'Less_Tree_Directive' ) || ( $this->root && $class === 'Less_Tree_Comment' ) || ( $class === 'Less_Tree_Ruleset' && $rule->rules ) ) { + $rulesetNodes[] = $rule; + } else { + $ruleNodes[] = $rule; + } + } + + // If this is the root node, we don't render + // a selector, or {}. + if ( !$this->root ) { + + /* + debugInfo = tree.debugInfo(env, this, tabSetStr); + + if (debugInfo) { + output.add(debugInfo); + output.add(tabSetStr); + } + */ + + $paths_len = count( $this->paths ); + for ( $i = 0; $i < $paths_len; $i++ ) { + $path = $this->paths[$i]; + $firstSelector = true; + + foreach ( $path as $p ) { + $p->genCSS( $output, $firstSelector ); + $firstSelector = false; + } + + if ( $i + 1 < $paths_len ) { + $output->add( ',' . $tabSetStr ); + } + } + + $output->add( ( Less_Parser::$options['compress'] ? '{' : " {" ) . $tabRuleStr ); + } + + // Compile rules and rulesets + $ruleNodes_len = count( $ruleNodes ); + $rulesetNodes_len = count( $rulesetNodes ); + for ( $i = 0; $i < $ruleNodes_len; $i++ ) { + $rule = $ruleNodes[$i]; + + // @page{ directive ends up with root elements inside it, a mix of rules and rulesets + // In this instance we do not know whether it is the last property + if ( $i + 1 === $ruleNodes_len && ( !$this->root || $rulesetNodes_len === 0 || $this->firstRoot ) ) { + Less_Environment::$lastRule = true; + } + + $rule->genCSS( $output ); + + if ( !Less_Environment::$lastRule ) { + $output->add( $tabRuleStr ); + } else { + Less_Environment::$lastRule = false; + } + } + + if ( !$this->root ) { + $output->add( $tabSetStr . '}' ); + Less_Environment::$tabLevel--; + } + + $firstRuleset = true; + $space = ( $this->root ? $tabRuleStr : $tabSetStr ); + for ( $i = 0; $i < $rulesetNodes_len; $i++ ) { + + if ( $ruleNodes_len && $firstRuleset ) { + $output->add( $space ); + } elseif ( !$firstRuleset ) { + $output->add( $space ); + } + $firstRuleset = false; + $rulesetNodes[$i]->genCSS( $output ); + } + + if ( !Less_Parser::$options['compress'] && $this->firstRoot ) { + $output->add( "\n" ); + } + + } + + function markReferenced() { + if ( !$this->selectors ) { + return; + } + foreach ( $this->selectors as $selector ) { + $selector->markReferenced(); + } + } + + public function joinSelectors( $context, $selectors ) { + $paths = array(); + if ( is_array( $selectors ) ) { + foreach ( $selectors as $selector ) { + $this->joinSelector( $paths, $context, $selector ); + } + } + return $paths; + } + + public function joinSelector( &$paths, $context, $selector ) { + $hasParentSelector = false; + + foreach ( $selector->elements as $el ) { + if ( $el->value === '&' ) { + $hasParentSelector = true; + } + } + + if ( !$hasParentSelector ) { + if ( $context ) { + foreach ( $context as $context_el ) { + $paths[] = array_merge( $context_el, array( $selector ) ); + } + } else { + $paths[] = array( $selector ); + } + return; + } + + // The paths are [[Selector]] + // The first list is a list of comma separated selectors + // The inner list is a list of inheritance separated selectors + // e.g. + // .a, .b { + // .c { + // } + // } + // == [[.a] [.c]] [[.b] [.c]] + // + + // the elements from the current selector so far + $currentElements = array(); + // the current list of new selectors to add to the path. + // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors + // by the parents + $newSelectors = array( array() ); + + foreach ( $selector->elements as $el ) { + + // non parent reference elements just get added + if ( $el->value !== '&' ) { + $currentElements[] = $el; + } else { + // the new list of selectors to add + $selectorsMultiplied = array(); + + // merge the current list of non parent selector elements + // on to the current list of selectors to add + if ( $currentElements ) { + $this->mergeElementsOnToSelectors( $currentElements, $newSelectors ); + } + + // loop through our current selectors + foreach ( $newSelectors as $sel ) { + + // if we don't have any parent paths, the & might be in a mixin so that it can be used + // whether there are parents or not + if ( !$context ) { + // the combinator used on el should now be applied to the next element instead so that + // it is not lost + if ( $sel ) { + $sel[0]->elements = array_slice( $sel[0]->elements, 0 ); + $sel[0]->elements[] = new Less_Tree_Element( $el->combinator, '', $el->index, $el->currentFileInfo ); + } + $selectorsMultiplied[] = $sel; + } else { + + // and the parent selectors + foreach ( $context as $parentSel ) { + // We need to put the current selectors + // then join the last selector's elements on to the parents selectors + + // our new selector path + $newSelectorPath = array(); + // selectors from the parent after the join + $afterParentJoin = array(); + $newJoinedSelectorEmpty = true; + + // construct the joined selector - if & is the first thing this will be empty, + // if not newJoinedSelector will be the last set of elements in the selector + if ( $sel ) { + $newSelectorPath = $sel; + $lastSelector = array_pop( $newSelectorPath ); + $newJoinedSelector = $selector->createDerived( array_slice( $lastSelector->elements, 0 ) ); + $newJoinedSelectorEmpty = false; + } else { + $newJoinedSelector = $selector->createDerived( array() ); + } + + // put together the parent selectors after the join + if ( count( $parentSel ) > 1 ) { + $afterParentJoin = array_merge( $afterParentJoin, array_slice( $parentSel, 1 ) ); + } + + if ( $parentSel ) { + $newJoinedSelectorEmpty = false; + + // join the elements so far with the first part of the parent + $newJoinedSelector->elements[] = new Less_Tree_Element( $el->combinator, $parentSel[0]->elements[0]->value, $el->index, $el->currentFileInfo ); + + $newJoinedSelector->elements = array_merge( $newJoinedSelector->elements, array_slice( $parentSel[0]->elements, 1 ) ); + } + + if ( !$newJoinedSelectorEmpty ) { + // now add the joined selector + $newSelectorPath[] = $newJoinedSelector; + } + + // and the rest of the parent + $newSelectorPath = array_merge( $newSelectorPath, $afterParentJoin ); + + // add that to our new set of selectors + $selectorsMultiplied[] = $newSelectorPath; + } + } + } + + // our new selectors has been multiplied, so reset the state + $newSelectors = $selectorsMultiplied; + $currentElements = array(); + } + } + + // if we have any elements left over (e.g. .a& .b == .b) + // add them on to all the current selectors + if ( $currentElements ) { + $this->mergeElementsOnToSelectors( $currentElements, $newSelectors ); + } + foreach ( $newSelectors as $new_sel ) { + if ( $new_sel ) { + $paths[] = $new_sel; + } + } + } + + function mergeElementsOnToSelectors( $elements, &$selectors ) { + if ( !$selectors ) { + $selectors[] = array( new Less_Tree_Selector( $elements ) ); + return; + } + + foreach ( $selectors as &$sel ) { + + // if the previous thing in sel is a parent this needs to join on to it + if ( $sel ) { + $last = count( $sel ) - 1; + $sel[$last] = $sel[$last]->createDerived( array_merge( $sel[$last]->elements, $elements ) ); + } else { + $sel[] = new Less_Tree_Selector( $elements ); + } + } + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php b/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php new file mode 100755 index 0000000..079ff4f --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php @@ -0,0 +1,26 @@ +variable = $variable; + } + + public function accept( $visitor ) { + } + + public function compile( $env ) { + $variable = new Less_Tree_Variable( $this->variable ); + $detachedRuleset = $variable->compile( $env ); + return $detachedRuleset->callEval( $env ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php b/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php new file mode 100755 index 0000000..7ecfc6a --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php @@ -0,0 +1,165 @@ +elements = $elements; + $this->elements_len = count( $elements ); + $this->extendList = $extendList; + $this->condition = $condition; + if ( $currentFileInfo ) { + $this->currentFileInfo = $currentFileInfo; + } + $this->isReferenced = $isReferenced; + if ( !$condition ) { + $this->evaldCondition = true; + } + + $this->CacheElements(); + } + + public function accept( $visitor ) { + $this->elements = $visitor->visitArray( $this->elements ); + $this->extendList = $visitor->visitArray( $this->extendList ); + if ( $this->condition ) { + $this->condition = $visitor->visitObj( $this->condition ); + } + + if ( $visitor instanceof Less_Visitor_extendFinder ) { + $this->CacheElements(); + } + } + + public function createDerived( $elements, $extendList = null, $evaldCondition = null ) { + $newSelector = new Less_Tree_Selector( $elements, ( $extendList ? $extendList : $this->extendList ), null, $this->index, $this->currentFileInfo, $this->isReferenced ); + $newSelector->evaldCondition = $evaldCondition ? $evaldCondition : $this->evaldCondition; + return $newSelector; + } + + public function match( $other ) { + if ( !$other->_oelements || ( $this->elements_len < $other->_oelements_len ) ) { + return 0; + } + + for ( $i = 0; $i < $other->_oelements_len; $i++ ) { + if ( $this->elements[$i]->value !== $other->_oelements[$i] ) { + return 0; + } + } + + return $other->_oelements_len; // return number of matched elements + } + + public function CacheElements() { + $this->_oelements = array(); + $this->_oelements_assoc = array(); + + $css = ''; + + foreach ( $this->elements as $v ) { + + $css .= $v->combinator; + if ( !$v->value_is_object ) { + $css .= $v->value; + continue; + } + + if ( !property_exists( $v->value, 'value' ) || !is_string( $v->value->value ) ) { + $this->cacheable = false; + return; + } + $css .= $v->value->value; + } + + $this->_oelements_len = preg_match_all( '/[,&#\.\w-](?:[\w-]|(?:\\\\.))*/', $css, $matches ); + if ( $this->_oelements_len ) { + $this->_oelements = $matches[0]; + + if ( $this->_oelements[0] === '&' ) { + array_shift( $this->_oelements ); + $this->_oelements_len--; + } + + $this->_oelements_assoc = array_fill_keys( $this->_oelements, true ); + } + } + + public function isJustParentSelector() { + return !$this->mediaEmpty && + count( $this->elements ) === 1 && + $this->elements[0]->value === '&' && + ( $this->elements[0]->combinator === ' ' || $this->elements[0]->combinator === '' ); + } + + public function compile( $env ) { + $elements = array(); + foreach ( $this->elements as $el ) { + $elements[] = $el->compile( $env ); + } + + $extendList = array(); + foreach ( $this->extendList as $el ) { + $extendList[] = $el->compile( $el ); + } + + $evaldCondition = false; + if ( $this->condition ) { + $evaldCondition = $this->condition->compile( $env ); + } + + return $this->createDerived( $elements, $extendList, $evaldCondition ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output, $firstSelector = true ) { + if ( !$firstSelector && $this->elements[0]->combinator === "" ) { + $output->add( ' ', $this->currentFileInfo, $this->index ); + } + + foreach ( $this->elements as $element ) { + $element->genCSS( $output ); + } + } + + public function markReferenced() { + $this->isReferenced = true; + } + + public function getIsReferenced() { + return !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] || $this->isReferenced; + } + + public function getIsOutput() { + return $this->evaldCondition; + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php b/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php new file mode 100755 index 0000000..38e0526 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php @@ -0,0 +1,28 @@ +value = $value; + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->value ); + } + + public function compile() { + return $this; + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php b/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php new file mode 100755 index 0000000..29230df --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php @@ -0,0 +1,142 @@ +numerator = $numerator; + $this->denominator = $denominator; + $this->backupUnit = $backupUnit; + } + + public function __clone() { + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( $this->numerator ) { + $output->add( $this->numerator[0] ); + } elseif ( $this->denominator ) { + $output->add( $this->denominator[0] ); + } elseif ( !Less_Parser::$options['strictUnits'] && $this->backupUnit ) { + $output->add( $this->backupUnit ); + return; + } + } + + public function toString() { + $returnStr = implode( '*', $this->numerator ); + foreach ( $this->denominator as $d ) { + $returnStr .= '/'.$d; + } + return $returnStr; + } + + public function __toString() { + return $this->toString(); + } + + /** + * @param Less_Tree_Unit $other + */ + public function compare( $other ) { + return $this->is( $other->toString() ) ? 0 : -1; + } + + public function is( $unitString ) { + return $this->toString() === $unitString; + } + + public function isLength() { + $css = $this->toCSS(); + return !!preg_match( '/px|em|%|in|cm|mm|pc|pt|ex/', $css ); + } + + public function isAngle() { + return isset( Less_Tree_UnitConversions::$angle[$this->toCSS()] ); + } + + public function isEmpty() { + return !$this->numerator && !$this->denominator; + } + + public function isSingular() { + return count( $this->numerator ) <= 1 && !$this->denominator; + } + + public function usedUnits() { + $result = array(); + + foreach ( Less_Tree_UnitConversions::$groups as $groupName ) { + $group = Less_Tree_UnitConversions::${$groupName}; + + foreach ( $this->numerator as $atomicUnit ) { + if ( isset( $group[$atomicUnit] ) && !isset( $result[$groupName] ) ) { + $result[$groupName] = $atomicUnit; + } + } + + foreach ( $this->denominator as $atomicUnit ) { + if ( isset( $group[$atomicUnit] ) && !isset( $result[$groupName] ) ) { + $result[$groupName] = $atomicUnit; + } + } + } + + return $result; + } + + public function cancel() { + $counter = array(); + $backup = null; + + foreach ( $this->numerator as $atomicUnit ) { + if ( !$backup ) { + $backup = $atomicUnit; + } + $counter[$atomicUnit] = ( isset( $counter[$atomicUnit] ) ? $counter[$atomicUnit] : 0 ) + 1; + } + + foreach ( $this->denominator as $atomicUnit ) { + if ( !$backup ) { + $backup = $atomicUnit; + } + $counter[$atomicUnit] = ( isset( $counter[$atomicUnit] ) ? $counter[$atomicUnit] : 0 ) - 1; + } + + $this->numerator = array(); + $this->denominator = array(); + + foreach ( $counter as $atomicUnit => $count ) { + if ( $count > 0 ) { + for ( $i = 0; $i < $count; $i++ ) { + $this->numerator[] = $atomicUnit; + } + } elseif ( $count < 0 ) { + for ( $i = 0; $i < -$count; $i++ ) { + $this->denominator[] = $atomicUnit; + } + } + } + + if ( !$this->numerator && !$this->denominator && $backup ) { + $this->backupUnit = $backup; + } + + sort( $this->numerator ); + sort( $this->denominator ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php b/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php new file mode 100755 index 0000000..7f857fb --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php @@ -0,0 +1,35 @@ + 1, + 'cm' => 0.01, + 'mm' => 0.001, + 'in' => 0.0254, + 'px' => 0.000264583, // 0.0254 / 96, + 'pt' => 0.000352778, // 0.0254 / 72, + 'pc' => 0.004233333, // 0.0254 / 72 * 12 + ); + + public static $duration = array( + 's' => 1, + 'ms' => 0.001 + ); + + public static $angle = array( + 'rad' => 0.1591549430919, // 1/(2*M_PI), + 'deg' => 0.002777778, // 1/360, + 'grad' => 0.0025, // 1/400, + 'turn' => 1 + ); + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Url.php b/vendor/wikimedia/less.php/lib/Less/Tree/Url.php new file mode 100755 index 0000000..4e7f114 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Url.php @@ -0,0 +1,76 @@ +value = $value; + $this->currentFileInfo = $currentFileInfo; + $this->isEvald = $isEvald; + } + + public function accept( $visitor ) { + $this->value = $visitor->visitObj( $this->value ); + } + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( 'url(' ); + $this->value->genCSS( $output ); + $output->add( ')' ); + } + + /** + * @param Less_Functions $ctx + */ + public function compile( $ctx ) { + $val = $this->value->compile( $ctx ); + + if ( !$this->isEvald ) { + // Add the base path if the URL is relative + if ( Less_Parser::$options['relativeUrls'] + && $this->currentFileInfo + && is_string( $val->value ) + && Less_Environment::isPathRelative( $val->value ) + ) { + $rootpath = $this->currentFileInfo['uri_root']; + if ( !$val->quote ) { + $rootpath = preg_replace( '/[\(\)\'"\s]/', '\\$1', $rootpath ); + } + $val->value = $rootpath . $val->value; + } + + $val->value = Less_Environment::normalizePath( $val->value ); + } + + // Add cache buster if enabled + if ( Less_Parser::$options['urlArgs'] ) { + if ( !preg_match( '/^\s*data:/', $val->value ) ) { + $delimiter = strpos( $val->value, '?' ) === false ? '?' : '&'; + $urlArgs = $delimiter . Less_Parser::$options['urlArgs']; + $hash_pos = strpos( $val->value, '#' ); + if ( $hash_pos !== false ) { + $val->value = substr_replace( $val->value, $urlArgs, $hash_pos, 0 ); + } else { + $val->value .= $urlArgs; + } + } + } + + return new Less_Tree_URL( $val, $this->currentFileInfo, true ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Value.php b/vendor/wikimedia/less.php/lib/Less/Tree/Value.php new file mode 100755 index 0000000..a4c0d85 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Value.php @@ -0,0 +1,47 @@ +value = $value; + } + + public function accept( $visitor ) { + $this->value = $visitor->visitArray( $this->value ); + } + + public function compile( $env ) { + $ret = array(); + $i = 0; + foreach ( $this->value as $i => $v ) { + $ret[] = $v->compile( $env ); + } + if ( $i > 0 ) { + return new Less_Tree_Value( $ret ); + } + return $ret[0]; + } + + /** + * @see Less_Tree::genCSS + */ + function genCSS( $output ) { + $len = count( $this->value ); + for ( $i = 0; $i < $len; $i++ ) { + $this->value[$i]->genCSS( $output ); + if ( $i + 1 < $len ) { + $output->add( Less_Environment::$_outputMap[','] ); + } + } + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php b/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php new file mode 100755 index 0000000..e36d3d4 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php @@ -0,0 +1,51 @@ +name = $name; + $this->index = $index; + $this->currentFileInfo = $currentFileInfo; + } + + public function compile( $env ) { + if ( $this->name[1] === '@' ) { + $v = new Less_Tree_Variable( substr( $this->name, 1 ), $this->index + 1, $this->currentFileInfo ); + $name = '@' . $v->compile( $env )->value; + } else { + $name = $this->name; + } + + if ( $this->evaluating ) { + throw new Less_Exception_Compiler( "Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo ); + } + + $this->evaluating = true; + + foreach ( $env->frames as $frame ) { + if ( $v = $frame->variable( $name ) ) { + $r = $v->value->compile( $env ); + $this->evaluating = false; + return $r; + } + } + + throw new Less_Exception_Compiler( "variable " . $name . " is undefined in file ".$this->currentFileInfo["filename"], null, $this->index, $this->currentFileInfo ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Version.php b/vendor/wikimedia/less.php/lib/Less/Version.php new file mode 100755 index 0000000..2d05c38 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Version.php @@ -0,0 +1,15 @@ +_visitFnCache = get_class_methods( get_class( $this ) ); + $this->_visitFnCache = array_flip( $this->_visitFnCache ); + } + + public function visitObj( $node ) { + $funcName = 'visit'.$node->type; + if ( isset( $this->_visitFnCache[$funcName] ) ) { + + $visitDeeper = true; + $this->$funcName( $node, $visitDeeper ); + + if ( $visitDeeper ) { + $node->accept( $this ); + } + + $funcName = $funcName . "Out"; + if ( isset( $this->_visitFnCache[$funcName] ) ) { + $this->$funcName( $node ); + } + + } else { + $node->accept( $this ); + } + + return $node; + } + + public function visitArray( $nodes ) { + array_map( array( $this,'visitObj' ), $nodes ); + return $nodes; + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php b/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php new file mode 100755 index 0000000..7d5d3fd --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php @@ -0,0 +1,109 @@ +contexts = array(); + $this->allExtendsStack = array( array() ); + parent::__construct(); + } + + /** + * @param Less_Tree_Ruleset $root + */ + public function run( $root ) { + $root = $this->visitObj( $root ); + $root->allExtends =& $this->allExtendsStack[0]; + return $root; + } + + public function visitRule( $ruleNode, &$visitDeeper ) { + $visitDeeper = false; + } + + public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) { + $visitDeeper = false; + } + + public function visitRuleset( $rulesetNode ) { + if ( $rulesetNode->root ) { + return; + } + + $allSelectorsExtendList = array(); + + // get &:extend(.a); rules which apply to all selectors in this ruleset + if ( $rulesetNode->rules ) { + foreach ( $rulesetNode->rules as $rule ) { + if ( $rule instanceof Less_Tree_Extend ) { + $allSelectorsExtendList[] = $rule; + $rulesetNode->extendOnEveryPath = true; + } + } + } + + // now find every selector and apply the extends that apply to all extends + // and the ones which apply to an individual extend + foreach ( $rulesetNode->paths as $selectorPath ) { + $selector = end( $selectorPath ); // $selectorPath[ count($selectorPath)-1]; + + $j = 0; + foreach ( $selector->extendList as $extend ) { + $this->allExtendsStackPush( $rulesetNode, $selectorPath, $extend, $j ); + } + foreach ( $allSelectorsExtendList as $extend ) { + $this->allExtendsStackPush( $rulesetNode, $selectorPath, $extend, $j ); + } + } + + $this->contexts[] = $rulesetNode->selectors; + } + + public function allExtendsStackPush( $rulesetNode, $selectorPath, $extend, &$j ) { + $this->foundExtends = true; + $extend = clone $extend; + $extend->findSelfSelectors( $selectorPath ); + $extend->ruleset = $rulesetNode; + if ( $j === 0 ) { + $extend->firstExtendOnThisSelectorPath = true; + } + + $end_key = count( $this->allExtendsStack ) - 1; + $this->allExtendsStack[$end_key][] = $extend; + $j++; + } + + public function visitRulesetOut( $rulesetNode ) { + if ( !is_object( $rulesetNode ) || !$rulesetNode->root ) { + array_pop( $this->contexts ); + } + } + + public function visitMedia( $mediaNode ) { + $mediaNode->allExtends = array(); + $this->allExtendsStack[] =& $mediaNode->allExtends; + } + + public function visitMediaOut() { + array_pop( $this->allExtendsStack ); + } + + public function visitDirective( $directiveNode ) { + $directiveNode->allExtends = array(); + $this->allExtendsStack[] =& $directiveNode->allExtends; + } + + public function visitDirectiveOut() { + array_pop( $this->allExtendsStack ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/import.php b/vendor/wikimedia/less.php/lib/Less/Visitor/import.php new file mode 100755 index 0000000..7af96eb --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/import.php @@ -0,0 +1,137 @@ +env = $evalEnv; + $this->importCount = 0; + parent::__construct(); + } + + + function run( $root ){ + $root = $this->visitObj($root); + $this->isFinished = true; + + //if( $this->importCount === 0) { + // $this->_finish(); + //} + } + + function visitImport($importNode, &$visitDeeper ){ + $importVisitor = $this; + $inlineCSS = $importNode->options['inline']; + + if( !$importNode->css || $inlineCSS ){ + $evaldImportNode = $importNode->compileForImport($this->env); + + if( $evaldImportNode && (!$evaldImportNode->css || $inlineCSS) ){ + $importNode = $evaldImportNode; + $this->importCount++; + $env = clone $this->env; + + if( (isset($importNode->options['multiple']) && $importNode->options['multiple']) ){ + $env->importMultiple = true; + } + + //get path & uri + $path_and_uri = null; + if( is_callable(Less_Parser::$options['import_callback']) ){ + $path_and_uri = call_user_func(Less_Parser::$options['import_callback'],$importNode); + } + + if( !$path_and_uri ){ + $path_and_uri = $importNode->PathAndUri(); + } + + if( $path_and_uri ){ + list($full_path, $uri) = $path_and_uri; + }else{ + $full_path = $uri = $importNode->getPath(); + } + + + //import once + if( $importNode->skip( $full_path, $env) ){ + return array(); + } + + if( $importNode->options['inline'] ){ + //todo needs to reference css file not import + //$contents = new Less_Tree_Anonymous($importNode->root, 0, array('filename'=>$importNode->importedFilename), true ); + + Less_Parser::AddParsedFile($full_path); + $contents = new Less_Tree_Anonymous( file_get_contents($full_path), 0, array(), true ); + + if( $importNode->features ){ + return new Less_Tree_Media( array($contents), $importNode->features->value ); + } + + return array( $contents ); + } + + + // css ? + if( $importNode->css ){ + $features = ( $importNode->features ? $importNode->features->compile($env) : null ); + return new Less_Tree_Import( $importNode->compilePath( $env), $features, $importNode->options, $this->index); + } + + return $importNode->ParseImport( $full_path, $uri, $env ); + } + + } + + $visitDeeper = false; + return $importNode; + } + + + function visitRule( $ruleNode, &$visitDeeper ){ + $visitDeeper = false; + return $ruleNode; + } + + function visitDirective($directiveNode, $visitArgs){ + array_unshift($this->env->frames,$directiveNode); + return $directiveNode; + } + + function visitDirectiveOut($directiveNode) { + array_shift($this->env->frames); + } + + function visitMixinDefinition($mixinDefinitionNode, $visitArgs) { + array_unshift($this->env->frames,$mixinDefinitionNode); + return $mixinDefinitionNode; + } + + function visitMixinDefinitionOut($mixinDefinitionNode) { + array_shift($this->env->frames); + } + + function visitRuleset($rulesetNode, $visitArgs) { + array_unshift($this->env->frames,$rulesetNode); + return $rulesetNode; + } + + function visitRulesetOut($rulesetNode) { + array_shift($this->env->frames); + } + + function visitMedia($mediaNode, $visitArgs) { + array_unshift($this->env->frames, $mediaNode->ruleset); + return $mediaNode; + } + + function visitMediaOut($mediaNode) { + array_shift($this->env->frames); + } + +} +*/ diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php b/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php new file mode 100755 index 0000000..bb08ece --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php @@ -0,0 +1,68 @@ +visitObj( $root ); + } + + public function visitRule( $ruleNode, &$visitDeeper ) { + $visitDeeper = false; + } + + public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) { + $visitDeeper = false; + } + + public function visitRuleset( $rulesetNode ) { + $paths = array(); + + if ( !$rulesetNode->root ) { + $selectors = array(); + + if ( $rulesetNode->selectors && $rulesetNode->selectors ) { + foreach ( $rulesetNode->selectors as $selector ) { + if ( $selector->getIsOutput() ) { + $selectors[] = $selector; + } + } + } + + if ( !$selectors ) { + $rulesetNode->selectors = null; + $rulesetNode->rules = null; + } else { + $context = end( $this->contexts ); // $context = $this->contexts[ count($this->contexts) - 1]; + $paths = $rulesetNode->joinSelectors( $context, $selectors ); + } + + $rulesetNode->paths = $paths; + } + + $this->contexts[] = $paths; // different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths + } + + public function visitRulesetOut() { + array_pop( $this->contexts ); + } + + public function visitMedia( $mediaNode ) { + $context = end( $this->contexts ); // $context = $this->contexts[ count($this->contexts) - 1]; + + if ( !count( $context ) || ( is_object( $context[0] ) && $context[0]->multiMedia ) ) { + $mediaNode->rules[0]->root = true; + } + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php b/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php new file mode 100755 index 0000000..65082a4 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php @@ -0,0 +1,441 @@ +run( $root ); + if ( !$extendFinder->foundExtends ) { + return $root; + } + + $root->allExtends = $this->doExtendChaining( $root->allExtends, $root->allExtends ); + + $this->allExtendsStack = array(); + $this->allExtendsStack[] = &$root->allExtends; + + return $this->visitObj( $root ); + } + + private function doExtendChaining( $extendsList, $extendsListTarget, $iterationCount = 0 ) { + // + // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering and pasting + // the selector we would do normally, but we are also adding an extend with the same target selector + // this means this new extend can then go and alter other extends + // + // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors + // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already processed if + // we look at each selector at a time, as is done in visitRuleset + + $extendsToAdd = array(); + + // loop through comparing every extend with every target extend. + // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place + // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one + // and the second is the target. + // the separation into two lists allows us to process a subset of chains with a bigger set, as is the + // case when processing media queries + for ( $extendIndex = 0, $extendsList_len = count( $extendsList ); $extendIndex < $extendsList_len; $extendIndex++ ) { + for ( $targetExtendIndex = 0; $targetExtendIndex < count( $extendsListTarget ); $targetExtendIndex++ ) { + + $extend = $extendsList[$extendIndex]; + $targetExtend = $extendsListTarget[$targetExtendIndex]; + + // Optimisation: Explicit reference,  + if ( \array_key_exists( $targetExtend->object_id, $extend->parent_ids ) ) { + // ignore circular references + continue; + } + + // find a match in the target extends self selector (the bit before :extend) + $selectorPath = array( $targetExtend->selfSelectors[0] ); + $matches = $this->findMatch( $extend, $selectorPath ); + + if ( $matches ) { + + // we found a match, so for each self selector.. + foreach ( $extend->selfSelectors as $selfSelector ) { + + // process the extend as usual + $newSelector = $this->extendSelector( $matches, $selectorPath, $selfSelector ); + + // but now we create a new extend from it + $newExtend = new Less_Tree_Extend( $targetExtend->selector, $targetExtend->option, 0 ); + $newExtend->selfSelectors = $newSelector; + + // add the extend onto the list of extends for that selector + end( $newSelector )->extendList = array( $newExtend ); + // $newSelector[ count($newSelector)-1]->extendList = array($newExtend); + + // record that we need to add it. + $extendsToAdd[] = $newExtend; + $newExtend->ruleset = $targetExtend->ruleset; + + // remember its parents for circular references + $newExtend->parent_ids = array_merge( $newExtend->parent_ids, $targetExtend->parent_ids, $extend->parent_ids ); + + // only process the selector once.. if we have :extend(.a,.b) then multiple + // extends will look at the same selector path, so when extending + // we know that any others will be duplicates in terms of what is added to the css + if ( $targetExtend->firstExtendOnThisSelectorPath ) { + $newExtend->firstExtendOnThisSelectorPath = true; + $targetExtend->ruleset->paths[] = $newSelector; + } + } + } + } + } + + if ( $extendsToAdd ) { + // try to detect circular references to stop a stack overflow. + // may no longer be needed. $this->extendChainCount++; + if ( $iterationCount > 100 ) { + + try{ + $selectorOne = $extendsToAdd[0]->selfSelectors[0]->toCSS(); + $selectorTwo = $extendsToAdd[0]->selector->toCSS(); + }catch ( Exception $e ) { + $selectorOne = "{unable to calculate}"; + $selectorTwo = "{unable to calculate}"; + } + + throw new Less_Exception_Parser( "extend circular reference detected. One of the circular extends is currently:" . $selectorOne . ":extend(" . $selectorTwo . ")" ); + } + + // now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e... + $extendsToAdd = $this->doExtendChaining( $extendsToAdd, $extendsListTarget, $iterationCount + 1 ); + } + + return array_merge( $extendsList, $extendsToAdd ); + } + + protected function visitRule( $ruleNode, &$visitDeeper ) { + $visitDeeper = false; + } + + protected function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) { + $visitDeeper = false; + } + + protected function visitSelector( $selectorNode, &$visitDeeper ) { + $visitDeeper = false; + } + + protected function visitRuleset( $rulesetNode ) { + if ( $rulesetNode->root ) { + return; + } + + $allExtends = end( $this->allExtendsStack ); + $paths_len = count( $rulesetNode->paths ); + + // look at each selector path in the ruleset, find any extend matches and then copy, find and replace + foreach ( $allExtends as $allExtend ) { + for ( $pathIndex = 0; $pathIndex < $paths_len; $pathIndex++ ) { + + // extending extends happens initially, before the main pass + if ( isset( $rulesetNode->extendOnEveryPath ) && $rulesetNode->extendOnEveryPath ) { + continue; + } + + $selectorPath = $rulesetNode->paths[$pathIndex]; + + if ( end( $selectorPath )->extendList ) { + continue; + } + + $this->ExtendMatch( $rulesetNode, $allExtend, $selectorPath ); + + } + } + } + + private function ExtendMatch( $rulesetNode, $extend, $selectorPath ) { + $matches = $this->findMatch( $extend, $selectorPath ); + + if ( $matches ) { + foreach ( $extend->selfSelectors as $selfSelector ) { + $rulesetNode->paths[] = $this->extendSelector( $matches, $selectorPath, $selfSelector ); + } + } + } + + private function findMatch( $extend, $haystackSelectorPath ) { + if ( !$this->HasMatches( $extend, $haystackSelectorPath ) ) { + return false; + } + + // + // look through the haystack selector path to try and find the needle - extend.selector + // returns an array of selector matches that can then be replaced + // + $needleElements = $extend->selector->elements; + $potentialMatches = array(); + $potentialMatches_len = 0; + $potentialMatch = null; + $matches = array(); + + // loop through the haystack elements + $haystack_path_len = count( $haystackSelectorPath ); + for ( $haystackSelectorIndex = 0; $haystackSelectorIndex < $haystack_path_len; $haystackSelectorIndex++ ) { + $hackstackSelector = $haystackSelectorPath[$haystackSelectorIndex]; + + $haystack_elements_len = count( $hackstackSelector->elements ); + for ( $hackstackElementIndex = 0; $hackstackElementIndex < $haystack_elements_len; $hackstackElementIndex++ ) { + + $haystackElement = $hackstackSelector->elements[$hackstackElementIndex]; + + // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. + if ( $extend->allowBefore || ( $haystackSelectorIndex === 0 && $hackstackElementIndex === 0 ) ) { + $potentialMatches[] = array( 'pathIndex' => $haystackSelectorIndex, 'index' => $hackstackElementIndex, 'matched' => 0, 'initialCombinator' => $haystackElement->combinator ); + $potentialMatches_len++; + } + + for ( $i = 0; $i < $potentialMatches_len; $i++ ) { + + $potentialMatch = &$potentialMatches[$i]; + $potentialMatch = $this->PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ); + + // if we are still valid and have finished, test whether we have elements after and whether these are allowed + if ( $potentialMatch && $potentialMatch['matched'] === $extend->selector->elements_len ) { + $potentialMatch['finished'] = true; + + if ( !$extend->allowAfter && ( $hackstackElementIndex + 1 < $haystack_elements_len || $haystackSelectorIndex + 1 < $haystack_path_len ) ) { + $potentialMatch = null; + } + } + + // if null we remove, if not, we are still valid, so either push as a valid match or continue + if ( $potentialMatch ) { + if ( $potentialMatch['finished'] ) { + $potentialMatch['length'] = $extend->selector->elements_len; + $potentialMatch['endPathIndex'] = $haystackSelectorIndex; + $potentialMatch['endPathElementIndex'] = $hackstackElementIndex + 1; // index after end of match + $potentialMatches = array(); // we don't allow matches to overlap, so start matching again + $potentialMatches_len = 0; + $matches[] = $potentialMatch; + } + continue; + } + + array_splice( $potentialMatches, $i, 1 ); + $potentialMatches_len--; + $i--; + } + } + } + + return $matches; + } + + // Before going through all the nested loops, lets check to see if a match is possible + // Reduces Bootstrap 3.1 compile time from ~6.5s to ~5.6s + private function HasMatches( $extend, $haystackSelectorPath ) { + if ( !$extend->selector->cacheable ) { + return true; + } + + $first_el = $extend->selector->_oelements[0]; + + foreach ( $haystackSelectorPath as $hackstackSelector ) { + if ( !$hackstackSelector->cacheable ) { + return true; + } + + // Optimisation: Explicit reference,  + if ( \array_key_exists( $first_el, $hackstackSelector->_oelements_assoc ) ) { + return true; + } + } + + return false; + } + + /** + * @param integer $hackstackElementIndex + */ + private function PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ) { + if ( $potentialMatch['matched'] > 0 ) { + + // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't + // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to work out + // what the resulting combinator will be + $targetCombinator = $haystackElement->combinator; + if ( $targetCombinator === '' && $hackstackElementIndex === 0 ) { + $targetCombinator = ' '; + } + + if ( $needleElements[ $potentialMatch['matched'] ]->combinator !== $targetCombinator ) { + return null; + } + } + + // if we don't match, null our match to indicate failure + if ( !$this->isElementValuesEqual( $needleElements[$potentialMatch['matched'] ]->value, $haystackElement->value ) ) { + return null; + } + + $potentialMatch['finished'] = false; + $potentialMatch['matched']++; + + return $potentialMatch; + } + + private function isElementValuesEqual( $elementValue1, $elementValue2 ) { + if ( $elementValue1 === $elementValue2 ) { + return true; + } + + if ( is_string( $elementValue1 ) || is_string( $elementValue2 ) ) { + return false; + } + + if ( $elementValue1 instanceof Less_Tree_Attribute ) { + return $this->isAttributeValuesEqual( $elementValue1, $elementValue2 ); + } + + $elementValue1 = $elementValue1->value; + if ( $elementValue1 instanceof Less_Tree_Selector ) { + return $this->isSelectorValuesEqual( $elementValue1, $elementValue2 ); + } + + return false; + } + + /** + * @param Less_Tree_Selector $elementValue1 + */ + private function isSelectorValuesEqual( $elementValue1, $elementValue2 ) { + $elementValue2 = $elementValue2->value; + if ( !( $elementValue2 instanceof Less_Tree_Selector ) || $elementValue1->elements_len !== $elementValue2->elements_len ) { + return false; + } + + for ( $i = 0; $i < $elementValue1->elements_len; $i++ ) { + + if ( $elementValue1->elements[$i]->combinator !== $elementValue2->elements[$i]->combinator ) { + if ( $i !== 0 || ( $elementValue1->elements[$i]->combinator || ' ' ) !== ( $elementValue2->elements[$i]->combinator || ' ' ) ) { + return false; + } + } + + if ( !$this->isElementValuesEqual( $elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value ) ) { + return false; + } + } + + return true; + } + + /** + * @param Less_Tree_Attribute $elementValue1 + */ + private function isAttributeValuesEqual( $elementValue1, $elementValue2 ) { + if ( $elementValue1->op !== $elementValue2->op || $elementValue1->key !== $elementValue2->key ) { + return false; + } + + if ( !$elementValue1->value || !$elementValue2->value ) { + if ( $elementValue1->value || $elementValue2->value ) { + return false; + } + return true; + } + + $elementValue1 = ( $elementValue1->value->value ? $elementValue1->value->value : $elementValue1->value ); + $elementValue2 = ( $elementValue2->value->value ? $elementValue2->value->value : $elementValue2->value ); + + return $elementValue1 === $elementValue2; + } + + private function extendSelector( $matches, $selectorPath, $replacementSelector ) { + // for a set of matches, replace each match with the replacement selector + + $currentSelectorPathIndex = 0; + $currentSelectorPathElementIndex = 0; + $path = array(); + $selectorPath_len = count( $selectorPath ); + + for ( $matchIndex = 0, $matches_len = count( $matches ); $matchIndex < $matches_len; $matchIndex++ ) { + + $match = $matches[$matchIndex]; + $selector = $selectorPath[ $match['pathIndex'] ]; + + $firstElement = new Less_Tree_Element( + $match['initialCombinator'], + $replacementSelector->elements[0]->value, + $replacementSelector->elements[0]->index, + $replacementSelector->elements[0]->currentFileInfo + ); + + if ( $match['pathIndex'] > $currentSelectorPathIndex && $currentSelectorPathElementIndex > 0 ) { + $last_path = end( $path ); + $last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex ) ); + $currentSelectorPathElementIndex = 0; + $currentSelectorPathIndex++; + } + + $newElements = array_merge( + array_slice( $selector->elements, $currentSelectorPathElementIndex, ( $match['index'] - $currentSelectorPathElementIndex ) ), // last parameter of array_slice is different than the last parameter of javascript's slice + array( $firstElement ), + array_slice( $replacementSelector->elements, 1 ) + ); + + if ( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ) { + $last_key = count( $path ) - 1; + $path[$last_key]->elements = array_merge( $path[$last_key]->elements, $newElements ); + } else { + $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] ) ); + $path[] = new Less_Tree_Selector( $newElements ); + } + + $currentSelectorPathIndex = $match['endPathIndex']; + $currentSelectorPathElementIndex = $match['endPathElementIndex']; + if ( $currentSelectorPathElementIndex >= count( $selectorPath[$currentSelectorPathIndex]->elements ) ) { + $currentSelectorPathElementIndex = 0; + $currentSelectorPathIndex++; + } + } + + if ( $currentSelectorPathIndex < $selectorPath_len && $currentSelectorPathElementIndex > 0 ) { + $last_path = end( $path ); + $last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex ) ); + $currentSelectorPathIndex++; + } + + $slice_len = $selectorPath_len - $currentSelectorPathIndex; + $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $slice_len ) ); + + return $path; + } + + protected function visitMedia( $mediaNode ) { + $newAllExtends = array_merge( $mediaNode->allExtends, end( $this->allExtendsStack ) ); + $this->allExtendsStack[] = $this->doExtendChaining( $newAllExtends, $mediaNode->allExtends ); + } + + protected function visitMediaOut() { + array_pop( $this->allExtendsStack ); + } + + protected function visitDirective( $directiveNode ) { + $newAllExtends = array_merge( $directiveNode->allExtends, end( $this->allExtendsStack ) ); + $this->allExtendsStack[] = $this->doExtendChaining( $newAllExtends, $directiveNode->allExtends ); + } + + protected function visitDirectiveOut() { + array_pop( $this->allExtendsStack ); + } + +} diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php b/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php new file mode 100755 index 0000000..e90f211 --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php @@ -0,0 +1,280 @@ +visitObj( $root ); + } + + public function visitRule( $ruleNode ) { + if ( $ruleNode->variable ) { + return array(); + } + return $ruleNode; + } + + public function visitMixinDefinition( $mixinNode ) { + // mixin definitions do not get eval'd - this means they keep state + // so we have to clear that state here so it isn't used if toCSS is called twice + $mixinNode->frames = array(); + return array(); + } + + public function visitExtend() { + return array(); + } + + public function visitComment( $commentNode ) { + if ( $commentNode->isSilent() ) { + return array(); + } + return $commentNode; + } + + public function visitMedia( $mediaNode, &$visitDeeper ) { + $mediaNode->accept( $this ); + $visitDeeper = false; + + if ( !$mediaNode->rules ) { + return array(); + } + return $mediaNode; + } + + public function visitDirective( $directiveNode ) { + if ( isset( $directiveNode->currentFileInfo['reference'] ) && ( !property_exists( $directiveNode, 'isReferenced' ) || !$directiveNode->isReferenced ) ) { + return array(); + } + if ( $directiveNode->name === '@charset' ) { + // Only output the debug info together with subsequent @charset definitions + // a comment (or @media statement) before the actual @charset directive would + // be considered illegal css as it has to be on the first line + if ( isset( $this->charset ) && $this->charset ) { + + // if( $directiveNode->debugInfo ){ + // $comment = new Less_Tree_Comment('/* ' . str_replace("\n",'',$directiveNode->toCSS())." */\n"); + // $comment->debugInfo = $directiveNode->debugInfo; + // return $this->visit($comment); + //} + + return array(); + } + $this->charset = true; + } + return $directiveNode; + } + + public function checkPropertiesInRoot( $rulesetNode ) { + if ( !$rulesetNode->firstRoot ) { + return; + } + + foreach ( $rulesetNode->rules as $ruleNode ) { + if ( $ruleNode instanceof Less_Tree_Rule && !$ruleNode->variable ) { + $msg = "properties must be inside selector blocks, they cannot be in the root. Index ".$ruleNode->index.( $ruleNode->currentFileInfo ? ( ' Filename: '.$ruleNode->currentFileInfo['filename'] ) : null ); + throw new Less_Exception_Compiler( $msg ); + } + } + } + + public function visitRuleset( $rulesetNode, &$visitDeeper ) { + $visitDeeper = false; + + $this->checkPropertiesInRoot( $rulesetNode ); + + if ( $rulesetNode->root ) { + return $this->visitRulesetRoot( $rulesetNode ); + } + + $rulesets = array(); + $rulesetNode->paths = $this->visitRulesetPaths( $rulesetNode ); + + // Compile rules and rulesets + $nodeRuleCnt = $rulesetNode->rules ? count( $rulesetNode->rules ) : 0; + for ( $i = 0; $i < $nodeRuleCnt; ) { + $rule = $rulesetNode->rules[$i]; + + if ( property_exists( $rule, 'rules' ) ) { + // visit because we are moving them out from being a child + $rulesets[] = $this->visitObj( $rule ); + array_splice( $rulesetNode->rules, $i, 1 ); + $nodeRuleCnt--; + continue; + } + $i++; + } + + // accept the visitor to remove rules and refactor itself + // then we can decide now whether we want it or not + if ( $nodeRuleCnt > 0 ) { + $rulesetNode->accept( $this ); + + if ( $rulesetNode->rules ) { + + if ( count( $rulesetNode->rules ) > 1 ) { + $this->_mergeRules( $rulesetNode->rules ); + $this->_removeDuplicateRules( $rulesetNode->rules ); + } + + // now decide whether we keep the ruleset + if ( $rulesetNode->paths ) { + // array_unshift($rulesets, $rulesetNode); + array_splice( $rulesets, 0, 0, array( $rulesetNode ) ); + } + } + + } + + if ( count( $rulesets ) === 1 ) { + return $rulesets[0]; + } + return $rulesets; + } + + /** + * Helper function for visitiRuleset + * + * return array|Less_Tree_Ruleset + */ + private function visitRulesetRoot( $rulesetNode ) { + $rulesetNode->accept( $this ); + if ( $rulesetNode->firstRoot || $rulesetNode->rules ) { + return $rulesetNode; + } + return array(); + } + + /** + * Helper function for visitRuleset() + * + * @return array + */ + private function visitRulesetPaths( $rulesetNode ) { + $paths = array(); + foreach ( $rulesetNode->paths as $p ) { + if ( $p[0]->elements[0]->combinator === ' ' ) { + $p[0]->elements[0]->combinator = ''; + } + + foreach ( $p as $pi ) { + if ( $pi->getIsReferenced() && $pi->getIsOutput() ) { + $paths[] = $p; + break; + } + } + } + + return $paths; + } + + protected function _removeDuplicateRules( &$rules ) { + // remove duplicates + $ruleCache = array(); + for ( $i = count( $rules ) - 1; $i >= 0; $i-- ) { + $rule = $rules[$i]; + if ( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_NameValue ) { + + if ( !isset( $ruleCache[$rule->name] ) ) { + $ruleCache[$rule->name] = $rule; + } else { + $ruleList =& $ruleCache[$rule->name]; + + if ( $ruleList instanceof Less_Tree_Rule || $ruleList instanceof Less_Tree_NameValue ) { + $ruleList = $ruleCache[$rule->name] = array( $ruleCache[$rule->name]->toCSS() ); + } + + $ruleCSS = $rule->toCSS(); + if ( array_search( $ruleCSS, $ruleList ) !== false ) { + array_splice( $rules, $i, 1 ); + } else { + $ruleList[] = $ruleCSS; + } + } + } + } + } + + protected function _mergeRules( &$rules ) { + $groups = array(); + + // obj($rules); + + $rules_len = count( $rules ); + for ( $i = 0; $i < $rules_len; $i++ ) { + $rule = $rules[$i]; + + if ( ( $rule instanceof Less_Tree_Rule ) && $rule->merge ) { + + $key = $rule->name; + if ( $rule->important ) { + $key .= ',!'; + } + + if ( !isset( $groups[$key] ) ) { + $groups[$key] = array(); + } else { + array_splice( $rules, $i--, 1 ); + $rules_len--; + } + + $groups[$key][] = $rule; + } + } + + foreach ( $groups as $parts ) { + + if ( count( $parts ) > 1 ) { + $rule = $parts[0]; + $spacedGroups = array(); + $lastSpacedGroup = array(); + $parts_mapped = array(); + foreach ( $parts as $p ) { + if ( $p->merge === '+' ) { + if ( $lastSpacedGroup ) { + $spacedGroups[] = self::toExpression( $lastSpacedGroup ); + } + $lastSpacedGroup = array(); + } + $lastSpacedGroup[] = $p; + } + + $spacedGroups[] = self::toExpression( $lastSpacedGroup ); + $rule->value = self::toValue( $spacedGroups ); + } + } + + } + + public static function toExpression( $values ) { + $mapped = array(); + foreach ( $values as $p ) { + $mapped[] = $p->value; + } + return new Less_Tree_Expression( $mapped ); + } + + public static function toValue( $values ) { + // return new Less_Tree_Value($values); ?? + + $mapped = array(); + foreach ( $values as $p ) { + $mapped[] = $p; + } + return new Less_Tree_Value( $mapped ); + } +} diff --git a/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php b/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php new file mode 100755 index 0000000..cd401ad --- /dev/null +++ b/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php @@ -0,0 +1,70 @@ +type; + if ( isset( $this->_visitFnCache[$funcName] ) ) { + + $visitDeeper = true; + $node = $this->$funcName( $node, $visitDeeper ); + + if ( $node ) { + if ( $visitDeeper && is_object( $node ) ) { + $node->accept( $this ); + } + + $funcName = $funcName . "Out"; + if ( isset( $this->_visitFnCache[$funcName] ) ) { + $this->$funcName( $node ); + } + } + + } else { + $node->accept( $this ); + } + + return $node; + } + + public function visitArray( $nodes ) { + $newNodes = array(); + foreach ( $nodes as $node ) { + $evald = $this->visitObj( $node ); + if ( $evald ) { + if ( is_array( $evald ) ) { + self::flatten( $evald, $newNodes ); + } else { + $newNodes[] = $evald; + } + } + } + return $newNodes; + } + + public function flatten( $arr, &$out ) { + foreach ( $arr as $item ) { + if ( !is_array( $item ) ) { + $out[] = $item; + continue; + } + + foreach ( $item as $nestedItem ) { + if ( is_array( $nestedItem ) ) { + self::flatten( $nestedItem, $out ); + } else { + $out[] = $nestedItem; + } + } + } + + return $out; + } + +}