text:
/** @file */	// Doxygen marker

#import "CC3Identifiable.h"
#import "CC3NodeVisitor.h"
#import "CC3TextureUnit.h"
#import "CC3GLTexture.h"

#pragma mark -
#pragma mark CC3Texture

/**
 * Each instance of CC3Texture wraps a CC3GLTexture instance and a CC3TextureUnit instance,
 * and manages applying the texture and texture unit settings to the GL engine.
 *
 * To conserve memory and improve texture loading performance, CC3GLTexture instances are
 * cached, and many CC3Texture instances can share the same underlying CC3GLTexture instance.
 * You can therefore create many CC3Texture instances loaded from the same texture file,
 * without having to worry about the texture contents being loaded multiple times.
 *
 * In most cases, a material will hold a single instance of CC3Texture in the texture property
 * to provide a simple single-texture surface. This is the most common application of textures
 * to a material.
 *
 * For more sophisticated surfaces, materials also support multi-texturing, where more than
 * one instance of CC3Texture is added to the material. With multi-texturing, several textures
 * can be combined in flexible, customized fashion, permitting sophisticated surface effects.
 *
 * With OpenGL, multi-texturing is processed by a chain of texture units. The material's
 * first texture is processed by the first texture unit (texture unit zero), and subsequent
 * textures held in the material are processed by subsequent texture units, in the order in
 * which the textures were added to the material.
 *
 * Under OpenGL ES 1.1, or OpenGL using a fixed-function pipeline, each texture unit combines
 * its texture with the output of the previous texture unit in the chain. Combining textures
 * is quite flexible under OpenGL, and there are many ways that each texture can be combined
 * with the output of the previous texture unit. The way that a particular texture combines
 * with the previous textures is defined by an instance of CC3TextureUnit, held in the
 * textureUnit property of each texture that was added to the material.
 *
 * For example, to configure a material for bump-mapping, add a texture that contains a
 * normal vector at each pixel instead of a color, and set the textureUnit property of
 * the texture to a CC3BumpMapTextureUnit. Then add another texture, containing the image
 * that will be visible, to the material. The material will combine these two textures,
 * as specified by the CC3TextureUnit held by the second texture.
 *
 * Under OpenGL ES 2.0 or OpenGL with a programmable pipeline, you will generally handle
 * multitexturing in the shader code.
 */
@interface CC3Texture : CC3Identifiable {
	CC3GLTexture* _texture;
	CC3TextureUnit* _textureUnit;
}

/**
 * The CC3GLTexture texture being managed by this instance.
 *
 * This property is populated automatically by the loadTextureFile: method, or one
 * of the file-loading initialization methods, but it can also be set directly to
 * a CC3GLTexture that has already been loaded.
 *
 * If this instance does not yet have a name, it is set to the name of the specified
 * CC3GLTexture instance.
 */
@property(nonatomic, retain) CC3GLTexture* texture;

/**
 * The texture environment settings that are applied to the texture unit that draws this
 * texture, when this texture participates in multi-texturing.
 *
 * The texture unit is optional, and this propety may be left as nil to provide standard
 * single texture rendering. The default value of this property is nil.
 *
 * The texture unit can be used to configure how the texture will be combined with other
 * textures when using multi-texturing. When the material supports multiple textures, each
 * texture should contain a texture unit that describes how the GL engine should combine
 * that texture with the textures that have already been applied.
 *
 * Different subclasses of CC3TextureUnit provide different customizations for combining textures. The
 * CC3BumpMapTextureUnit provides easy settings for DOT3 bump-mapping, and CC3ConfigurableTextureUnit
 * provides complete flexibility in setting texture environment settings.
 */
@property(nonatomic, retain) CC3TextureUnit* textureUnit;

/**
 * Returns whether the alpha channel of this texture has already been multiplied
 * into each of the RGB color channels.
 *
 * This is a convenience property that simply returns the value of the same property on the
 * underlying CC3GLTexture instance.
 */
@property(nonatomic,readonly) BOOL hasPremultipliedAlpha;

/**
 * Returns whether this texture is flipped upside-down.
 *
 * The vertical axis of the coordinate system of OpenGL is inverted relative to the
 * CoreGraphics view coordinate system. As a result, some texture file formats may be
 * loaded upside down. Most common file formats, including JPG, PNG & PVR are loaded
 * right-way up, but using proprietary texture formats developed for other platforms
 * may result in textures being loaded upside-down.
 *
 * This is a convenience property that simply returns the value of the same property on the
 * underlying CC3GLTexture instance.
 */
@property(nonatomic, readonly) BOOL isFlippedVertically;

/** Returns whether this texture is a standard two-dimentional texture. */
@property(nonatomic, readonly) BOOL isTexture2D;

/** Returns whether this texture is a six-sided cube-map texture. */
@property(nonatomic, readonly) BOOL isTextureCube;

/**
 * Returns the proportional size of the usable image in the texture, relative to its physical size.
 *
 * The physical size of most textures is some power-of-two (POT), whereas the usable image size is
 * the actual portion of it that contains the image. The returned value contains two fractional floats
 * (width & height), each between zero and one, representing the proportional size of the usable image
 *
 * As an example, an image whose dimensions are actually 320 x 480 pixels will result in a texture
 * that is 512 x 512 pixels, and the mapSize returned by this method will be {0.625, 0.9375},
 * calculated from {320/512, 480/512}.
 *
 * This is a convenience property that simply returns the value of the same property on the
 * underlying CC3GLTexture instance.
 */
@property(nonatomic, readonly) CGSize coverage;

/**
 * The direction, in local tangent coordinates, of the light source that is to
 * interact with this texture if the texture unit has been configured as a bump-map.
 *
 * Bump-maps are textures that store a normal vector (XYZ coordinates) in
 * the RGB components of each texture pixel, instead of color information.
 * These per-pixel normals interact with the value of this lightDirection
 * property (through a dot-product), to determine the luminance of the pixel.
 *
 * Setting this property sets the equivalent property in the texture unit.
 *
 * Reading this value returns the value of the equivalent property in the
 * texture unit, or returns kCC3VectorZero if this texture has no textureUnit.
 *
 * The value of this property must be in the tangent-space coordinates associated
 * with the texture UV space, in practice, this property is typically not set
 * directly. Instead, you can use the globalLightPosition property of the mesh
 * node that is making use of this texture.
 */
@property(nonatomic, assign) CC3Vector lightDirection;

/**
 * Returns whether this texture contains a texture unit that is configured as a bump-map.
 *
 * Returns YES only if the textureUnit property is not nil, and the same property on that
 * texture unit is set to YES. Otherwise, this property returns NO.
 */
@property(nonatomic, readonly) BOOL isBumpMap;

#pragma mark Texture file loading

/**
 * Loads the texture file at the specified file path into the texture property,
 * and returns whether the loading was successful.
 *
 * The specified file path may be either an absolute path, or a path relative to the
 * application resource directory. If the file is located directly in the application
 * resources directory, the specified file path can simply be the name of the file.
 *
 * If this instance does not yet have a name, it is set to the unqualified file name from
 * the specified file path.
 *
 * If the instance is instantiated with either initFromFile: or textureFromFile:, this method will
 * be invoked automatically during instance initialization. If the instance is instantiated without
 * using one of the file-loading methods, this method can be invoked directly to load the file.
 *
 * Each texture file is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path will only load the file once.
 * All instances that have invoked this method on the same file path will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, and the texture files do
 * not already contain a mipmap, a mipmap will be generated for the texture automatically.
 */
-(BOOL) loadTextureFile: (NSString*) aFilePath;

/**
 * Loads the six cube face textures at the specified file paths, and returns whether all
 * six files were successfully loaded.
 *
 * If this instance has not been assigned a name, it is set to the unqualified file name
 * of the specified posXFilePath file path.
 *
 * If the instance is instantiated via initFromFilesPosX:negX:posY:negY:posZ:negZ: or
 * textureFromFilesPosX:negX:posY:negY:posZ:negZ:, this method is invoked automatically
 * during instance initialization. If the instance is instantiated without using one of
 * those file-loading initializers, this method can be invoked directly to load the files.
 *
 * Each of the specified file paths may be either an absolute path, or a path relative to
 * the application resource directory. If the file is located directly in the application
 * resources directory, the corresponding file path can simply be the name of the file.
 *
 * Each underlying texture is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same posXFilePath file name will only load the textures
 * once. All instances that have invoked this method on the same posXFilePath file path will
 * share the same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the underlying texture automatically.
 */
-(BOOL) loadCubeMapFromFilesPosX: (NSString*) posXFilePath negX: (NSString*) negXFilePath
							posY: (NSString*) posYFilePath negY: (NSString*) negYFilePath
							posZ: (NSString*) posZFilePath negZ: (NSString*) negZFilePath;

/**
 * Loads the six cube face textures using the specified pattern string as a string format
 * template to derive the names of the six textures, and returns whether all six files were
 * successfully loaded.
 *
 * If the instance is instantiated via initFromFilePattern: or textureFromFilePattern:,
 * this method is invoked automatically during instance initialization. If the instance
 * is instantiated without using one of those file-loading initializers, this method can
 * be invoked directly to load the files.
 *
 * This method expects the six required files to have identical paths and names, except that
 * each should contain one of the following character substrings in the same place in each
 * file path: "PosX", "NegX", "PosY", "NegY", "PosZ", "NegZ".
 *
 * The specified file path pattern should include one standard NSString format marker %@ at
 * the point where one of the substrings in the list above should be substituted.
 *
 * As an example, the file path pattern MyCubeTex%@.png would be expanded by this method
 * to load the following six textures:
 *  - MyCubeTexPosX.png
 *  - MyCubeTexNegX.png
 *  - MyCubeTexPosY.png
 *  - MyCubeTexNegY.png
 *  - MyCubeTexPosZ.png
 *  - MyCubeTexNegZ.png
 *
 * The format marker can occur anywhere in the file name. It does not need to occur at the
 * end as in this example.
 *
 * The specified file path pattern may be either an absolute path, or a path relative to
 * the application resource directory. If the file is located directly in the application
 * resources directory, the specified file path pattern can simply be the file name pattern.
 *
 * If this instance has not been assigned a name, it is set to the unqualified file name
 * derived from substituting an empty string into the format marker in the specified file
 * path pattern string.
 *
 * Each underlying texture is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path pattern will only load the textures once.
 * All instances that have invoked this method on the same file path pattern will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the underlying texture automatically.
 */
-(BOOL) loadCubeMapFromFilePattern: (NSString*) aFilePathPattern;

#pragma mark Allocation and Initialization

/**
 * Initializes this instance by loading the texture file at the specified file path.
 *
 * The specified file path may be either an absolute path, or a path relative to the
 * application resource directory. If the file is located directly in the application
 * resources directory, the specified file path can simply be the name of the file.
 *
 * The name of this instance is set to the unqualified file name from the specified
 * file path and the tag is set to an automatically generated unique tag value.
 *
 * Each texture file is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path will only load the file once.
 * All instances that have invoked this method on the same file path will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * Returns nil if the file could not be loaded.
 */
-(id) initFromFile: (NSString*) aFilePath;

/**
 * Allocates and initializes an autoreleased instance loaded from the texture file at
 * the specified file path.
 *
 * The specified file path may be either an absolute path, or a path relative to the
 * application resource directory. If the file is located directly in the application
 * resources directory, the specified file path can simply be the name of the file.
 *
 * The name of this instance is set to the unqualified file name from the specified
 * file path and the tag is set to an automatically generated unique tag value.
 *
 * Each texture file is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path will only load the file once.
 * All instances created by invoking this method on the same file path will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * Returns nil if the file could not be loaded.
 */
+(id) textureFromFile: (NSString*) aFilePath;

/**
 * Initializes this instance with the specified name and loaded from the texture file
 * at the specified file path.
 *
 * The specified file path may be either an absolute path, or a path relative to the
 * application resource directory. If the file is located directly in the application
 * resources directory, the specified file path can simply be the name of the file.
 *
 * Each texture file is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path will only load the file once.
 * All instances that have invoked this method on the same file path will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * Returns nil if the file could not be loaded.
 */
-(id) initWithName: (NSString*) aName fromFile: (NSString*) aFilePath;

/**
 * Allocates and initializes an autoreleased instance with the specified name and loaded
 * from the texture file at the specified file path.
 *
 * The specified file path may be either an absolute path, or a path relative to the
 * application resource directory. If the file is located directly in the application
 * resources directory, the specified file path can simply be the name of the file.
 *
 * Each texture file is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path will only load the file once.
 * All instances created by invoking this method on the same name will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * Returns nil if the file could not be loaded.
 */
+(id) textureWithName: (NSString*) aName fromFile: (NSString*) aFilePath;

/**
 * Initializes this instance by loading the six cube face textures at the specified file paths,
 * and returns whether all six files were successfully loaded.
 *
 * Each of the specified file paths may be either an absolute path, or a path relative to
 * the application resource directory. If the file is located directly in the application
 * resources directory, the corresponding file path can simply be the name of the file.
 *
 * The name of this instance is set to the unqualified file name of the specified posXFilePath file path.
 *
 * Each underlying texture is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same posXFilePath file name will only load the textures
 * once. All instances that have invoked this method on the same posXFilePath file name will
 * share the same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the underlying texture automatically.
 *
 * Returns nil if any of the six files could not be loaded.
 */
-(id) initCubeMapFromFilesPosX: (NSString*) posXFilePath negX: (NSString*) negXFilePath
						  posY: (NSString*) posYFilePath negY: (NSString*) negYFilePath
						  posZ: (NSString*) posZFilePath negZ: (NSString*) negZFilePath;

/**
 * Returns an instance initialized by loading the six cube face textures at the specified
 * file paths, and returns whether all six files were successfully loaded.
 *
 * Each of the specified file paths may be either an absolute path, or a path relative to
 * the application resource directory. If the file is located directly in the application
 * resources directory, the corresponding file path can simply be the name of the file.
 *
 * The name of this instance is set to the unqualified file name of the specified posXFilePath file path.
 *
 * Each underlying texture is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same posXFilePath file name will only load the textures
 * once. All instances created by invoking this method on the same posXFilePath file name will
 * share the same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the underlying texture automatically.
 *
 * Returns nil if any of the six files could not be loaded.
 */
+(id) textureCubeMapFromFilesPosX: (NSString*) posXFilePath negX: (NSString*) negXFilePath
							 posY: (NSString*) posYFilePath negY: (NSString*) negYFilePath
							 posZ: (NSString*) posZFilePath negZ: (NSString*) negZFilePath;

/**
 * Initializes this instance by loading the six cube face textures using the specified pattern
 * string as a string format template to derive the names of the six textures, and returns whether
 * all six files were successfully loaded.
 *
 * This method expects the six required files to have identical paths and names, except that
 * each should contain one of the following character substrings in the same place in each
 * file path: "PosX", "NegX", "PosY", "NegY", "PosZ", "NegZ".
 *
 * The specified file path pattern should include one standard NSString format marker %@ at
 * the point where one of the substrings in the list above should be substituted.
 *
 * As an example, the file path pattern MyCubeTex%@.png would be expanded by this method
 * to load the following six textures:
 *  - MyCubeTexPosX.png
 *  - MyCubeTexNegX.png
 *  - MyCubeTexPosY.png
 *  - MyCubeTexNegY.png
 *  - MyCubeTexPosZ.png
 *  - MyCubeTexNegZ.png
 *
 * The format marker can occur anywhere in the file name. It does not need to occur at the
 * end as in this example.
 *
 * The specified file path pattern may be either an absolute path, or a path relative to
 * the application resource directory. If the file is located directly in the application
 * resources directory, the specified file path pattern can simply be the file name pattern.
 *
 * The name of this instance is set to the unqualified file name derived from substituting
 * an empty string into the format marker in the specified file path pattern string.
 *
 * Each underlying texture is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path pattern will only load the textures once.
 * All instances that have invoked this method on the same file path pattern will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the underlying texture automatically.
 *
 * Returns nil if any of the six files could not be loaded.
 */
-(id) initCubeMapFromFilePattern: (NSString*) aFilePathPattern;

/**
 * Returns an instance initialized by loading the six cube face textures using the specified pattern
 * string as a string format template to derive the names of the six textures, and returns whether
 * all six files were successfully loaded.
 *
 * This method expects the six required files to have identical paths and names, except that
 * each should contain one of the following character substrings in the same place in each
 * file path: "PosX", "NegX", "PosY", "NegY", "PosZ", "NegZ".
 *
 * The specified file path pattern should include one standard NSString format marker %@ at
 * the point where one of the substrings in the list above should be substituted.
 *
 * As an example, the file path pattern MyCubeTex%@.png would be expanded by this method
 * to load the following six textures:
 *  - MyCubeTexPosX.png
 *  - MyCubeTexNegX.png
 *  - MyCubeTexPosY.png
 *  - MyCubeTexNegY.png
 *  - MyCubeTexPosZ.png
 *  - MyCubeTexNegZ.png
 *
 * The format marker can occur anywhere in the file name. It does not need to occur at the
 * end as in this example.
 *
 * The specified file path pattern may be either an absolute path, or a path relative to
 * the application resource directory. If the file is located directly in the application
 * resources directory, the specified file path pattern can simply be the file name pattern.
 *
 * If the class-side shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the texture automatically.
 *
 * The name of this instance is set to the unqualified file name derived from substituting
 * an empty string into the format marker in the specified file path pattern string.
 *
 * Each underlying texture is globally cached upon loading. Invoking this method on multiple
 * instances of CC3Texture with the same file path pattern will only load the textures once.
 * All instances created by invoking this method on the same file path pattern will share the
 * same instance of the underlying CC3GLTexture held in the texture property.
 *
 * If the CC3GLTexture.shouldGenerateMipmaps property is set to YES, a mipmap will be generated
 * for the underlying texture automatically.
 *
 * Returns nil if any of the six files could not be loaded.
 */
+(id) textureCubeMapFromFilePattern: (NSString*) aFilePathPattern;

#pragma mark Drawing

/**
 * If the texture property is not nil, draws the texture to the GL engine as follows:
 *   - Binds the texture to the next available GL texture unit in the GL engine.
 *   - Binds the textureUnit to the GL texture unit to configure how the GL texture unit
 *     will combine this texture with the output of any previous texture units when multiple
 *     texures are overlaid on a single material. If the textureUnit property is nil, the
 *     default single-texture configuration is established via the class-side bindDefaultTo:
 *     method of CC3TextureUnit.
 *   - Increments the textureUnit property of the specfied visitor to indicate that this
 *     texture has used one of the GL texture units, and that any further textures for the
 *     same material should use different GL texture units.
 */
-(void) drawWithVisitor: (CC3NodeDrawingVisitor*) visitor;

@end

#pragma mark -
#pragma mark Deprecated functionality

/** Extension category to support deprecated functionality. */
@interface CC3Texture (Deprecated)

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, readonly) GLuint textureID DEPRECATED_ATTRIBUTE;

/** @deprecated Renamed to coverage. */
@property(nonatomic, readonly) CGSize mapSize DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, readonly) BOOL hasMipmap DEPRECATED_ATTRIBUTE;

/** @deprecated Access this method on the contained CC3GLTexture. */
-(void) generateMipmap DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the CC3GLTexture class. */
+(BOOL) shouldGenerateMipmaps DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the CC3GLTexture class. */
+(void) setShouldGenerateMipmaps: (BOOL) shouldMipmap DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, assign) GLenum minifyingFunction DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, assign) GLenum magnifyingFunction DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, assign) GLenum horizontalWrappingFunction DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, assign) GLenum verticalWrappingFunction DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
@property(nonatomic, assign) ccTexParams textureParameters DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
+(ccTexParams) defaultTextureParameters DEPRECATED_ATTRIBUTE;

/** @deprecated Access this property on the contained CC3GLTexture. */
+(void) setDefaultTextureParameters: (ccTexParams) texParams DEPRECATED_ATTRIBUTE;

/** @deprecated Use the initWithTag: and then loadFromFile: methods. */
-(id) initWithTag: (GLuint) aTag fromFile: (NSString*) aFilePath DEPRECATED_ATTRIBUTE;

/** @deprecated Use the initWithTag: and then loadFromFile: methods. */
+(id) textureWithTag: (GLuint) aTag fromFile: (NSString*) aFilePath DEPRECATED_ATTRIBUTE;

/** @deprecated Use the initWithTag:withName: and then loadFromFile: methods. */
-(id) initWithTag: (GLuint) aTag withName: (NSString*) aName fromFile: (NSString*) aFilePath DEPRECATED_ATTRIBUTE;

/** @deprecated Use the initWithTag:withName: and then loadFromFile: methods. */
+(id) textureWithTag: (GLuint) aTag withName: (NSString*) aName fromFile: (NSString*) aFilePath DEPRECATED_ATTRIBUTE;

@end


text:
<?php

declare(strict_types=1);

namespace Psalm\Tests\Template;

use Psalm\Tests\TestCase;
use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait;
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;

class ValueOfTemplateTest extends TestCase
{
    use InvalidCodeAnalysisTestTrait;
    use ValidCodeAnalysisTestTrait;

    /**
     *
     */
    public function providerValidCodeParse(): iterable
    {
        return [
            'acceptsArrayValuesFn' => [
                'code' => '<?php
                    /**
                     * @template T of array
                     * @param T $array
                     * @return value-of<T>[]
                     */
                    function getValues($array) {
                        return array_values($array);
                    }
                '
            ],
            'SKIPPED-acceptsIfInArrayFn' => [
                'code' => '<?php
                    /**
                     * @template T of array
                     * @param T $array
                     * @return value-of<T>|null
                     */
                    function getValue(string $value, $array) {
                        if (in_array($value, $array)) {
                            return $value;
                        }
                        return null;
                    }
                '
            ],
            'valueOfUnreplacedTemplateParam' => [
                'code' => '<?php
                    /**
                     * @template T as array<bool>
                     */
                    abstract class Foo {
                        /**
                         * @return value-of<T>
                         */
                        abstract public function getRandomValue(): bool;
                    }
                ',
            ],
            'valueOfNestedTemplates' => [
                'code' => '<?php
                    /**
                     * @template TValue
                     * @template TArray of array<TValue>
                     * @param TArray $array
                     * @return list<TValue>
                     */
                    function toList(array $array): array {
                        return array_values($array);
                    }'
            ],
        ];
    }

    /**
     *
     */
    public function providerInvalidCodeParse(): iterable
    {
        return [
            'valueOfTemplateNotIncludesString' => [
                'code' => '<?php
                    /**
                     * @template T of array
                     * @param T $array
                     * @return value-of<T>
                     */
                    function getValue($array) {
                        return "foo";
                    }
                ',
                'error_message' => 'InvalidReturnStatement'
            ],
            'valueOfTemplateNotIncludesInt' => [
                'code' => '<?php
                    /**
                     * @template T of array
                     * @param T $array
                     * @return value-of<T>
                     */
                    function getValue($array) {
                        return 0;
                    }
                ',
                'error_message' => 'InvalidReturnStatement'
            ],
            'valueOfUnresolvedTemplateParamIsStillChecked' => [
                'code' => '<?php
                    /**
                     * @template T as array<bool>
                     */
                    abstract class Foo {
                        /**
                         * @return value-of<T>
                         */
                        abstract public function getRandomValue(): string;
                    }
                ',
                'error_message' => 'MismatchingDocblockReturnType'
            ],
        ];
    }
}

redpajama_set_name: RedPajamaGithub


text:
> Show or set the system's host name.

- Show current host name:

`hostname`

- Show the network address of the host name:

`hostname -i`

- Show all network addresses of the host:

`hostname -I`

- Show the FQDN (Fully Qualified Domain Name):

`hostname --fqdn`

- Set current host name:

`hostname {{new_hostname}}`


text:
package com.dynious.refinedrelocation.api;

import com.dynious.refinedrelocation.api.filter.IFilterGUI;
import com.dynious.refinedrelocation.api.relocator.IItemRelocator;
import com.dynious.refinedrelocation.api.relocator.IRelocatorModule;
import com.dynious.refinedrelocation.api.tileentity.IFilterTileGUI;
import com.dynious.refinedrelocation.api.tileentity.handlers.ISortingInventoryHandler;
import com.dynious.refinedrelocation.api.tileentity.handlers.ISortingMemberHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;

public interface IAPIHandler
{
    public Object getModInstance();

    public int getFilteringGUIID();

    public IFilterGUI createStandardFilter(IFilterTileGUI filterTile);

    public ISortingMemberHandler createSortingMemberHandler(TileEntity owner);

    public ISortingInventoryHandler createSortingInventoryHandler(TileEntity owner);

    public void registerRelocatorModule(String identifier, Class<? extends IRelocatorModule> clazz) throws IllegalArgumentException;

    public void openRelocatorModuleGUI(IItemRelocator relocator, EntityPlayer player, int side);

    public void registerToolboxClazz(Class clazz);

    public ItemStack insert(TileEntity tile, ItemStack itemStack, ForgeDirection side, boolean simulate);
}


text:
Scroll to Top

			<?php $gifs = array( 'amazing.gif', 'archer.gif', 'cornelius.gif', 'duncan.gif', 'ed.gif', 'fry.gif', 'gaius.gif', 'grab.gif', 'jello.gif', 'jerry.gif', 'lemon.gif', 'maniacs.gif', 'moss.gif', 'rigby.gif', 'sokka.gif', 'tyler.gif', 'zaius.gif' );
				shuffle($gifs); ?>

<a href="<?php echo SITE_URL; ?>" class="footer-menu-link">Home

<a href="<?php echo SITE_URL; ?>projects/" class="footer-menu-link">Projects

<a href="<?php echo SITE_URL; ?>process/" class="footer-menu-link">Process

<a href="<?php echo SITE_URL; ?>about/" class="footer-menu-link">About

<a href="<?php echo $twitter_url; ?>" class="footer-social-link">Twitter

<a href="<?php echo $insta_url; ?>" class="footer-social-link">Instagram

<a href="<?php echo $github_url; ?>" class="footer-social-link">Github

<a href="<?php echo $linked_url; ?>" class="footer-social-link">LinkedIn

<a href="<?php echo $spotify_url; ?>" class="footer-social-link">Spotify

© Joey Heflich <?php echo date("Y") ?><a href="http://joeyheflich.com/gifs/<?php echo $gifs[0]; ?>" class="gif-link">All Rights Reserved


text: python vector_reduc_max.py


text:
@ECHO OFF
REM **************************************************************************
REM *
REM * configure.bat for setting up compiling STLport under Windows
REM * to see available options, call with option --help
REM *
REM * Copyright (C) 2004,2005 Michael Fink
REM *
REM **************************************************************************

REM Attention! Batch file labels only have 8 significant characters!

echo STLport Configuration Tool for Windows
echo.

REM no options at all?
if NOT "%1xyz123" == "xyz123" goto init

echo Please specify some options or use "configure --help" to see the
echo available options.
goto skp_comp

:init

REM initially create/overwrite config.mak
echo # STLport Configuration Tool for Windows > ..\Makefiles\config.mak
echo # >> ..\Makefiles\config.mak
echo # config.mak generated with command line: >> ..\Makefiles\config.mak
echo # configure %1 %2 %3 %4 %5 %6 %7 %8 %9 >> ..\Makefiles\config.mak
echo # >> ..\Makefiles\config.mak

REM
REM option loop
REM
:loop

REM help option
if "%1" == "-?" goto opt_help
if "%1" == "-h" goto opt_help
if "%1" == "/?" goto opt_help
if "%1" == "/h" goto opt_help
if "%1" == "--help" goto opt_help

REM compiler option
if "%1" == "-c" goto opt_comp
if "%1" == "/c" goto opt_comp
if "%1" == "--compiler" goto opt_comp

REM cross compiling
if "%1" == "-x" goto opt_x
if "%1" == "/x" goto opt_x
if "%1" == "--cross" goto opt_x

REM C runtime library
if "%1" == "--rtl-static" goto opt_rtl
if "%1" == "--rtl-dynamic" goto opt_rtl

REM boost support
if "%1" == "--use-boost" goto opt_bst

REM multithreading support
if "%1" == "--not-thread-safe" goto opt_st

REM rtti support
if "%1" == "--no-rtti" goto opt_rtti

REM additional compiler options
if "%1" == "--extra-cxxflag" goto opt_xtra

REM library name customization
if "%1" == "--lib-motif" goto opt_motf

REM clean rule
if "%1" == "--clean" goto opt_cln

echo Unknown option: %1

:cont_lp
echo.
shift

REM no more options?
if "%1xyz123" == "xyz123" goto end_loop

goto loop

REM **************************************************************************
REM *
REM * Help
REM *
REM **************************************************************************
:opt_help
echo The following options are available:
echo.
echo "-c <compiler>" or "--compiler <compiler>"
echo    Uses specified compiler to compile STLport. The following keywords
echo    are available:
echo    msvc6    Microsoft Visual C++ 6.0
echo    msvc7    Microsoft Visual C++ .NET 2002
echo    msvc71   Microsoft Visual C++ .NET 2003
echo    msvc8    Microsoft Visual C++ 2005
echo    icl      Intel C++ Compiler
echo    evc3     Microsoft eMbedded Visual C++ 3 (*)
echo    evc4     Microsoft eMbedded Visual C++ .NET (*)
echo    evc8     Microsoft Visual C++ 2005 compiling for CE
echo    gcc      GNU C++ Compiler (MinGW package)
echo    dmc      Digital Mars Compiler
echo    bcc      Borland C++ Compiler
echo  (*) For these compilers the target processor is determined automatically.
echo      You must run the WCE*.BAT file you wish to build STLport for before
echo      running configure.
echo.
echo "-x"
echo    Enables cross-compiling; the result is that all built files that are
echo    normally put under "bin" and "lib" get extra subfolders depending on
echo    the compiler name.
echo.
echo "--rtl-static"
echo "--rtl-dynamic"
echo    Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family)
echo    C/C++ runtime library when linking with STLport. If you want your appli/dll
echo    to link statically with STLport but using the dynamic C runtime use
echo    --rtl-dynamic; if you want to link dynamicaly with STLport but using the
echo    static C runtime use --rtl-static. See README.options for details.
echo    Don't forget to signal the link method when building your appli or dll, in
echo    stlport/stl/config/host.h set the following macro depending on the configure
echo    option:
echo    "--rtl-dynamic -> _STLP_USE_STATIC_LIB"
echo    "--rtl-static  -> _STLP_USE_DYNAMIC_LIB"
echo    This is a Microsoft Visual Studio only option.
echo.
echo "--use-boost <boost install path>"
echo    Request use of boost support (www.boost.org). For the moment only the boost
echo    type_traits library is used to get type information and to implement some
echo    specific workaround not directly implemented by STLport. To use the same
echo    support using STLport don't forget to define _STLP_USE_BOOST_SUPPORT in
echo    stlport/stl/config/user_config.h file.
echo.
echo "--not-thread-safe"
echo    Per default STLport libraries are built in order to be usable in a multithreaded
echo    context. If you don't need this you can ask for a not thread safe version with
echo    this option.
echo.
echo "--no-rtti"
echo    Remove rtti (run time type information) support if available.
echo.
echo "--extra-cxxflag <additional compilation options>"
echo    Use this option to add any compilation flag to the build system. For instance
echo    it can be used to activate a specific processor optimization depending on your
echo    processor. For Visual C++ .Net 2003, to activate pentium 3 optim you will use:
echo    --extra-cxxflag /G7
echo    If you have several options use several --extra-cxxflag options. For instance
echo    to also force use of wchar_t as an intrinsic type:
echo    --extra-cxxflag /G7 --extra-cxxflag /Zc:wchar_t
echo.
echo "--lib-motif <motif>"
echo   Use this option to customize the generated library name. The motif will be used
echo   in the last place before version information, separated by an underscore, ex:
echo   stlportd_MOTIF.5.0.lib
echo   stlportstld_static_MOTIF.5.1.lib
echo   Do not forget to define _STLP_LIB_NAME_MOTIF macro in STLport configuration file
echo   to the same value if you want to keep the auto link feature.
echo.
echo "--clean"
echo    Removes the build configuration file.
goto skp_comp

REM **************************************************************************
REM *
REM * Compiler configuration
REM *
REM **************************************************************************
:opt_comp

if "%2" == "msvc6" goto oc_msvc6
if "%2" == "msvc71" goto oc_msv71
if "%2" == "msvc7" goto oc_msvc7
if "%2" == "msvc8" goto oc_msvc8
if "%2" == "icl"   goto oc_icl

if "%2" == "evc3" goto oc_evc3
if "%2" == "evc4" goto oc_evc4
if "%2" == "evc8" goto oc_evc8

if "%2" == "gcc" goto oc_gcc
if "%2" == "dmc" goto oc_dmc
if "%2" == "bcc" goto oc_bcc

echo Unknown compiler: %2
goto oc_end

:oc_msvc6
echo Setting compiler: Microsoft Visual C++ 6.0
echo COMPILER_NAME=vc6 >> ..\Makefiles\config.mak
set SELECTED_COMPILER_VERSION=60
goto oc_msvc

:oc_msvc7
echo Setting compiler: Microsoft Visual C++ .NET 2002
echo COMPILER_NAME=vc70 >> ..\Makefiles\config.mak
set SELECTED_COMPILER_VERSION=70
goto oc_msvc

:oc_msv71
echo Setting compiler: Microsoft Visual C++ .NET 2003
echo COMPILER_NAME=vc71 >> ..\Makefiles\config.mak
set SELECTED_COMPILER_VERSION=71
goto oc_msvc

:oc_msvc8
echo Setting compiler: Microsoft Visual C++ 2005
echo COMPILER_NAME=vc8 >> ..\Makefiles\config.mak
set SELECTED_COMPILER_VERSION=80
goto oc_msvc

:oc_msvc
echo TARGET_OS=x86 >> ..\Makefiles\config.mak
set STLPORT_COMPILE_COMMAND=nmake /fmsvc.mak
set SELECTED_COMPILER=msvc
goto oc_end

:oc_icl
echo Setting compiler: Intel C++ Compiler
echo COMPILER_NAME=icl >> ..\Makefiles\config.mak
echo TARGET_OS=x86 >> ..\Makefiles\config.mak
set STLPORT_COMPILE_COMMAND=nmake /ficl.mak
set SELECTED_COMPILER=icl
goto oc_end

:oc_evc3
echo Setting compiler: Microsoft eMbedded Visual C++ 3
echo COMPILER_NAME=evc3 >> ..\Makefiles\config.mak
rem TODO: branch on OSVERSION like below?
echo CEVERSION=300 >> ..\Makefiles\config.mak
set SELECTED_COMPILER_VERSION=3
goto oc_evc

:oc_evc4
echo Setting compiler: Microsoft eMbedded Visual C++ .NET
echo COMPILER_NAME=evc4 >> ..\Makefiles\config.mak
if "%OSVERSION%"=="" (
    echo OSVERSION not set, assuming target is CE 4.2
    echo CEVERSION=420 >> ..\Makefiles\config.mak
) else if "%OSVERSION%"=="WCE400" (
    echo CEVERSION=400 >> ..\Makefiles\config.mak
) else if "%OSVERSION%"=="WCE420" (
    echo CEVERSION=420 >> ..\Makefiles\config.mak
) else if "%OSVERSION%"=="WCE500" (
    echo CEVERSION=500 >> ..\Makefiles\config.mak
) else (
    echo Unknown value for OSVERSION.
    exit /b 1
)
set SELECTED_COMPILER_VERSION=4
goto oc_evc

:oc_evc8
echo Setting compiler: Microsoft Visual C++ .NET 2005 for Windows CE
echo COMPILER_NAME=evc8 >> ..\Makefiles\config.mak
set SELECTED_COMPILER_VERSION=80
if "%OSVERSION%"=="" (
    echo OSVERSION not set, assuming target is CE 5.0
    echo CEVERSION=500 >> ..\Makefiles\config.mak
) else if "%OSVERSION%"=="WCE400" (
    echo CEVERSION=400 >> ..\Makefiles\config.mak
) else if "%OSVERSION%"=="WCE420" (
    echo CEVERSION=420 >> ..\Makefiles\config.mak
) else if "%OSVERSION%"=="WCE500" (
    echo CEVERSION=500 >> ..\Makefiles\config.mak
) else (
    echo Unknown value for OSVERSION.
    exit /b 1
)
set STLPORT_COMPILE_COMMAND=nmake /fevc.mak
set SELECTED_COMPILER=msvc
goto proc

:oc_evc
set STLPORT_COMPILE_COMMAND=nmake /fevc.mak
set SELECTED_COMPILER=evc
goto proc

:oc_gcc
echo Setting compiler: GNU C++ Compiler
set STLPORT_COMPILE_COMMAND=make -fgcc.mak
set SELECTED_COMPILER=gcc
shift
goto oc_gmake

:oc_dmc
echo Setting compiler: Digital Mars C++ Compiler
set STLPORT_COMPILE_COMMAND=make -fdmc.mak
set SELECTED_COMPILER=dmc
shift
goto oc_gmake

:oc_bcc
echo Setting compiler: Borland C++ Compiler
set STLPORT_COMPILE_COMMAND=make -fbcc.mak
set SELECTED_COMPILER=bcc
shift
goto oc_gmake

:oc_gmake
echo In order to build STLport with this compiler you need a GNU make tool.
echo You can get one from www.mingw.org or www.cygwin.com
echo Setting up for building using GNU make.
echo include $(SRCROOT)\Makefiles\gmake\windows\sysid.mak >> ..\Makefiles\config.mak
goto cont_lp

:oc_end
shift

goto cont_lp

REM **************************************************************************
REM *
REM * Target processor configuration (automatic)
REM *
REM **************************************************************************
:proc

if "%TARGETCPU%" == "ARM" goto pr_arm
if "%TARGETCPU%" == "ARMV4" goto pr_arm
if "%TARGETCPU%" == "ARMV4I" goto pr_arm
if "%TARGETCPU%" == "ARMV4T" goto pr_arm

if "%TARGETCPU%" == "X86" goto pr_x86
REM Type from evc3 and/or PocketPC 2002 SDK reported here
REM to correctly check the platform:
if "%TARGETCPU%" == "X86EMnset CFG=none" goto pr_emul
if "%TARGETCPU%" == "x86" goto pr_x86
if "%TARGETCPU%" == "emulator" goto pr_emul

if "%TARGETCPU%" == "R4100" goto pr_mips
if "%TARGETCPU%" == "R4111" goto pr_mips
if "%TARGETCPU%" == "R4300" goto pr_mips
if "%TARGETCPU%" == "MIPS16" goto pr_mips
if "%TARGETCPU%" == "MIPSII" goto pr_mips
if "%TARGETCPU%" == "MIPSII_FP" goto pr_mips
if "%TARGETCPU%" == "MIPSIV" goto pr_mips
if "%TARGETCPU%" == "MIPSIV_FP" goto pr_mips

if "%TARGETCPU%" == "SH3" goto pr_sh3
if "%TARGETCPU%" == "SH4" goto pr_sh4

:pr_err
echo Unknown target CPU: %TARGETCPU%
goto pr_end

:pr_arm
echo Target processor: ARM
echo TARGET_PROC=arm >> ..\Makefiles\config.mak
echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> ..\Makefiles\config.mak
goto pr_end

:pr_x86
echo Target processor: x86
echo TARGET_PROC=x86 >> ..\Makefiles\config.mak
goto pr_end

:pr_emul
echo Target processor: Emulator
echo TARGET_PROC=x86 >> ..\Makefiles\config.mak
echo TARGET_PROC_SUBTYPE=emulator >> ..\Makefiles\config.mak
goto pr_end

:pr_mips
echo Target processor: MIPS
echo TARGET_PROC=mips >> ..\Makefiles\config.mak
echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> ..\Makefiles\config.mak

goto pr_end

:pr_sh3
echo Target processor: %TARGETCPU%
echo TARGET_PROC=sh3 >> ..\Makefiles\config.mak
goto pr_end

:pr_sh4
echo Target processor: %TARGETCPU%
echo TARGET_PROC=sh4 >> ..\Makefiles\config.mak
goto pr_end

:pr_end
goto oc_end

REM **************************************************************************
REM *
REM * Cross Compiling option
REM *
REM **************************************************************************

:opt_x
echo Setting up for cross compiling.
echo CROSS_COMPILING=1 >> ..\Makefiles\config.mak
goto cont_lp

REM **************************************************************************
REM *
REM * C runtime library selection
REM *
REM **************************************************************************

:opt_rtl
if "%SELECTED_COMPILER%" == "" goto or_err1
if "%SELECTED_COMPILER%" == "msvc" goto or_ok
if "%SELECTED_COMPILER%" == "bcc" goto or_ok
if "%SELECTED_COMPILER%" == "dmc" goto or_ok
goto or_err2

:or_err1
echo Error: Please give used compiler first in order to check other options correctness.
goto or_end

:or_err2
echo Error: Setting C runtime library for compiler other than microsoft ones!
goto or_end

:or_ok

if "%1" == "--rtl-static" echo Selecting static C runtime library for STLport
if "%1" == "--rtl-static" echo STLP_BUILD_FORCE_STATIC_RUNTIME=1 >> ..\Makefiles\config.mak

if "%1" == "--rtl-dynamic" echo Selecting dynamic C runtime library for STLport
if "%1" == "--rtl-dynamic" echo STLP_BUILD_FORCE_DYNAMIC_RUNTIME=1 >> ..\Makefiles\config.mak

:or_end
goto cont_lp

REM **************************************************************************
REM *
REM * boost support
REM *
REM **************************************************************************
:opt_bst
REM if (Exists("%2")) goto ob_ok
REM if !("%2" == "") goto ob_ok
goto ob_ok

echo Error: Invalid boost intallation folder ("%2").
goto ob_end

:ob_ok
echo Activating boost support using "%2" path
echo STLP_BUILD_BOOST_PATH="%2" >> ..\Makefiles\config.mak

:ob_end
shift

goto cont_lp

REM **************************************************************************
REM *
REM * Multithreading support
REM *
REM **************************************************************************
:opt_st
echo Removing thread safety support
echo STLP_BUILD_NO_THREAD=1 >> ..\Makefiles\config.mak
goto cont_lp

REM **************************************************************************
REM *
REM * rtti support
REM *
REM **************************************************************************
:opt_rtti
echo Removing rtti support
echo STLP_BUILD_NO_RTTI=1 >> ..\Makefiles\config.mak
goto cont_lp

REM **************************************************************************
REM *
REM * Extra compilation flags
REM *
REM **************************************************************************
:opt_xtra
echo Adding '%2' compilation option
if "%ONE_OPTION_ADDED%" == "1" goto ox_n

echo DEFS = %2 >> ..\Makefiles\config.mak
set ONE_OPTION_ADDED=1
goto ox_end

:ox_n
echo DEFS = $(DEFS) %2 >> ..\Makefiles\config.mak

:ox_end
shift
goto cont_lp

REM **************************************************************************
REM *
REM * Library name configuration
REM *
REM **************************************************************************
:opt_motf
echo Using '%2' in generated library names

echo STLP_BUILD_LIB_MOTIF = %2 >> ..\Makefiles\config.mak

shift
goto cont_lp

REM **************************************************************************
REM *
REM * Clean
REM *
REM **************************************************************************
:opt_cln
del ..\Makefiles\config.mak
echo STLport configuration file removed.
goto skp_comp

REM **************************************************************************
REM *
REM * End loop
REM *
REM **************************************************************************

:end_loop

echo Done configuring STLport.
echo.

if "%STLPORT_COMPILE_COMMAND%" == "" goto skp_comp
echo Please type "%STLPORT_COMPILE_COMMAND%" to build STLport.
echo Type "%STLPORT_COMPILE_COMMAND% install" to install STLport to the "lib"
echo and "bin" folder when done.
echo.

:skp_comp
set STLPORT_COMPILE_COMMAND=
set SELECTED_COMPILER=
set SELECTED_COMPILER_VERSION=
set ONE_OPTION_ADDED=


text:
package com.hp.autonomy.frontend.reports.powerpoint.dto;

import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * DTO to represent time-series data to plot on a xy scatterplot chart with time on the x-axis.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DategraphData implements ComposableElement {

    /** A list of timestamps as Unix epoch seconds. */
    private long[] timestamps;

    /* One of more row data series with values corresponding with the timestamps. */
    private List<Row> rows;

    public boolean validateInput() {
        final int length = this.timestamps.length;

        for(Row row : rows) {
            if (row.getValues().length != length) {
                return false;
            }
        }

        return length > 1 && !rows.isEmpty();
    }

    /**
     * A DTO representing a data series in a date chart.
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Row {

        /** The colour to render the series data, should be a hexadecimal string e.g. #FF0000 */
        private String color;

        /** The label for the series data. */
        private String label;

        /** Whether the row is rendered on the primary or secondary y-axis. */
        private boolean secondaryAxis;

        /** List of values; should be the same length as the timestamps. */
        private double[] values;
    }
}


text:
<?php
namespace FOA\Responder_Bundle;

use Aura\Accept\AcceptFactory;
use Aura\Web\WebFactory;
use FOA\DomainPayload\PayloadFactory;
use Twig_Environment;
use Twig_Loader_Array;
use FOA\Responder_Bundle\Renderer\Twig;

class TwigResponderTest extends \PHPUnit_Framework_TestCase
{
    protected $response;

    protected $responder;

    public function setUp()
    {
        $web_factory = new WebFactory($GLOBALS);
        $this->response = $web_factory->newResponse();

        $accept_factory = new AcceptFactory($_SERVER);
        $accept = $accept_factory->newInstance();

        $loader = new Twig_Loader_Array(array(
            'hello' => 'Hello {{ name }}'
        ));
        $twig = new Twig_Environment($loader);
        $renderer = new Twig($twig);
        $this->responder = new FakeResponder($accept, $this->response, $renderer);
        $payload_factory = new PayloadFactory();
        $this->responder->setPayload($payload_factory->found(array('name' => 'Hari')));
    }

    public function testRenderView()
    {
        $this->responder->__invoke();
        $this->assertSame('Hello Hari', trim($this->response->content->get()));
    }

    public function testGetRenderer()
    {
        $this->assertInstanceOf('FOA\Responder_Bundle\Renderer\Twig', $this->responder->getRenderer());
    }

    public function testGetEngine()
    {
        $this->assertInstanceOf('Twig_Environment', $this->responder->getRenderer()->getEngine());
    }
}


text:
#include "flash_api.h"
#include "mbed_critical.h"

#if DEVICE_FLASH
#include "cmsis.h"

#define FLASH_SIZE                (uint32_t)(FMC_SIZE * 1024)
#define FLASH_BANK0_PAGE_SIZE     (0x800)
#define FLASH_BANK1_PAGE_SIZE     (0x1000)
#define FLASH_BANK0_END_ADDR      (0x0807FFFF)
#define FLASH_BANK1_END_ADDR      (0x080FFFFF)
#define FLASH_END_ADDR            (FLASH_BASE + FLASH_SIZE) - 1
#define WORD_SIZE                 (4U)

/* unlock the main FLASH operation
 *
 * @return 0 for success, -1 for error
*/
static int32_t flash_unlock(void)
{
    fmc_unlock();
    if (RESET != ((FMC_CTL0 & FMC_CTL0_LK) || (FMC_CTL1 & FMC_CTL1_LK))) {
        return -1;
    }
    return 0;
}

/* lock the main FLASH operation
 *
 * @return 0 for success, -1 for error
*/
static int32_t flash_lock(void)
{
    fmc_lock();
    if (RESET == ((FMC_CTL0 & FMC_CTL0_LK) && (FMC_CTL1 & FMC_CTL1_LK))) {
        return -1;
    }
    return 0;
}

/** Initialize the flash peripheral and the flash_t object
 *
 * @param obj The flash object
 * @return 0 for success, -1 for error
 */
int32_t flash_init(flash_t *obj)
{
    return 0;
}

/** Uninitialize the flash peripheral and the flash_t object
 *
 * @param obj The flash object
 * @return 0 for success, -1 for error
 */
int32_t flash_free(flash_t *obj)
{
    return 0;
}

/** Erase one sector starting at defined address
 *
 * The address should be at sector boundary. This function does not do any check for address alignments
 * @param obj The flash object
 * @param address The sector starting address
 * @return 0 for success, -1 for error
 */
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
{
    int32_t flash_state = 0;
    flash_unlock();

    /* clear FLASH flag */
    fmc_flag_clear(FMC_FLAG_BANK0_END);
    fmc_flag_clear(FMC_FLAG_BANK0_WPERR);
    fmc_flag_clear(FMC_FLAG_BANK0_PGERR);

    /* make sure the address is a right page address */
    if (FMC_READY != fmc_page_erase(address)) {
        flash_state = -1;
    }

    flash_lock();
    return flash_state;
}

/** Program pages starting at defined address
 *
 * The pages should not cross multiple sectors.
 * This function does not do any check for address alignments or if size is aligned to a page size.
 * @param obj The flash object
 * @param address The sector starting address
 * @param data The data buffer to be programmed
 * @param size The number of bytes to program
 * @return 0 for success, -1 for error
 */
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
{
    uint32_t *p_data;
    p_data = (uint32_t *)data;
    uint32_t num = 0;
    int32_t flash_state = 0;
    flash_unlock();

    /* clear FLASH flag */
    fmc_flag_clear(FMC_FLAG_BANK0_END);
    fmc_flag_clear(FMC_FLAG_BANK0_WPERR);
    fmc_flag_clear(FMC_FLAG_BANK0_PGERR);

    if (size % 4) {
        num = size / 4 + 1;
    } else {
        num = size / 4;
    }
    for (uint32_t i = 0; i < num; i++) {

        if (FMC_READY != fmc_word_program(address, *(p_data + i))) {
            flash_state = -1;
            break;
        }
        address += 4;
    }
    flash_lock();
    return flash_state;
}

/** Get sector size
 *
 * @param obj The flash object
 * @param address The sector starting address
 * @return The size of a sector
 */
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
{
    uint32_t sector_size = 0;
    if ((FLASH_BASE <= address) && (FLASH_BANK0_END_ADDR >= address)) {
        sector_size = FLASH_BANK0_PAGE_SIZE;
    } else if ((FLASH_BANK0_END_ADDR < address) && (FLASH_END_ADDR >= address)) {
        sector_size = FLASH_BANK1_PAGE_SIZE;
    } else {
        return MBED_FLASH_INVALID_SIZE;
    }
    return sector_size;
}

/** Get page size
 *
 * The page size defines the writable page size
 * @param obj The flash object
 * @return The size of a page
 */
uint32_t flash_get_page_size(const flash_t *obj)
{
    return WORD_SIZE;
}

/** Get start address for the flash region
 *
 * @param obj The flash object
 * @return The start address for the flash region
 */
uint32_t flash_get_start_address(const flash_t *obj)
{
    return FLASH_BASE;
}

/** Get the flash region size
 *
 * @param obj The flash object
 * @return The flash region size
 */
uint32_t flash_get_size(const flash_t *obj)
{
    return FLASH_SIZE;
}

/** Get the flash erase value
 *
 * @param obj The flash object
 * @return The flash erase value
 */
uint8_t flash_get_erase_value(const flash_t *obj)
{
    return 0xFF;
}

#endif /* DEVICE_FLASH */


text:
package org.apache.flink.table.descriptors

import org.apache.flink.table.descriptors.DescriptorProperties.{serialize, toJava}
import org.apache.flink.table.descriptors.RowtimeValidator._
import org.apache.flink.table.sources.tsextractors.{ExistingField, StreamRecordTimestamp, TimestampExtractor}
import org.apache.flink.table.sources.wmstrategies.{AscendingTimestamps, BoundedOutOfOrderTimestamps, PreserveWatermarks, WatermarkStrategy}

import scala.collection.JavaConverters._

/**
  * Validator for [[Rowtime]].
  */
class RowtimeValidator(
    supportsSourceTimestamps: Boolean,
    supportsSourceWatermarks: Boolean,
    prefix: String = "")
  extends DescriptorValidator {

  override def validate(properties: DescriptorProperties): Unit = {
    val timestampExistingField = (_: String) => {
      properties.validateString(
        prefix + ROWTIME_TIMESTAMPS_FROM, isOptional = false, minLen = 1)
    }

    val timestampCustom = (_: String) => {
      properties.validateString(
        prefix + ROWTIME_TIMESTAMPS_CLASS, isOptional = false, minLen = 1)
      properties.validateString(
        prefix + ROWTIME_TIMESTAMPS_SERIALIZED, isOptional = false, minLen = 1)
    }

    val timestampsValidation = if (supportsSourceTimestamps) {
      Map(
        ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD -> toJava(timestampExistingField),
        ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_SOURCE -> properties.noValidation(),
        ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM -> toJava(timestampCustom))
    } else {
      Map(
        ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD -> toJava(timestampExistingField),
        ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM -> toJava(timestampCustom))
    }

    properties.validateEnum(
      prefix + ROWTIME_TIMESTAMPS_TYPE,
      isOptional = false,
      timestampsValidation.asJava
    )

    val watermarkPeriodicBounded = (_: String) => {
      properties.validateLong(
        prefix + ROWTIME_WATERMARKS_DELAY, isOptional = false, min = 0)
    }

    val watermarkCustom = (_: String) => {
      properties.validateString(
        prefix + ROWTIME_WATERMARKS_CLASS, isOptional = false, minLen = 1)
      properties.validateString(
        prefix + ROWTIME_WATERMARKS_SERIALIZED, isOptional = false, minLen = 1)
    }

    val watermarksValidation = if (supportsSourceWatermarks) {
      Map(
        ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_ASCENDING -> properties.noValidation(),
        ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED -> toJava(watermarkPeriodicBounded),
        ROWTIME_WATERMARKS_TYPE_VALUE_FROM_SOURCE -> properties.noValidation(),
        ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM -> toJava(watermarkCustom))
    } else {
      Map(
        ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_ASCENDING -> properties.noValidation(),
        ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED -> toJava(watermarkPeriodicBounded),
        ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM -> toJava(watermarkCustom))
    }

    properties.validateEnum(
      prefix + ROWTIME_WATERMARKS_TYPE,
      isOptional = false,
      watermarksValidation.asJava
    )
  }
}

object RowtimeValidator {

  val ROWTIME = "rowtime"
  val ROWTIME_TIMESTAMPS_TYPE = "rowtime.timestamps.type"
  val ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD = "from-field"
  val ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_SOURCE = "from-source"
  val ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM = "custom"
  val ROWTIME_TIMESTAMPS_FROM = "rowtime.timestamps.from"
  val ROWTIME_TIMESTAMPS_CLASS = "rowtime.timestamps.class"
  val ROWTIME_TIMESTAMPS_SERIALIZED = "rowtime.timestamps.serialized"

  val ROWTIME_WATERMARKS_TYPE = "rowtime.watermarks.type"
  val ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_ASCENDING = "periodic-ascending"
  val ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED = "periodic-bounded"
  val ROWTIME_WATERMARKS_TYPE_VALUE_FROM_SOURCE = "from-source"
  val ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM = "custom"
  val ROWTIME_WATERMARKS_CLASS = "rowtime.watermarks.class"
  val ROWTIME_WATERMARKS_SERIALIZED = "rowtime.watermarks.serialized"
  val ROWTIME_WATERMARKS_DELAY = "rowtime.watermarks.delay"

  // utilities

  def normalizeTimestampExtractor(extractor: TimestampExtractor): Map[String, String] =
    extractor match {

        case existing: ExistingField =>
          Map(
            ROWTIME_TIMESTAMPS_TYPE -> ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD,
            ROWTIME_TIMESTAMPS_FROM -> existing.getArgumentFields.apply(0))

        case _: StreamRecordTimestamp =>
          Map(ROWTIME_TIMESTAMPS_TYPE -> ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_SOURCE)

        case _: TimestampExtractor =>
          Map(
            ROWTIME_TIMESTAMPS_TYPE -> ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM,
            ROWTIME_TIMESTAMPS_CLASS -> extractor.getClass.getName,
            ROWTIME_TIMESTAMPS_SERIALIZED -> serialize(extractor))
    }

  def normalizeWatermarkStrategy(strategy: WatermarkStrategy): Map[String, String] =
    strategy match {

      case _: AscendingTimestamps =>
        Map(ROWTIME_WATERMARKS_TYPE -> ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_ASCENDING)

      case bounded: BoundedOutOfOrderTimestamps =>
        Map(
          ROWTIME_WATERMARKS_TYPE -> ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED,
          ROWTIME_WATERMARKS_DELAY -> bounded.delay.toString)

      case _: PreserveWatermarks =>
        Map(ROWTIME_WATERMARKS_TYPE -> ROWTIME_WATERMARKS_TYPE_VALUE_FROM_SOURCE)

      case _: WatermarkStrategy =>
        Map(
          ROWTIME_WATERMARKS_TYPE -> ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM,
          ROWTIME_WATERMARKS_CLASS -> strategy.getClass.getName,
          ROWTIME_WATERMARKS_SERIALIZED -> serialize(strategy))
    }

  def getRowtimeComponents(properties: DescriptorProperties, prefix: String)
    : Option[(TimestampExtractor, WatermarkStrategy)] = {

    // create timestamp extractor
    val t = properties.getOptionalString(prefix + ROWTIME_TIMESTAMPS_TYPE)
    if (!t.isPresent) {
      return None
    }
    val extractor: TimestampExtractor = t.get() match {

      case ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD =>
        val field = properties.getString(prefix + ROWTIME_TIMESTAMPS_FROM)
        new ExistingField(field)

      case ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_SOURCE =>
        StreamRecordTimestamp.INSTANCE

      case ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM =>
        val clazz = properties.getClass(
          prefix + ROWTIME_TIMESTAMPS_CLASS,
          classOf[TimestampExtractor])
        DescriptorProperties.deserialize(
          properties.getString(prefix + ROWTIME_TIMESTAMPS_SERIALIZED),
          clazz)
    }

    // create watermark strategy
    val s = properties.getString(prefix + ROWTIME_WATERMARKS_TYPE)
    val strategy: WatermarkStrategy = s match {

      case ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_ASCENDING =>
        new AscendingTimestamps()

      case ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED =>
        val delay = properties.getLong(prefix + ROWTIME_WATERMARKS_DELAY)
        new BoundedOutOfOrderTimestamps(delay)

      case ROWTIME_WATERMARKS_TYPE_VALUE_FROM_SOURCE =>
        PreserveWatermarks.INSTANCE

      case ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM =>
        val clazz = properties.getClass(
          prefix + ROWTIME_WATERMARKS_CLASS,
          classOf[WatermarkStrategy])
        DescriptorProperties.deserialize(
          properties.getString(prefix + ROWTIME_WATERMARKS_SERIALIZED),
          clazz)
    }

    Some((extractor, strategy))
  }
}


text:
title: "Traefik API Documentation"
description: "Traefik Proxy exposes information through API handlers. Learn about the security, configuration, and endpoints of APIs. Read the technical documentation."
---

# API

Traefik exposes a number of information through an API handler, such as the configuration of all routers, services, middlewares, etc.

As with all features of Traefik, this handler can be enabled with the [static configuration](../getting-started/configuration-overview.md#the-static-configuration).

## Security

Enabling the API in production is not recommended, because it will expose all configuration elements,
including sensitive data.

In production, it should be at least secured by authentication and authorizations.

A good sane default (non exhaustive) set of recommendations
would be to apply the following protection mechanisms:

* At the transport level:
  NOT publicly exposing the API's port,
  keeping it restricted to internal networks
  (as in the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege), applied to networks).

## Configuration

If you enable the API, a new special `service` named `api@internal` is created and can then be referenced in a router.

To enable the API handler, use the following option on the
[static configuration](../getting-started/configuration-overview.md#the-static-configuration):

```yaml tab="File (YAML)"
# Static Configuration
api: {}
```

```toml tab="File (TOML)"
# Static Configuration
[api]
```

```bash tab="CLI"
--api=true
```

And then define a routing configuration on Traefik itself with the
[dynamic configuration](../getting-started/configuration-overview.md#the-dynamic-configuration):

--8<-- "content/operations/include-api-examples.md"

??? warning "The router's [rule](../../routing/routers#rule) must catch requests for the URI path `/api`"
    Using an "Host" rule is recommended, by catching all the incoming traffic on this host domain to the API.
    However, you can also use "path prefix" rule or any combination or rules.

    ```bash tab="Host Rule"
    # Matches http://traefik.example.com, http://traefik.example.com/api
    # or http://traefik.example.com/hello
    rule = "Host(`traefik.example.com`)"
    ```

    ```bash tab="Path Prefix Rule"
    # Matches http://api.traefik.example.com/api or http://example.com/api
    # but does not match http://api.traefik.example.com/hello
    rule = "PathPrefix(`/api`)"
    ```

    ```bash tab="Combination of Rules"
    # Matches http://traefik.example.com/api or http://traefik.example.com/dashboard
    # but does not match http://traefik.example.com/hello
    rule = "Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
    ```

### `insecure`

Enable the API in `insecure` mode, which means that the API will be available directly on the entryPoint named `traefik`.

!!! info
    If the entryPoint named `traefik` is not configured, it will be automatically created on port 8080.

```yaml tab="File (YAML)"
api:
  insecure: true
```

```toml tab="File (TOML)"
[api]
  insecure = true
```

```bash tab="CLI"
--api.insecure=true
```

### `dashboard`

_Optional, Default=true_

Enable the dashboard. More about the dashboard features [here](./dashboard.md).

```yaml tab="File (YAML)"
api:
  dashboard: true
```

```toml tab="File (TOML)"
[api]
  dashboard = true
```

```bash tab="CLI"
--api.dashboard=true
```

!!! warning "With Dashboard enabled, the router [rule](../../routing/routers#rule) must catch requests for both `/api` and `/dashboard`"
    Please check the [Dashboard documentation](./dashboard.md#dashboard-router-rule) to learn more about this and to get examples.

### `debug`

_Optional, Default=false_

Enable additional [endpoints](./api.md#endpoints) for debugging and profiling, served under `/debug/`.

```yaml tab="File (YAML)"
api:
  debug: true
```

```toml tab="File (TOML)"
[api]
  debug = true
```

```bash tab="CLI"
--api.debug=true
```

## Endpoints

All the following endpoints must be accessed with a `GET` HTTP request.

| Path                           | Description                                                                                |
|--------------------------------|---------------------------------------------------------------------------------------------|
| `/api/http/routers`            | Lists all the HTTP routers information.                                                     |
| `/api/http/routers/{name}`     | Returns the information of the HTTP router specified by `name`.                             |
| `/api/http/services`           | Lists all the HTTP services information.                                                    |
| `/api/http/services/{name}`    | Returns the information of the HTTP service specified by `name`.                            |
| `/api/http/middlewares`        | Lists all the HTTP middlewares information.                                                 |
| `/api/http/middlewares/{name}` | Returns the information of the HTTP middleware specified by `name`.                         |
| `/api/tcp/routers`             | Lists all the TCP routers information.                                                      |
| `/api/tcp/routers/{name}`      | Returns the information of the TCP router specified by `name`.                              |
| `/api/tcp/services`            | Lists all the TCP services information.                                                     |
| `/api/tcp/services/{name}`     | Returns the information of the TCP service specified by `name`.                             |
| `/api/tcp/middlewares`         | Lists all the TCP middlewares information.                                                  |
| `/api/tcp/middlewares/{name}`  | Returns the information of the TCP middleware specified by `name`.                          |
| `/api/udp/routers`             | Lists all the UDP routers information.                                                      |
| `/api/udp/routers/{name}`      | Returns the information of the UDP router specified by `name`.                              |
| `/api/udp/services`            | Lists all the UDP services information.                                                     |
| `/api/udp/services/{name}`     | Returns the information of the UDP service specified by `name`.                             |
| `/api/entrypoints`             | Lists all the entry points information.                                                     |
| `/api/entrypoints/{name}`      | Returns the information of the entry point specified by `name`.                             |
| `/api/overview`                | Returns statistic information about http and tcp as well as enabled features and providers. |
| `/api/rawdata`                 | Returns information about dynamic configurations, errors, status and dependency relations.  |
| `/api/version`                 | Returns information about Traefik version.                                                  |
| `/debug/vars`                  | See the [expvar](https://golang.org/pkg/expvar/) Go documentation.                          |
| `/debug/pprof/`                | See the [pprof Index](https://golang.org/pkg/net/http/pprof/#Index) Go documentation.       |
| `/debug/pprof/cmdline`         | See the [pprof Cmdline](https://golang.org/pkg/net/http/pprof/#Cmdline) Go documentation.   |
| `/debug/pprof/profile`         | See the [pprof Profile](https://golang.org/pkg/net/http/pprof/#Profile) Go documentation.   |
| `/debug/pprof/symbol`          | See the [pprof Symbol](https://golang.org/pkg/net/http/pprof/#Symbol) Go documentation.     |
| `/debug/pprof/trace`           | See the [pprof Trace](https://golang.org/pkg/net/http/pprof/#Trace) Go documentation.       |


text:
<?php

if (!is_writable($tempdir))
{
    echo  "
".sprintf(gT("Tempdir %s is not writable"),$tempdir)."
";
}
if (!is_writable(APPPATH.DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'update.php'))
{
    echo  "
".sprintf(gT("Updater file is not writable (%s). Please set according file permissions."),DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'update.php')."
";
}

if ($httperror != '')
{
	print( $httperror );
}

if (!$updater_exists)
{
	eT('There was a problem downloading the updater file. Please try to restart the update process.').'
';
}

?>


text:
import birb from "refractor/lang/birb.js";;
export default birb;


text:
package org.frikadelki.ash.telegram.api.update;

import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.frikadelki.ash.toolset.utils.AshAssert;
import org.frikadelki.ash.toolset.utils.Lambda;
import org.frikadelki.ash.toolset.utils.collections.StreamCompat;

import java.util.ArrayList;

@RequiredArgsConstructor
public final class TgmUpdateDispatchRelay {
	private final ArrayList<TgmUpdateHandler> handlers = new ArrayList<>();

	public void addHandler(@NonNull final TgmUpdateHandler handler) {
		AshAssert.aFalse(handlers.contains(handler));
		handlers.add(handler);
	}

	public void dispatchUpdate(@NonNull final TgmUpdateDispatchContext context, @NonNull final TgmUpdate update) {
		StreamCompat.forEach(handlers, new Lambda.Code1<TgmUpdateHandler>() {
			@Override
			public void invoke(final TgmUpdateHandler handler) {
				if (!handler.getFilter().isMatch(update)) {
					return;
				}
				handler.dispatchUpdate(context, update);
			}
		});
	}
}


text:
from datetime import datetime
from datetime import timedelta
from datetime import timezone
from json import JSONEncoder
from typing import Iterable
from typing import List
from typing import Optional
from typing import Sequence
from typing import Type
from typing import Union

from flask import current_app
from jwt.algorithms import requires_cryptography

from flask_jwt_extended.internal_utils import get_json_encoder
from flask_jwt_extended.typing import ExpiresDelta

class _Config(object):
    """
    Helper object for accessing and verifying options in this extension. This
    is meant for internal use of the application; modifying config options
    should be done with flasks ```app.config```.

    Default values for the configuration options are set in the jwt_manager
    object. All of these values are read only. This is simply a loose wrapper
    with some helper functionality for flasks `app.config`.
    """

    @property
    def is_asymmetric(self) -> bool:
        return self.algorithm in requires_cryptography

    @property
    def encode_key(self) -> str:
        return self._private_key if self.is_asymmetric else self._secret_key

    @property
    def decode_key(self) -> str:
        return self._public_key if self.is_asymmetric else self._secret_key

    @property
    def token_location(self) -> Sequence[str]:
        locations = current_app.config["JWT_TOKEN_LOCATION"]
        if isinstance(locations, str):
            locations = (locations,)
        elif not isinstance(locations, Iterable):
            raise RuntimeError("JWT_TOKEN_LOCATION must be a sequence or a set")
        elif not locations:
            raise RuntimeError(
                "JWT_TOKEN_LOCATION must contain at least one "
                'of "headers", "cookies", "query_string", or "json"'
            )
        for location in locations:
            if location not in ("headers", "cookies", "query_string", "json"):
                raise RuntimeError(
                    "JWT_TOKEN_LOCATION can only contain "
                    '"headers", "cookies", "query_string", or "json"'
                )
        return locations

    @property
    def jwt_in_cookies(self) -> bool:
        return "cookies" in self.token_location

    @property
    def jwt_in_headers(self) -> bool:
        return "headers" in self.token_location

    @property
    def jwt_in_query_string(self) -> bool:
        return "query_string" in self.token_location

    @property
    def jwt_in_json(self) -> bool:
        return "json" in self.token_location

    @property
    def header_name(self) -> str:
        name = current_app.config["JWT_HEADER_NAME"]
        if not name:
            raise RuntimeError("JWT_ACCESS_HEADER_NAME cannot be empty")
        return name

    @property
    def header_type(self) -> str:
        return current_app.config["JWT_HEADER_TYPE"]

    @property
    def query_string_name(self) -> str:
        return current_app.config["JWT_QUERY_STRING_NAME"]

    @property
    def query_string_value_prefix(self) -> str:
        return current_app.config["JWT_QUERY_STRING_VALUE_PREFIX"]

    @property
    def access_cookie_name(self) -> str:
        return current_app.config["JWT_ACCESS_COOKIE_NAME"]

    @property
    def refresh_cookie_name(self) -> str:
        return current_app.config["JWT_REFRESH_COOKIE_NAME"]

    @property
    def access_cookie_path(self) -> str:
        return current_app.config["JWT_ACCESS_COOKIE_PATH"]

    @property
    def refresh_cookie_path(self) -> str:
        return current_app.config["JWT_REFRESH_COOKIE_PATH"]

    @property
    def cookie_secure(self) -> bool:
        return current_app.config["JWT_COOKIE_SECURE"]

    @property
    def cookie_domain(self) -> str:
        return current_app.config["JWT_COOKIE_DOMAIN"]

    @property
    def session_cookie(self) -> bool:
        return current_app.config["JWT_SESSION_COOKIE"]

    @property
    def cookie_samesite(self) -> str:
        return current_app.config["JWT_COOKIE_SAMESITE"]

    @property
    def json_key(self) -> str:
        return current_app.config["JWT_JSON_KEY"]

    @property
    def refresh_json_key(self) -> str:
        return current_app.config["JWT_REFRESH_JSON_KEY"]

    @property
    def csrf_protect(self) -> bool:
        return self.jwt_in_cookies and current_app.config["JWT_COOKIE_CSRF_PROTECT"]

    @property
    def csrf_request_methods(self) -> Iterable[str]:
        return current_app.config["JWT_CSRF_METHODS"]

    @property
    def csrf_in_cookies(self) -> bool:
        return current_app.config["JWT_CSRF_IN_COOKIES"]

    @property
    def access_csrf_cookie_name(self) -> str:
        return current_app.config["JWT_ACCESS_CSRF_COOKIE_NAME"]

    @property
    def refresh_csrf_cookie_name(self) -> str:
        return current_app.config["JWT_REFRESH_CSRF_COOKIE_NAME"]

    @property
    def access_csrf_cookie_path(self) -> str:
        return current_app.config["JWT_ACCESS_CSRF_COOKIE_PATH"]

    @property
    def refresh_csrf_cookie_path(self) -> str:
        return current_app.config["JWT_REFRESH_CSRF_COOKIE_PATH"]

    @property
    def access_csrf_header_name(self) -> str:
        return current_app.config["JWT_ACCESS_CSRF_HEADER_NAME"]

    @property
    def refresh_csrf_header_name(self) -> str:
        return current_app.config["JWT_REFRESH_CSRF_HEADER_NAME"]

    @property
    def csrf_check_form(self) -> bool:
        return current_app.config["JWT_CSRF_CHECK_FORM"]

    @property
    def access_csrf_field_name(self) -> str:
        return current_app.config["JWT_ACCESS_CSRF_FIELD_NAME"]

    @property
    def refresh_csrf_field_name(self) -> str:
        return current_app.config["JWT_REFRESH_CSRF_FIELD_NAME"]

    @property
    def access_expires(self) -> ExpiresDelta:
        delta = current_app.config["JWT_ACCESS_TOKEN_EXPIRES"]
        if type(delta) is int:
            delta = timedelta(seconds=delta)
        if delta is not False:
            try:
                # Basically runtime typechecking. Probably a better way to do
                # this with proper type checking
                delta + datetime.now(timezone.utc)
            except TypeError as e:
                err = (
                    "must be able to add JWT_ACCESS_TOKEN_EXPIRES to datetime.datetime"
                )
                raise RuntimeError(err) from e
        return delta

    @property
    def refresh_expires(self) -> ExpiresDelta:
        delta = current_app.config["JWT_REFRESH_TOKEN_EXPIRES"]
        if type(delta) is int:
            delta = timedelta(seconds=delta)
        if delta is not False:
            # Basically runtime typechecking. Probably a better way to do
            # this with proper type checking
            try:
                delta + datetime.now(timezone.utc)
            except TypeError as e:
                err = (
                    "must be able to add JWT_REFRESH_TOKEN_EXPIRES to datetime.datetime"
                )
                raise RuntimeError(err) from e
        return delta

    @property
    def algorithm(self) -> str:
        return current_app.config["JWT_ALGORITHM"]

    @property
    def decode_algorithms(self) -> List[str]:
        algorithms = current_app.config["JWT_DECODE_ALGORITHMS"]
        if not algorithms:
            return [self.algorithm]
        if self.algorithm not in algorithms:
            algorithms.append(self.algorithm)
        return algorithms

    @property
    def _secret_key(self) -> str:
        key = current_app.config["JWT_SECRET_KEY"]
        if not key:
            key = current_app.config.get("SECRET_KEY", None)
            if not key:
                raise RuntimeError(
                    "JWT_SECRET_KEY or flask SECRET_KEY "
                    "must be set when using symmetric "
                    'algorithm "{}"'.format(self.algorithm)
                )
        return key

    @property
    def _public_key(self) -> str:
        key = current_app.config["JWT_PUBLIC_KEY"]
        if not key:
            raise RuntimeError(
                "JWT_PUBLIC_KEY must be set to use "
                "asymmetric cryptography algorithm "
                '"{}"'.format(self.algorithm)
            )
        return key

    @property
    def _private_key(self) -> str:
        key = current_app.config["JWT_PRIVATE_KEY"]
        if not key:
            raise RuntimeError(
                "JWT_PRIVATE_KEY must be set to use "
                "asymmetric cryptography algorithm "
                '"{}"'.format(self.algorithm)
            )
        return key

    @property
    def cookie_max_age(self) -> Optional[int]:
        # Returns the appropiate value for max_age for flask set_cookies. If
        # session cookie is true, return None, otherwise return a number of
        # seconds 1 year in the future
        return None if self.session_cookie else 31540000  # 1 year

    @property
    def identity_claim_key(self) -> str:
        return current_app.config["JWT_IDENTITY_CLAIM"]

    @property
    def exempt_methods(self) -> Iterable[str]:
        return {"OPTIONS"}

    @property
    def error_msg_key(self) -> str:
        return current_app.config["JWT_ERROR_MESSAGE_KEY"]

    @property
    def json_encoder(self) -> Type[JSONEncoder]:
        return get_json_encoder(current_app)

    @property
    def decode_audience(self) -> Union[str, Iterable[str]]:
        return current_app.config["JWT_DECODE_AUDIENCE"]

    @property
    def encode_audience(self) -> Union[str, Iterable[str]]:
        return current_app.config["JWT_ENCODE_AUDIENCE"]

    @property
    def encode_issuer(self) -> str:
        return current_app.config["JWT_ENCODE_ISSUER"]

    @property
    def decode_issuer(self) -> str:
        return current_app.config["JWT_DECODE_ISSUER"]

    @property
    def leeway(self) -> int:
        return current_app.config["JWT_DECODE_LEEWAY"]

    @property
    def encode_nbf(self) -> bool:
        return current_app.config["JWT_ENCODE_NBF"]

config = _Config()


text:
package com.orientechnologies.orient.object.db;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import javassist.util.proxy.ProxyObject;

import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.object.OLazyObjectSetInterface;
import com.orientechnologies.orient.core.db.object.OObjectLazyMultivalueElement;
import com.orientechnologies.orient.core.db.record.ODatabaseRecord;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.record.ORecord;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler;

/**
 * Lazy implementation of Set. It's bound to a source ORecord object to keep track of changes. This avoid to call the makeDirty() by
 * hand when the set is changed.
 *
 * @author Luca Molino (molino.luca--at--gmail.com)
 *
 */
@SuppressWarnings("unchecked")
public class OObjectLazySet<TYPE> extends HashSet<TYPE> implements OLazyObjectSetInterface<TYPE>,
    OObjectLazyMultivalueElement<Set<TYPE>>, Serializable {
  private static final long        serialVersionUID = 1793910544017627989L;

  private final ProxyObject        sourceRecord;
  private final Set<OIdentifiable> underlying;
  private String                   fetchPlan;
  private boolean                  converted        = false;
  private boolean                  convertToRecord  = true;
  private final boolean            orphanRemoval;

  public OObjectLazySet(final Object iSourceRecord, final Set<OIdentifiable> iRecordSource, final boolean orphanRemoval) {
    this.sourceRecord = iSourceRecord instanceof ProxyObject ? (ProxyObject) iSourceRecord : null;
    this.underlying = iRecordSource;
    this.orphanRemoval = orphanRemoval;
  }

  public OObjectLazySet(final Object iSourceRecord, final Set<OIdentifiable> iRecordSource,
      final Set<? extends TYPE> iSourceCollection, final boolean orphanRemoval) {
    this.sourceRecord = iSourceRecord instanceof ProxyObject ? (ProxyObject) iSourceRecord : null;
    this.underlying = iRecordSource;
    this.orphanRemoval = orphanRemoval;
    addAll(iSourceCollection);
  }

  public Iterator<TYPE> iterator() {
    return new OObjectLazyIterator<TYPE>(getDatabase(), sourceRecord, (!converted ? underlying.iterator() : super.iterator()),
        convertToRecord, orphanRemoval);
  }

  public int size() {
    return underlying.size();
  }

  public boolean isEmpty() {
    return super.isEmpty() && underlying.isEmpty();
  }

  public boolean contains(final Object o) {
    return super.contains(o) || underlying.contains(getDatabase().getRecordByUserObject(o, false));
  }

  public Object[] toArray() {
    return toArray(new Object[size()]);
  }

  public <T> T[] toArray(final T[] a) {
    convertAll();
    return super.toArray(a);
  }

  public boolean add(final TYPE e) {
    if (underlying != null && underlying.size() > 0 && !converted) {
      convertAllInternal();
    }
    if (converted && e instanceof ORID)
      converted = false;
    setDirty();
    boolean thisModified = super.add(e);
    if (thisModified) {
      OIdentifiable record = getDatabase().getRecordByUserObject(e, false);
      if (sourceRecord != null)
        ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getOrphans().remove(record.getIdentity());
      underlying.add(record);
      return true;
    }
    return false;
  }

  public boolean remove(final Object o) {
    setDirty();
    OIdentifiable record = getDatabase().getRecordByUserObject(o, false);
    if (orphanRemoval && record != null && sourceRecord != null)
      ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getOrphans().add(record.getIdentity());
    boolean thisModified = super.remove(o);
    boolean underlyingModified = underlying.remove(record);
    return thisModified || underlyingModified;
  }

  public boolean containsAll(final Collection<?> c) {
    convertAll();
    for (Object o : c)
      if (!contains(o))
        return false;

    return true;
  }

  public boolean addAll(final Collection<? extends TYPE> c) {
    boolean modified = false;
    for (Object o : c) {
      modified |= add((TYPE) o);
    }
    return modified;
  }

  public boolean retainAll(final Collection<?> c) {
    setDirty();
    final ODatabasePojoAbstract<TYPE> database = getDatabase();
    boolean modified = super.retainAll(c);
    Set<Object> toRetain = new HashSet<Object>();
    Set<Object> toRemove = new HashSet<Object>();
    for (Object o : c) {
      OIdentifiable record = database.getRecordByUserObject(o, false);
      toRetain.add(record);
    }
    for (OIdentifiable underlyingRec : underlying) {
      if (toRetain.contains(underlyingRec) && sourceRecord != null) {
        ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getOrphans().remove(underlyingRec.getIdentity());
      } else {
        if (sourceRecord != null)
          ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getOrphans().add(underlyingRec.getIdentity());
        toRemove.add(underlyingRec);
        modified = true;
      }
    }
    underlying.removeAll(toRemove);
    toRemove.clear();
    toRetain.clear();
    return modified;
  }

  public void clear() {
    setDirty();
    super.clear();
    if (orphanRemoval && sourceRecord != null)
      for (OIdentifiable value : underlying) {
        ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getOrphans().add(value.getIdentity());
      }
    underlying.clear();
  }

  public boolean removeAll(final Collection<?> c) {
    setDirty();
    final ODatabasePojoAbstract<TYPE> database = getDatabase();
    boolean modified = super.removeAll(c);
    for (Object o : c) {
      OIdentifiable record = database.getRecordByUserObject(o, false);
      if (orphanRemoval && record != null && sourceRecord != null)
        ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getOrphans().add(record.getIdentity());
      if (!underlying.remove(database.getRecordByUserObject(o, false)))
        modified = true;
    }
    return modified;
  }

  public String getFetchPlan() {
    return fetchPlan;
  }

  public boolean isConverted() {
    return converted;
  }

  public OObjectLazySet<TYPE> setFetchPlan(String fetchPlan) {
    this.fetchPlan = fetchPlan;
    return this;
  }

  public boolean isConvertToRecord() {
    return convertToRecord;
  }

  public void setConvertToRecord(boolean convertToRecord) {
    this.convertToRecord = convertToRecord;
  }

  @Override
  public String toString() {
    return super.size() == underlying.size() ? super.toString() : underlying.toString();
  }

  public void setDirty() {
    if (sourceRecord != null)
      ((OObjectProxyMethodHandler) sourceRecord.getHandler()).setDirty();
  }

  public void detach() {
    convertAll();
  }

  public void detach(boolean nonProxiedInstance) {
    convertAll();
  }

  public void detachAll(boolean nonProxiedInstance) {
    convertAndDetachAll(nonProxiedInstance);
  }

  @Override
  public Set<TYPE> getNonOrientInstance() {
    Set<TYPE> set = new HashSet<TYPE>();
    set.addAll(this);
    return set;
  }

  @Override
  public Object getUnderlying() {
    return underlying;
  }

  protected void convertAll() {
    if (converted || !convertToRecord)
      return;

    final Set<Object> copy = new HashSet<Object>(underlying);
    super.clear();
    final ODatabasePojoAbstract<TYPE> database = getDatabase();
    for (Object e : copy) {
      if (e != null) {
        if (e instanceof ORID)
          add(database
              .getUserObjectByRecord(((ODatabaseRecord) getDatabase().getUnderlying()).load((ORID) e, fetchPlan), fetchPlan));
        else if (e instanceof ODocument)
          add(database.getUserObjectByRecord((ORecord) e, fetchPlan));
        else
          add((TYPE) e);
      }
    }

    converted = true;
  }

  protected void convertAllInternal() {
    if (converted || !convertToRecord)
      return;

    final Set<Object> copy = new HashSet<Object>(underlying);
    super.clear();
    final ODatabasePojoAbstract<TYPE> database = getDatabase();
    for (Object e : copy) {
      if (e != null) {
        if (e instanceof ORID)
          super.add(database.getUserObjectByRecord(((ODatabaseRecord) getDatabase().getUnderlying()).load((ORID) e, fetchPlan),
              fetchPlan));
        else if (e instanceof ODocument)
          super.add(database.getUserObjectByRecord((ORecord) e, fetchPlan));
        else
          super.add((TYPE) e);
      }
    }
    converted = true;
  }

  protected void convertAndDetachAll(boolean nonProxiedInstance) {
    if (converted || !convertToRecord)
      return;

    final Set<Object> copy = new HashSet<Object>(underlying);
    super.clear();
    final ODatabasePojoAbstract<TYPE> database = getDatabase();
    for (Object e : copy) {
      if (e != null) {
        if (e instanceof ORID) {
          e = database
              .getUserObjectByRecord(((ODatabaseRecord) getDatabase().getUnderlying()).load((ORID) e, fetchPlan), fetchPlan);
          super.add((TYPE) ((OObjectDatabaseTx) getDatabase()).detachAll(e, nonProxiedInstance));
        } else if (e instanceof ODocument) {
          e = database.getUserObjectByRecord((ORecord) e, fetchPlan);
          super.add((TYPE) ((OObjectDatabaseTx) getDatabase()).detachAll(e, nonProxiedInstance));
        } else
          add((TYPE) e);
      }
    }

    converted = true;
  }

  protected ODatabasePojoAbstract<TYPE> getDatabase() {
    return (ODatabasePojoAbstract<TYPE>) ODatabaseRecordThreadLocal.INSTANCE.get().getDatabaseOwner();
  }
}


text:
[![Build Status](https://travis-ci.org/prikhi/elm-http-builder.svg?branch=master)](https://travis-ci.org/prikhi/elm-http-builder)

Chainable functions for building HTTP requests and composable functions for handling responses.

**Need help? Join the #http channel in the [Elm Slack](https://elmlang.herokuapp.com)!**

This is an Elm 0.18 fork of lukewestby's elm-http-builder package that provides
an API for specifying Responses as well as Requests.

## Example

In this example, we expect a successful response to be JSON array of strings,
like:

```json
["hello", "world", "this", "is", "the", "best", "json", "ever"]
```

and an error response might have a body which just includes text, such as the
following for a 404 error:

```json
Not Found.
```

We'll use `HttpBuilder.jsonReader` and a `Json.Decode.Decoder` to parse the
successful response body and `HttpBuilder.stringReader` to accept a string
body on error without trying to parse JSON.

```elm
import Task exposing (Task)
import Time
import HttpBuilder exposing (..)
import Json.Decode as Decode
import Json.Encode as Encode

itemsDecoder : Decode.Decoder (List String)
itemsDecoder =
  Decode.list Decode.string

itemEncoder : String -> Encode.Value
itemEncoder item =
  Encode.object
    [ ("item", Encode.string item) ]

addItem : String -> Task (HttpBuilder.Error String) (HttpBuilder.Response (List String))
addItem item =
  HttpBuilder.post "http://example.com/api/items"
    |> withJsonBody (itemEncoder item)
    |> withHeader "Content-Type" "application/json"
    |> withTimeout (10 * Time.second)
    |> withCredentials
    |> send (jsonReader itemsDecoder) stringReader
```


text:
ionic plugin rm org.apache.cordova.console
ionic plugin rm org.apache.cordova.device
ionic plugin rm com.ionic.keyboard
ionic plugin rm org.apache.cordova.statusbar
ionic plugin rm org.apache.cordova.splashscreen
ionic plugin rm com.danielcwilson.plugins.googleanalytics
ionic plugin rm org.pushandplay.cordova.apprate
ionic plugin rm org.apache.cordova.dialogs
ionic plugin rm org.apache.cordova.inappbrowser

# Install Plugins
ionic plugin add org.apache.cordova.console
ionic plugin add org.apache.cordova.device
ionic plugin add com.ionic.keyboard
ionic plugin add org.apache.cordova.statusbar
ionic plugin add org.apache.cordova.splashscreen
ionic plugin add com.danielcwilson.plugins.googleanalytics
ionic plugin add org.pushandplay.cordova.apprate
ionic plugin add org.apache.cordova.dialogs
ionic plugin add org.apache.cordova.inappbrowser