text:
package com.vladsch.md.nav.util.format;

import com.intellij.lang.ASTNode;
import com.intellij.openapi.editor.Editor;
import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension;
import com.vladsch.flexmark.ext.tables.TablesExtension;
import com.vladsch.flexmark.formatter.Formatter;
import com.vladsch.flexmark.util.data.MutableDataHolder;
import com.vladsch.flexmark.util.format.CharWidthProvider;
import com.vladsch.md.nav.actions.handlers.util.PsiEditContext;
import com.vladsch.md.nav.editor.api.MdFormatCustomizationProvider;
import com.vladsch.md.nav.language.DiscretionaryText;
import com.vladsch.md.nav.language.FormatWithSoftWrap;
import com.vladsch.md.nav.language.MdCodeStyleSettings;
import com.vladsch.md.nav.language.TableCaptionActionType;
import com.vladsch.md.nav.parser.PegdownOptionsAdapter;
import com.vladsch.md.nav.psi.util.MdTypes;
import com.vladsch.md.nav.settings.MdRenderingProfile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.regex.Pattern;

public class FlexmarkFormatOptionsAdapter {
    final @NotNull PsiEditContext myEditContext;
    final @NotNull MdRenderingProfile myRenderingProfile;
    final @NotNull MdCodeStyleSettings myStyleSettings;
    final @Nullable Editor myEditor;

    @NotNull CharWidthProvider myCharWidthProvider = CharWidthProvider.NULL;

    public FlexmarkFormatOptionsAdapter(@NotNull PsiEditContext editContext, int startOffset, int endOffset) {
        this.myEditContext = editContext;
        this.myRenderingProfile = editContext.getRenderingProfile();
        this.myStyleSettings = editContext.getStyleSettings();
        this.myEditor = editContext.getEditor();
        setCharWidthProvider(startOffset, endOffset);
    }

    private void setCharWidthProvider(int startOffset, int endOffset) {
        myCharWidthProvider = CharWidthProvider.NULL;

        if (myStyleSettings.USE_ACTUAL_CHAR_WIDTH) {
            for (MdFormatCustomizationProvider provider : MdFormatCustomizationProvider.EXTENSIONS.getValue()) {
                CharWidthProvider charWidthProvider = provider.createCharWidthProvider(myEditContext, startOffset, endOffset);
                if (charWidthProvider != null && charWidthProvider != CharWidthProvider.NULL) {
                    myCharWidthProvider = charWidthProvider;
                }
            }
        }
    }

    @NotNull
    public PsiEditContext getEditContext() {
        return myEditContext;
    }

    @NotNull
    public MdRenderingProfile getRenderingProfile() {
        return myRenderingProfile;
    }

    @NotNull
    public MdCodeStyleSettings getStyleSettings() {
        return myStyleSettings;
    }

    @Nullable
    public Editor getEditor() {
        return myEditor;
    }

    @NotNull
    public CharWidthProvider getCharWidthProvider() {
        return myCharWidthProvider;
    }

    @NotNull
    public MutableDataHolder getTableFormatOptions(@Nullable CharSequence tableIndentPrefix) {
        return getFormatOptions()
                .set(TablesExtension.FORMAT_TABLE_INDENT_PREFIX, tableIndentPrefix == null ? "" : tableIndentPrefix.toString());
    }

    @NotNull
    public MutableDataHolder getFormatOptions() {
        MutableDataHolder options = PegdownOptionsAdapter.flexmarkOptions(myRenderingProfile).toMutable();

        // Plugin Only Settings
        // SMART_EDIT_TABLES
        // SMART_EDIT_TABLE_SEPARATOR_LINE
        // INDENT_SIZE
        // TAB_SIZE
        // USE_TAB_CHARACTER
        // SMART_TABS
        // WRAP_ON_TYPING
        // SMART_EDIT_ATX_HEADER
        // SMART_EDIT_SETEXT_HEADER
        // SMART_ENTER_SETEXT_HEADER
        // SMART_ENTER_ATX_HEADER
        // TOC_FORMAT_ON_SAVE
        // NEW_BULLET_LIST_ITEM_MARKER
        // FORMAT_WITH_SOFT_WRAP

        // Passed indirectly
        // USE_ACTUAL_CHAR_WIDTH

        FormatWithSoftWrap formatWithSoftWrap = myStyleSettings.FORMAT_WITH_SOFT_WRAP();
        boolean isUseSoftWraps = myEditor != null && myEditor.getSettings().isUseSoftWraps();
        boolean useInfiniteMargins = isUseSoftWraps && formatWithSoftWrap == FormatWithSoftWrap.INFINITE_MARGIN;

        ASTNode frontMatterNode = myEditContext.getFrontMatterNode();
        boolean hasFrontMatter = frontMatterNode != null && frontMatterNode.getElementType() == MdTypes.JEKYLL_FRONT_MATTER_OPEN;
        boolean hasFlexmarkFrontMatter = frontMatterNode != null && frontMatterNode.getElementType() == MdTypes.FLEXMARK_FRONT_MATTER_OPEN;

        int keepBlankLines = hasFlexmarkFrontMatter ? Math.max(2, myStyleSettings.KEEP_BLANK_LINES) : myStyleSettings.KEEP_BLANK_LINES;
        options
                .set(Formatter.FORMAT_CHAR_WIDTH_PROVIDER, myCharWidthProvider)
                // FEATURE: add separate setting for trailing and max blank lines, also separate flexmark spec example differences
                .set(Formatter.MAX_TRAILING_BLANK_LINES, keepBlankLines)
                .set(Formatter.MAX_BLANK_LINES, keepBlankLines)
                .set(Formatter.FORMATTER_ON_TAG, myStyleSettings.getContainer().FORMATTER_ON_TAG)
                .set(Formatter.FORMATTER_OFF_TAG, myStyleSettings.getContainer().FORMATTER_OFF_TAG)
                .set(Formatter.FORMATTER_TAGS_ENABLED, myStyleSettings.getContainer().FORMATTER_TAGS_ENABLED)
                .set(Formatter.FORMATTER_TAGS_ACCEPT_REGEXP, myStyleSettings.getContainer().FORMATTER_TAGS_ACCEPT_REGEXP)

                // add link markup
                .set(Formatter.LINK_MARKER_COMMENT_PATTERN, Pattern.compile("^\\s*@IGNORE PREVIOUS:.*$"))

                // PARA_WRAP_TEXT
                .set(Formatter.RIGHT_MARGIN, myStyleSettings.PARA_WRAP_TEXT ? (useInfiniteMargins ? 50000 : myRenderingProfile.getRightMargin()) : 0)

                .set(TablesExtension.FORMAT_TABLE_LEAD_TRAIL_PIPES, myStyleSettings.TABLE_LEAD_TRAIL_PIPES)
                .set(TablesExtension.FORMAT_TABLE_SPACE_AROUND_PIPES, myStyleSettings.TABLE_SPACE_AROUND_PIPE)
                .set(TablesExtension.FORMAT_TABLE_ADJUST_COLUMN_WIDTH, myStyleSettings.TABLE_ADJUST_COLUMN_WIDTH)
                .set(TablesExtension.FORMAT_TABLE_APPLY_COLUMN_ALIGNMENT, myStyleSettings.TABLE_APPLY_COLUMN_ALIGNMENT)
                .set(TablesExtension.FORMAT_TABLE_FILL_MISSING_COLUMNS, myStyleSettings.TABLE_FILL_MISSING_COLUMNS)
                .set(TablesExtension.FORMAT_TABLE_CAPTION, TableCaptionActionType.ADAPTER.get(myStyleSettings.TABLE_CAPTION).flexMarkEnum)
                .set(TablesExtension.FORMAT_TABLE_CAPTION_SPACES, DiscretionaryText.ADAPTER.get(myStyleSettings.TABLE_CAPTION_SPACES).flexMarkEnum)
                .set(TablesExtension.FORMAT_TABLE_LEFT_ALIGN_MARKER, DiscretionaryText.ADAPTER.get(myStyleSettings.TABLE_LEFT_ALIGN_MARKER).flexMarkEnum)
                .set(TablesExtension.FORMAT_TABLE_MIN_SEPARATOR_COLUMN_WIDTH, 3)
                .set(TablesExtension.FORMAT_TABLE_MIN_SEPARATOR_DASHES, 3)
                .set(TablesExtension.FORMAT_TABLE_TRIM_CELL_WHITESPACE, myStyleSettings.TABLE_TRIM_CELLS || myStyleSettings.TABLE_APPLY_COLUMN_ALIGNMENT)

                .set(Formatter.LIST_ADD_BLANK_LINE_BEFORE, myStyleSettings.LIST_ADD_BLANK_LINE_BEFORE)
                .set(Formatter.LIST_RENUMBER_ITEMS, myStyleSettings.LIST_RENUMBER_ITEMS)
                .set(Formatter.LIST_BULLET_MARKER, myStyleSettings.BULLET_LIST_ITEM_MARKER().flexMarkEnum)
                .set(Formatter.LIST_ALIGN_NUMERIC, myStyleSettings.LIST_ALIGN_NUMERIC().flexMarkEnum)
                .set(Formatter.LIST_RESET_FIRST_ITEM_NUMBER, myStyleSettings.LIST_RESET_FIRST_ITEM_NUMBER)
                .set(Formatter.LIST_SPACING, myStyleSettings.LIST_SPACING().flexMarkEnum)

                .set(Formatter.SETEXT_HEADING_EQUALIZE_MARKER, myStyleSettings.SETEXT_HEADER_EQUALIZE_MARKER)
                .set(Formatter.ATX_HEADING_TRAILING_MARKER, myStyleSettings.ATX_HEADER_TRAILING_MARKER().flexMarkEnum)
                .set(Formatter.SPACE_AFTER_ATX_MARKER, myStyleSettings.SPACE_AFTER_ATX_MARKER().flexMarkEnum)
                .set(Formatter.HEADING_STYLE, myStyleSettings.HEADING_PREFERENCE().flexMarkEnum)

                .set(Formatter.REFERENCE_PLACEMENT, myStyleSettings.REFERENCE_PLACEMENT().flexMarkEnum)
                .set(Formatter.REFERENCE_SORT, myStyleSettings.REFERENCE_SORT().flexMarkEnum)

                .set(Formatter.ESCAPE_SPECIAL_CHARS, myStyleSettings.ESCAPE_SPECIAL_CHARS_ON_WRAP)
                .set(Formatter.ESCAPE_NUMBERED_LEAD_IN, myStyleSettings.ESCAPE_NUMBERED_LEAD_IN_ON_WRAP)
                .set(Formatter.UNESCAPE_SPECIAL_CHARS, myStyleSettings.UNESCAPE_SPECIAL_CHARS_ON_WRAP)

                .set(Formatter.FENCED_CODE_MARKER_LENGTH, myStyleSettings.CODE_FENCE_MARKER_LENGTH)
                .set(Formatter.FENCED_CODE_MARKER_TYPE, myStyleSettings.CODE_FENCE_MARKER_TYPE().flexMarkEnum)
                .set(Formatter.FENCED_CODE_MATCH_CLOSING_MARKER, myStyleSettings.CODE_FENCE_MATCH_CLOSING_MARKER)
                .set(Formatter.FENCED_CODE_MINIMIZE_INDENT, myStyleSettings.CODE_FENCE_MINIMIZE_INDENT)
                .set(Formatter.FENCED_CODE_SPACE_BEFORE_INFO, myStyleSettings.CODE_FENCE_SPACE_BEFORE_INFO)
                .set(Formatter.INDENTED_CODE_MINIMIZE_INDENT, myStyleSettings.VERBATIM_MINIMIZE_INDENT)
                .set(Formatter.BLOCK_QUOTE_MARKERS, myStyleSettings.BLOCK_QUOTE_MARKERS().flexMarkEnum)

                .set(Formatter.KEEP_EXPLICIT_LINKS_AT_START, myStyleSettings.keepAtStartOfLine(MdTypes.EXPLICIT_LINK, hasFrontMatter))
                .set(Formatter.KEEP_IMAGE_LINKS_AT_START, myStyleSettings.keepAtStartOfLine(MdTypes.IMAGE, hasFrontMatter))

                // Task List Extension
                .set(TaskListExtension.FORMAT_LIST_ITEM_CASE, myStyleSettings.TASK_LIST_ITEM_CASE().flexMarkEnum)
                .set(TaskListExtension.FORMAT_LIST_ITEM_PLACEMENT, myStyleSettings.TASK_LIST_ITEM_PLACEMENT().flexMarkEnum)
                .set(Formatter.LISTS_ITEM_CONTENT_AFTER_SUFFIX, myStyleSettings.TASK_ITEM_CONTINUATION().isAlignToFirst()) // text indents after task item suffix
        ;

        // Allow customizations
        for (MdFormatCustomizationProvider provider : MdFormatCustomizationProvider.EXTENSIONS.getValue()) {
            provider.customizeFormatOptions(this, options);
        }

        return options;
    }
}


text:
package game

import (
	"git.code4.in/mobilegameserver/logging"
	"github.com/navy1125/gameauth/game/bw"
	"net/http"
	"regexp"
	"strconv"
	"strings"
)

//login func
type GameLoginFunc func(zoneid uint32, myaccount string, myaccid uint32, isAdult uint32, token string) error
type GameLogin interface {
	Init(name string) bool
	Login(zoneid uint32, myaccount string, myaccid uint32, isAdult uint32, token string, w http.ResponseWriter, platname string, req *http.Request, err_url string) error
}
type GameBill interface {
	Init(name string) bool
	Billing(zoneid uint32, myaccid uint32, charid uint32, moneynum uint32) error
}

var (
	loginMap map[string]GameLogin
	billMap  map[string]GameBill
)

func init() {
	loginMap = make(map[string]GameLogin)
	AddLogin("zssj", bw.NewGameLoginBw())
	billMap = make(map[string]GameBill)
	AddBill("zssj", bw.NewGameBillingBw())

}
func InitLogin() bool {
	for key, val := range loginMap {
		go val.Init(key)
	}
	return true
}
func AddLogin(name string, game GameLogin) {
	loginMap[name] = game
}
func InitBill() bool {
	for key, val := range billMap {
		go val.Init(key)
	}
	return true
}
func AddBill(name string, game GameBill) {
	billMap[name] = game
}

func AddLoginToken(game string, server_id string, myaccount string, myaccid uint32, isAdult uint32, token string, w http.ResponseWriter, platname string, req *http.Request, err_url string) error {
	if gamefun, ok := loginMap[game]; ok == true {
		zoneid, _ := strconv.Atoi(server_id)
		return gamefun.Login(uint32(zoneid), myaccount, myaccid, isAdult, token, w, platname, req, err_url)
	} else {
		logging.Error("not game func for game:%s", game)
	}
	return nil
}
func Billing(game string, server_id string, myaccid uint32, charid uint32, moneynum uint32) error {
	if gamefun, ok := billMap[game]; ok == true {
		zoneid, _ := strconv.Atoi(server_id)
		return gamefun.Billing(uint32(zoneid), myaccid, charid, moneynum)
	} else {
		logging.Error("not game func for game:%s", game)
	}
	return nil
}

//get gamename by urlstring usl master as /game/plat
func GetGameNameByUrl(url string) string {
	if ok, err := regexp.MatchString("^/.*/.*/.*$", url); ok == false || err != nil {
		logging.Error("url string err:%s", url)
		return ""
	}
	return strings.Split(url, "/")[1]
}

//get platname by urlstring usl master as /game/plat
func GetPlatNameByUrl(url string) string {
	if ok, err := regexp.MatchString("^/.*/.*/.*$", url); ok == false || err != nil {
		logging.Error("url string err:%s", url)
		return ""
	}
	return strings.Split(url, "/")[2]
}

redpajama_set_name: RedPajamaGithub


text:
package models

import (
	"time"

	"github.com/nttdots/go-dots/dots_server/db_models"
	//log "github.com/sirupsen/logrus"
)

/*
 * Convert this protection to a DB protection model.
 */
func toGoBGPParameters(obj Protection, protectionID int64) []db_models.GoBgpParameter {
	result := make([]db_models.GoBgpParameter, 0)
    t, _ := obj.(*RTBH)
	for _, target := range t.RtbhTargets() {
		result = append(result, db_models.GoBgpParameter{
			ProtectionId: protectionID,
			TargetAddress: target})
	}

	return result
}

/*
 * Convert this protection to a DB protection model.
 */
func toFlowSpecParameters(obj Protection, protectionID int64) []db_models.FlowSpecParameter {
	result := make([]db_models.FlowSpecParameter, 0)
    t, _ := obj.(*FlowSpec)
	for _, target := range t.FlowSpecTargets() {
		result = append(result, db_models.FlowSpecParameter{
			ProtectionId: protectionID,
			FlowType: target.flowType,
			FlowSpec: target.flowSpec,
		})
	}

	return result
}

/*
 * Convert this protection to a DB protection model.
 */
func toAristaParameters(obj Protection, protectionID int64) []db_models.AristaParameter {
	result := make([]db_models.AristaParameter, 0)
	t, _ := obj.(*AristaACL)
	aclTargets := t.aclTargets

	for _, target := range aclTargets {
		result = append(result, db_models.AristaParameter{
			ProtectionId:       protectionID,
			AclType:            target.ACLType(),
			AclFilteringRule:   target.ACLRule(),
		})
	}

	return result
}

type ProtectionType string

type Protection interface {
	//GetByMitigationId(mitigationId int) Protection

	Id() int64
	CustomerId() int
	TargetId() int64
	TargetType() string
	AclName() string
	SessionName() string
	SetSessionName(name string)
	Action() string
	SetAction(action string)
	IsEnabled() bool
	SetIsEnabled(b bool)
	Type() ProtectionType
	TargetBlocker() Blocker
	StartedAt() time.Time
	SetStartedAt(t time.Time)
	FinishedAt() time.Time
	SetFinishedAt(t time.Time)
	RecordTime() time.Time
	DroppedDataInfo() *ProtectionStatus
}

// Protection Base
type ProtectionBase struct {
	id                int64
	customerId        int
	targetId          int64
	targetType        string
	aclName           string
	sessionName       string
	action            string
	targetBlocker     Blocker
	isEnabled         bool
	startedAt         time.Time
	finishedAt        time.Time
	recordTime        time.Time
	droppedDataInfo   *ProtectionStatus
}

func (p ProtectionBase) Id() int64 {
	return p.id
}

func (p ProtectionBase) CustomerId() int {
	return p.customerId
}

func (p ProtectionBase) TargetId() int64 {
	return p.targetId
}

func (p ProtectionBase) TargetType() string {
	return p.targetType
}

func (p ProtectionBase) AclName() string {
	return p.aclName
}

func (p ProtectionBase) SessionName() string {
	return p.sessionName
}

func (p *ProtectionBase) SetSessionName(name string) {
	p.sessionName = name
}

func (p ProtectionBase) Action() string {
	return p.action
}

func (p *ProtectionBase) SetAction(action string) {
	p.action = action
}

func (p ProtectionBase) TargetBlocker() Blocker {
	return p.targetBlocker
}

func (p ProtectionBase) IsEnabled() bool {
	return p.isEnabled
}

func (p *ProtectionBase) SetIsEnabled(e bool) {
	p.isEnabled = e
}

func (p ProtectionBase) StartedAt() time.Time {
	return p.startedAt
}

func (p *ProtectionBase) SetStartedAt(t time.Time) {
	p.startedAt = t
}

func (p ProtectionBase) FinishedAt() time.Time {
	return p.finishedAt
}

func (p *ProtectionBase) SetFinishedAt(t time.Time) {
	p.finishedAt = t
}

func (p ProtectionBase) RecordTime() time.Time {
	return p.recordTime
}

func (p ProtectionBase) DroppedDataInfo() *ProtectionStatus {
	return p.droppedDataInfo
}

type ProtectionStatus struct {
	id                int64
	bytesDropped      int
	packetsDropped    int
	bpsDropped        int
	ppsDropped        int
}

func NewProtectionStatus(id int64, bytesDropped, packetsDropped, bpsDropped, ppsDropped int) *ProtectionStatus {
	return &ProtectionStatus{
		id, bytesDropped, packetsDropped, bpsDropped, ppsDropped,
	}
}

func (p *ProtectionStatus) Id() int64 {
	if p == nil {
		return 0
	} else {
		return p.id
	}
}

func (p *ProtectionStatus) SetId(id int64) {
	if p != nil {
		p.id = id
	}
}

func (p *ProtectionStatus) BytesDropped() int {
	if p == nil {
		return 0
	} else {
		return p.bytesDropped
	}
}

func (p *ProtectionStatus) PacketDropped() int {
	if p == nil {
		return 0
	} else {
		return p.packetsDropped
	}
}

func (p *ProtectionStatus) BpsDropped() int {
	if p == nil {
		return 0
	} else {
		return p.bpsDropped
	}
}

func (p *ProtectionStatus) PpsDropped() int {
	if p == nil {
		return 0
	} else {
		return p.ppsDropped
	}
}


text:
<?php

namespace Oro\Bundle\EntityExtendBundle\Tests\Unit\Migration;

use Oro\Bundle\EntityConfigBundle\Config\ConfigManager;
use Oro\Bundle\EntityExtendBundle\Configuration\EntityExtendConfigurationProvider;
use Oro\Bundle\EntityExtendBundle\Extend\FieldTypeHelper;
use Oro\Bundle\EntityExtendBundle\Migration\EntityMetadataHelper;
use Oro\Bundle\EntityExtendBundle\Migration\ExtendOptionsParser;

/**
 * Tests for ExtendOptionsParser and ExtendOptionsBuilder
 */
class ExtendOptionsParserTest extends \PHPUnit\Framework\TestCase
{
    /** @var \PHPUnit\Framework\MockObject\MockObject */
    protected $entityMetadataHelper;

    /** @var ExtendOptionsParser */
    protected $extendOptionsParser;

    protected function setUp()
    {
        $this->entityMetadataHelper = $this->createMock(EntityMetadataHelper::class);
        $this->entityMetadataHelper->expects($this->any())
            ->method('getEntityClassesByTableName')
            ->willReturnMap(
                [
                    ['table1', ['Test\Entity1']],
                    ['table2', ['Test\Entity2']],
                ]
            );
        $this->entityMetadataHelper->expects($this->any())
            ->method('isEntityClassContainsColumn')
            ->with('Test\Entity1', 'column1')
            ->willReturn(true);

        $configManager = $this->createMock(ConfigManager::class);
        $configManager->expects($this->any())
            ->method('hasConfig')
            ->will($this->returnValue(true));

        $entityExtendConfigurationProvider = $this->createMock(EntityExtendConfigurationProvider::class);
        $entityExtendConfigurationProvider->expects(self::any())
            ->method('getUnderlyingTypes')
            ->willReturn(['enum' => 'manyToOne', 'multiEnum' => 'manyToMany']);

        $this->extendOptionsParser = new ExtendOptionsParser(
            $this->entityMetadataHelper,
            new FieldTypeHelper($entityExtendConfigurationProvider),
            $configManager
        );
    }

    /**
     * @dataProvider parseOptionsProvider
     */
    public function testParseOptions($options, $expected)
    {
        $result = $this->extendOptionsParser->parseOptions($options);
        $this->assertEquals($expected, $result);
    }

    public function parseOptionsProvider()
    {
        return [
            [
                'options'  => [],
                'expected' => []
            ],
            [
                'options'  => [
                    'table1'         => [
                        '_mode'  => 'hidden',
                        'scope1' => [
                            'attr1' => 'value1',
                            'attr2' => [
                                'key21' => 'value21'
                            ]
                        ]
                    ],
                    'table1!column1' => [
                        '_mode'  => 'hidden',
                        'scope2' => [
                            'field_attr1' => 'field_value1',
                            'field_attr2' => [
                                'field_key21' => 'field_value21'
                            ]
                        ]
                    ],
                    '_append'        => [
                        'table1'         => [
                            'scope1' => [
                                'attr11' => 'value11'
                            ]
                        ],
                        'table1!column1' => [
                            'scope1' => [
                                'field_attr111' => 'field_value111'
                            ]
                        ]
                    ]
                ],
                'expected' => [
                    'Test\Entity1'    => [
                        'mode'    => 'hidden',
                        'configs' => [
                            'scope1' => [
                                'attr1' => 'value1',
                                'attr2' => [
                                    'key21' => 'value21'
                                ]
                            ]
                        ],
                        'fields'  => [
                            'column1' => [
                                'mode'    => 'hidden',
                                'configs' => [
                                    'scope2' => [
                                        'field_attr1' => 'field_value1',
                                        'field_attr2' => [
                                            'field_key21' => 'field_value21'
                                        ]
                                    ]
                                ]
                            ]
                        ]
                    ],
                    '_append_configs' => [
                        'Test\Entity1' => [
                            'configs' => [
                                'scope1' => [
                                    'attr11' => 'value11'
                                ]
                            ],
                            'fields'  => [
                                'column1' => [
                                    'scope1' => [
                                        'field_attr111' => 'field_value111'
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ];
    }
}


text:
Lava.define(
'Lava.widget.input.Select',
/**
 * Dropdown select
 * @lends Lava.widget.input.Select#
 * @extends Lava.widget.input.SelectAbstract#
 */
{

	Extends: 'Lava.widget.input.SelectAbstract',

	_property_descriptors: {
		value: {type: 'String', setter: '_setValue'}
	},

	_refreshValue: function() {

		var element = this._input_container.getDOMElement();
		// https://mootools.lighthouseapp.com/projects/2706/tickets/578-elementgetselected-behaves-differently-between-ffie-safari
		//noinspection BadExpressionStatementJS
		element.selectedIndex;
		this.set('value', element.value);

	},

	/**
	 * Setter for the <wp>value</wp> property
	 * @param {string} value
	 */
	_setValue: function(value) {

		var element;

		if (this._input_container) {
			element = this._input_container.getDOMElement();
			element.value = value;
			if (value != element.value) { // workaround for nonexistent values
				Lava.logError("[Select] nonexistent value assigned: " + value);
				value = element.value;
			}
		}

		this._set('value', value);

	},

	/**
	 * {modifier} This widget does not use live bindings of "selected" property, so this modifier is used to speed up rendering
	 * @param {string} value
	 * @returns {boolean}
	 */
	isValueSelected: function(value) {
		return value == this._properties.value;
	}

});


text:
#pragma once
#include "timer.hpp"

/**
* @class timer_cuda
* CUDA implementation of the Timer interface
*/
class timer_cuda : public timer< timer_cuda > // CRTP
{
  public:
    __host__ timer_cuda(std::string name) : timer< timer_cuda >(name) {
        // create the CUDA events
        cudaEventCreate(&start_);
        cudaEventCreate(&stop_);
    }
    __host__ ~timer_cuda() {
        // free the CUDA events
        cudaEventDestroy(start_);
        cudaEventDestroy(stop_);
    }

    /**
    * Reset counters
    */
    __host__ void reset_impl() {}

    /**
    * Start the stop watch
    */
    __host__ void start_impl() {
        // insert a start event
        cudaEventRecord(start_, 0);
    }

    /**
    * Pause the stop watch
    */
    __host__ double pause_impl() {
        // insert stop event and wait for it
        cudaEventRecord(stop_, 0);
        cudaEventSynchronize(stop_);

        // compute the timing
        float result;
        cudaEventElapsedTime(&result, start_, stop_);
        return static_cast< double >(result) * 0.001f; // convert ms to s
    }

  private:
    cudaEvent_t start_;
    cudaEvent_t stop_;
};


text:
import real from './real';

const api = () => real;

export default api;


text:
<?php

namespace backend\modules\member\models;

use Yii;
use common\models\User;
use yii\helpers\FileHelper;
use yii\imagine\Image;
use yii\helpers\Json;
use Imagine\Image\Box;
use Imagine\Image\Point;

/**
 * This is the model class for table "editor".
 *
 * @property integer $id
 * @property integer $user_id
 * @property string $name
 * @property string $lastname
 * @property string $avatar
 * @property string $date_register
 * @property string $website
 *
 * @property User $user
 */
class Editor extends \yii\db\ActiveRecord
{
    //public $avatar_img;
    public $image;
    public $crop_info;
    //public $reCaptcha;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'editors';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'name', 'lastname', 'avatar'], 'required'],

            [['user_id'], 'integer'],
            [['date_register'], 'safe'],
            [['website'], 'string'],
            [['name', 'lastname', 'avatar'], 'string', 'max' => 50],
            [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']],
            [ 'image',
              'image',
              'extensions' => ['jpg','png','gif'],
              'mimeTypes' => ['image/jpg','image/png', 'image/gif'],
            ],
            ['crop_info', 'safe'],

        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'รหัสผู้รวบรวม',
            'user_id' => 'User ID',
            'name' => 'ชื่อ',
            'lastname' => 'นามสกุล',
            'avatar' => 'รูปโปรไฟล์',
            'date_register' => 'วันที่สมัคร',
            'website' => 'เว็บไซต์',
            'image' => 'รูปโปรไฟล์',
        ];
    }

    public function afterSave($insert, $changedAttributes)
    {
        $model = new Editor();

        $file = \yii\web\UploadedFile::getInstance($model, 'image');
        $img = $file;
        if ($file != '') {
            $name_img = $file->name;
            $oldImages = $file->name;
            // open image
            $image = Image::getImagine()->open(Yii::getAlias('@webroot/uploads/avatar/'.$name_img));
            // rendering information about crop of ONE option
            $cropInfo = Json::decode($this->crop_info)[0];
            $cropInfo['dWidth'] = (int)$cropInfo['dWidth']; //new width image
            $cropInfo['dHeight'] = (int)$cropInfo['dHeight']; //new height image
            $cropInfo['x'] = $cropInfo['x']; //begin position of frame crop by X
            $cropInfo['y'] = $cropInfo['y']; //begin position of frame crop by Y
            // extension
            //$ext = $img->getExtension();
            //saving thumbnail
            $newSizeThumb = new Box($cropInfo['dWidth'], $cropInfo['dHeight']);
            $cropSizeThumb = new Box(200, 200); //frame size of crop
            $cropPointThumb = new Point($cropInfo['x'], $cropInfo['y']);
            $pathThumbImage = Yii::getAlias('@webroot/uploads/avatar')
                . '/thumb_'
                . $this->id
                . '.'
                . 'jpg';
                //$ext;
                //.$this->image->getExtension();

            $image->resize($newSizeThumb)
                ->crop($cropPointThumb, $cropSizeThumb)
                ->save($pathThumbImage, ['quality' => 100]);

            if ($oldImages != 0) {
              if ($oldImages == $name_img) {
                 unlink('uploads/avatar/'.$oldImages);
              }
            }

      }
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(User::className(), ['id' => 'user_id']);
    }
}


text:
#ifndef IMAGELAYER_H
#define IMAGELAYER_H

#include "tiled_global.h"

#include "layer.h"
#include "tileset.h"

#include <QColor>
#include <QPixmap>

class QImage;

namespace Tiled {

/**
 * An image on a map.
 */
class TILEDSHARED_EXPORT ImageLayer : public Layer
{
public:
    /**
     * Constructor.
     */
    ImageLayer(const QString &name, int x, int y, int width, int height);

    /**
     * Destructor.
     */
    ~ImageLayer();

    QSet<Tileset*> usedTilesets() const { return QSet<Tileset*>(); }
    bool referencesTileset(const Tileset *) const { return false; }
    void replaceReferencesToTileset(Tileset *, Tileset *) {}

    void offset(const QPoint &/*offset*/, const QRect &/*bounds*/,
                bool /*wrapX*/, bool /*wrapY*/)
    {}

    bool canMergeWith(Layer *) const { return false; }
    Layer *mergedWith(Layer *) const { return 0; }

    /**
     * Returns the transparent color, or an invalid color if no transparent
     * color is used.
     */
    QColor transparentColor() const { return mTransparentColor; }

    /**
     * Sets the transparent color. Pixels with this color will be masked out
     * when loadFromImage() is called.
     */
    void setTransparentColor(const QColor &c) { mTransparentColor = c; }

    /**
     *  Sets image source file name
     */
    void setSource(const QString source) { mImageSource = source; }

    /**
     * Returns the file name of the layer image.
     */
    const QString &imageSource() const { return mImageSource; }

    /**
      * Returns the image of this layer.
      */
    const QPixmap &image() const { return mImage; }

    /**
      * Sets the image of this layer.
      */
    void setImage(const QPixmap &image) { mImage = image; }

    /**
     * Resets layer image.
     */
    void resetImage();

    /**
     * Load this layer from the given \a image. This will replace
     * existing layer image.
     *
     * @param image    the image to load the layer from
     * @param fileName the file name of the image, which will be remembered
     *                 as the image source of this layer.
     * @return true if loading was successful, otherwise
     *         returns false
     */
    bool loadFromImage(const QImage &image, const QString &fileName);

    /**
     * Returns true if no image source has been set.
     */
    bool isEmpty() const;

    Layer *clone() const;

    virtual ImageLayer *asImageLayer() { return this; }

protected:
    ImageLayer *initializeClone(ImageLayer *clone) const;

private:
    QString mImageSource;
    QColor mTransparentColor;
    QPixmap mImage;
};

} // namespace Tiled

#endif // IMAGELAYER_H


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>phpDocumentor » symfony\propel</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">

phpDocumentor

                                    API Documentation

Packages

 ##PACKAGE##

 ##PROJECT

 Default

 Doctrine

 Swift

 System

 filters

 form

 guard

 lib

 lime

 mediaSCORE

 phing

 project

 propel

 sfDoctrineGuardPlugin

 sfDoctrinePlugin

 sfGuardForgotPasswordPlugin

 sfGuardPlugin

 sfPropelPlugin

 symfony

 symfony12

 test

                                    Charts

 Class hierarchy diagram

                                    Reports

 Errors
                11988

 Markers

todo
                91

fixme
                22

 Deprecated elements
                59

Back to top

                            Javascript is disabled; several features are only available
                            if Javascript is enabled.

<button class="btn details" title="Show descriptions and method names"></button><button class="btn simple" title="Show only method names"></button>

 Packages

propel

 Classes

sfMixer

sfPropelBehavior

sfPropelData

sfPropelDatabaseSchema

sfPropelManyToMany

sfPropelGenerator

sfPropelBaseTask

sfPropelBuildAllLoadTask

sfPropelBuildAllTask

sfPropelBuildFiltersTask

sfPropelBuildFormsTask

sfPropelBuildModelTask

sfPropelBuildSchemaTask

sfPropelBuildSqlTask

sfPropelDataDumpTask

sfPropelDataLoadTask

sfPropelGenerateAdminTask

sfPropelGenerateModuleForRouteTask

sfPropelGenerateModuleTask

sfPropelGraphvizTask

sfPropelInsertSqlTask

sfPropelSchemaToXmlTask

sfPropelSchemaToYmlTask

\
symfony

\propel

 Classes and interfaces

sfMixer¶

sfMixer implements mixins and hooks.

« More »

sfPropelBaseTask¶

Base class for all symfony Propel tasks.

« More »

sfPropelBehavior¶

Manages behaviors for propel.

« More »

sfPropelBuildAllLoadTask¶

Generates Propel model, SQL, initializes database, and load data.

« More »

sfPropelBuildAllTask¶

Generates Propel model, SQL and initializes the database.

« More »

sfPropelBuildFiltersTask¶

Create filter form classes for the current model.

« More »

sfPropelBuildFormsTask¶

Create form classes for the current model.

« More »

sfPropelBuildModelTask¶

Create classes for the current model.

« More »

sfPropelBuildSchemaTask¶

Creates a schema.xml from an existing database.

« More »

sfPropelBuildSqlTask¶

Create SQL for the current model.

« More »

sfPropelData¶

This class is the Propel implementation of sfData.

« More »

sfPropelDataDumpTask¶

Dumps data to the fixtures directory.

« More »

sfPropelDataLoadTask¶

Loads YAML fixture data.

« More »

sfPropelDatabaseSchema¶

Manages propel database schemas as YAML and XML.

« More »

sfPropelGenerateAdminTask¶

Generates a Propel admin module.

« More »

sfPropelGenerateModuleForRouteTask¶

Generates a Propel module for a route definition.

« More »

sfPropelGenerateModuleTask¶

Generates a Propel module.

« More »

sfPropelGenerator¶

Propel generator.

« More »

sfPropelGraphvizTask¶

Generates a graphviz chart of current object model.

« More »

sfPropelInsertSqlTask¶

Inserts SQL for current model.

« More »

sfPropelManyToMany¶

Utilities for managing many to many relationships in propel.

« More »

sfPropelSchemaToXmlTask¶

Creates schema.yml from schema.xml.

« More »

sfPropelSchemaToYmlTask¶

Creates schema.yml from schema.xml.

« More »

            Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.

            Documentation is powered by phpDocumentor 2.0.0a10 and

            generated on 2012-10-09T15:44:48+05:00.


text:
package org.kie.workbench.common.services.backend.compiler;

import java.io.IOException;
import java.net.URLClassLoader;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.drools.core.rule.KieModuleMetaInfo;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.kie.api.builder.KieModule;
import org.kie.scanner.KieModuleMetaData;
import org.kie.scanner.KieModuleMetaDataImpl;
import org.kie.workbench.common.services.backend.compiler.configuration.KieDecorator;
import org.kie.workbench.common.services.backend.compiler.configuration.MavenCLIArgs;
import org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest;
import org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo;
import org.kie.workbench.common.services.backend.compiler.impl.classloader.CompilerClassloaderUtils;
import org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse;
import org.kie.workbench.common.services.backend.compiler.impl.kie.KieMavenCompilerFactory;
import org.kie.workbench.common.services.backend.compiler.impl.utils.MavenUtils;
import org.kie.workbench.common.services.backend.compiler.utils.MavenUtilsTest;
import org.kie.workbench.common.services.backend.constants.ResourcesConstants;
import org.kie.workbench.common.services.backend.utils.LoadProjectDependencyUtil;
import org.kie.workbench.common.services.backend.utils.TestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.uberfire.java.nio.file.Files;
import org.uberfire.java.nio.file.Path;
import org.uberfire.java.nio.file.Paths;

import static org.assertj.core.api.Assertions.assertThat;

public class ClassLoaderProviderTest {

    private String mavenRepoPath;
    private Path tmpRoot;
    private Path tmp;
    private Path uberfireTmp;
    private final String MAVEN_MAIN_SKIP = "maven.main.skip";
    private Logger logger = LoggerFactory.getLogger(ClassLoaderProviderTest.class);

    @Rule
    public TestName testName = new TestName();

    @Before
    public void setUp() throws Exception {
        mavenRepoPath = TestUtilMaven.getMavenRepo();
    }

    @After
    public void clean() {
        System.clearProperty(MAVEN_MAIN_SKIP);
        if (tmpRoot != null) {
            TestUtil.rm(tmpRoot.toFile());
        }
    }

    private CompilationResponse compileProjectInRepo(String... mavenPhases) throws IOException {
        //we use NIO for this part of the test because Uberfire lack the implementation to copy a tree
        tmpRoot = Files.createTempDirectory("repo");
        tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.DUMMY_KIE_MULTIMODULE_CLASSLOADER_DIR);

        uberfireTmp = Paths.get(tmp.toAbsolutePath().toString());
        final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(new HashSet<>());
        WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(uberfireTmp);
        CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath,
                                                               info,
                                                               mavenPhases,
                                                               Boolean.FALSE);
        return compiler.compile(req);
    }

    @Test
    public void loadProjectClassloaderTest() throws Exception {
        CompilationResponse res = compileProjectInRepo(MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + TestUtilMaven.getSettingsFile());
        TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);
        assertThat(res.isSuccessful()).isTrue();

        List<String> pomList = MavenUtils.searchPoms(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_CLASSLOADER_DIR));
        Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(pomList,
                                                                                mavenRepoPath);
        assertThat(clazzLoader).isPresent();

        LoadProjectDependencyUtil.loadLoggerFactory(clazzLoader.get());
    }

    @Test
    public void loadProjectClassloaderFromStringTest() throws Exception {
        CompilationResponse res = compileProjectInRepo(MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + TestUtilMaven.getSettingsFile());
        TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);

        assertThat(res.isSuccessful()).isTrue();

        Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(uberfireTmp.toAbsolutePath().toString(),
                                                                                mavenRepoPath);
        assertThat(clazzLoader).isPresent();

        LoadProjectDependencyUtil.loadLoggerFactory(clazzLoader.get());
    }

    @Test
    public void loadTargetFolderClassloaderTest() throws Exception {
        CompilationResponse res = compileProjectInRepo(MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + TestUtilMaven.getSettingsFile());
        TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);
        assertThat(res.isSuccessful()).isTrue();

        List<String> pomList = MavenUtils.searchPoms(uberfireTmp);
        Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.getClassloaderFromProjectTargets(pomList);
        assertThat(clazzLoader).isPresent();

        LoadProjectDependencyUtil.loadDummyB(clazzLoader.get());
    }

    @Test
    public void getClassloaderFromAllDependenciesTestSimple() {
        Path path = Paths.get(".").resolve(ResourcesConstants.DUMMY_DEPS_SIMPLE_DIR);
        Optional<ClassLoader> classloaderOptional = CompilerClassloaderUtils.getClassloaderFromAllDependencies(path.toAbsolutePath().toString(),
                                                                                mavenRepoPath,
                                                                                TestUtilMaven.getSettingsFile());
        assertThat(classloaderOptional).isPresent();
        ClassLoader classloader = classloaderOptional.get();
        URLClassLoader urlsc = (URLClassLoader) classloader;
        assertThat(urlsc.getURLs()).hasSize(4);
    }

    @Test
    public void getClassloaderFromAllDependenciesTestComplex() {
        Path path = Paths.get(".").resolve(ResourcesConstants.DUMMY_DEPS_COMPLEX_DIR);
        Optional<ClassLoader> classloaderOptional = CompilerClassloaderUtils.getClassloaderFromAllDependencies(path.toAbsolutePath().toString(),
                                                                                mavenRepoPath,
                                                                                TestUtilMaven.getSettingsFile());
        assertThat(classloaderOptional).isPresent();
        ClassLoader classloader = classloaderOptional.get();
        URLClassLoader urlsc = (URLClassLoader) classloader;
        assertThat(urlsc.getURLs()).hasSize(7);
    }

    @Test
    public void getResourcesFromADroolsPRJ() throws Exception {
        /**
         * If the test fail check if the Drools core classes used, KieModuleMetaInfo and TypeMetaInfo implements Serializable
         * */
        String alternateSettingsAbsPath = TestUtilMaven.getSettingsFile();
        Path tmpRoot = Files.createTempDirectory("repo");
        Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES);

        final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.STORE_BUILD_CLASSPATH, KieDecorator.ENABLE_INCREMENTAL_BUILD ));
        WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri()));
        CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath,
                                                               info,
                                                               new String[]{MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath},
                                                               Boolean.FALSE);
        KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req);
        TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);

        if (!res.isSuccessful()) {
            List<String> msgs = res.getMavenOutput();
            for (String msg : msgs) {
                logger.info(msg);
            }
        }

        assertThat(res.isSuccessful()).isTrue();

        Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo();
        assertThat(metaDataOptional).isPresent();
        KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get();
        assertThat(kieModuleMetaInfo).isNotNull();

        Optional<KieModule> kieModuleOptional = res.getKieModule();
        assertThat(kieModuleOptional).isPresent();
        KieModule kModule = kieModuleOptional.get();

        assertThat(res.getDependenciesAsURI()).hasSize(4);

        KieModuleMetaData kieModuleMetaData = new KieModuleMetaDataImpl((InternalKieModule) kModule,
                                                                        res.getDependenciesAsURI());

        assertThat(kieModuleMetaData).isNotNull();

        List<String> resources = CompilerClassloaderUtils.getStringFromTargets(tmpRoot);
        assertThat(resources).hasSize(3);
    }

    @Test
    public void getResourcesFromADroolsPRJWithError() throws Exception {
        /**
         * If the test fail check if the Drools core classes used, KieModuleMetaInfo and TypeMetaInfo implements Serializable
         * */
        Path tmpRoot = Files.createTempDirectory("repo");
        Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES_WITH_ERROR);

        AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.ENABLE_INCREMENTAL_BUILD));
        WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri()));
        CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath,
                                                               info,
                                                               new String[]{MavenCLIArgs.INSTALL, MavenCLIArgs.ALTERNATE_USER_SETTINGS + TestUtilMaven.getSettingsFile()},
                                                               Boolean.FALSE);
        KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req);
        TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);
        if (!res.isSuccessful()) {
            List<String> msgs = res.getMavenOutput();
            for (String msg : msgs) {
                logger.info(msg);
            }
        }

        assertThat(res.isSuccessful()).isTrue();

        Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo();
        assertThat(metaDataOptional).isPresent();
        KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get();
        assertThat(kieModuleMetaInfo).isNotNull();

        Optional<KieModule> kieModuleOptional = res.getKieModule();
        assertThat(kieModuleOptional).isPresent();
        List<String> classloaderOptional = CompilerClassloaderUtils.getStringFromTargets(tmpRoot);
        assertThat(classloaderOptional).hasSize(3);
    }

    @Test
    public void getResourcesFromADroolsPRJWithErrorWithMavenSkip() throws Exception {
        System.setProperty(MAVEN_MAIN_SKIP, Boolean.TRUE.toString());
        /**
         * If the test fail check if the Drools core classes used, KieModuleMetaInfo and TypeMetaInfo implements Serializable
         * */
        Path tmpRoot = Files.createTempDirectory("repo");
        Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES_WITH_ERROR);

        final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.ENABLE_INCREMENTAL_BUILD));
        WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri()));
        CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath,
                                                               info,
                                                               new String[]{MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + TestUtilMaven.getSettingsFile()},
                                                               Boolean.FALSE);
        KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req);
        TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);
        if (!res.isSuccessful()) {
            List<String> msgs = res.getMavenOutput();
            for (String msg : msgs) {
                logger.info(msg);
            }
        }

        assertThat(res.isSuccessful()).isTrue();

        Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo();
        assertThat(metaDataOptional).isPresent();
        KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get();
        assertThat(kieModuleMetaInfo).isNotNull();

        Optional<KieModule> kieModuleOptional = res.getKieModule();
        assertThat(kieModuleOptional).isPresent();
        List<String> classloaderOptional = CompilerClassloaderUtils.getStringFromTargets(tmpRoot);
        assertThat(classloaderOptional).hasSize(3);
    }
}


text:
namespace valijson {
namespace utils {

inline bool loadDocument(const std::string &path, nlohmann::json &document)
{
    // Load schema JSON from file
    std::string file;
    if (!loadFile(path, file)) {
        std::cerr << "Failed to load json from file '" << path << "'."
                  << std::endl;
        return false;
    }

    // Parse schema
#if VALIJSON_USE_EXCEPTIONS
    try {
        document = nlohmann::json::parse(file);
    } catch (std::invalid_argument const& exception) {
        std::cerr << "nlohmann::json failed to parse the document\n"
            << "Parse error:" << exception.what() << "\n";
        return false;
    }
#else
    document = nlohmann::json::parse(file, nullptr, false);
    if (document.is_discarded()) {
        std::cerr << "nlohmann::json failed to parse the document.";
        return false;
    }
#endif

    return true;
}

}  // namespace utils
}  // namespace valijson


text:
package leap.lang.el.spel;

import leap.lang.New;
import leap.lang.accessor.Getter;
import leap.lang.expression.ExpressionException;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class SpelExpressionTest extends SpelTestCase {

	@Test
	public void testCompositeExpression(){
		assertEquals("a",SPEL.createCompositeExpression("a").getValue());
		assertEquals("a1",SPEL.createCompositeExpression("a${v}").getValue(New.<String,Object>hashMap("v","1")));
		assertEquals("a${1",SPEL.createCompositeExpression("a\\${${v}").getValue(New.<String,Object>hashMap("v","1")));
		assertEquals("1",SPEL.createCompositeExpression("${v}").getValue(New.<String,Object>hashMap("v","1")));
		assertEquals("a1b1",SPEL.createCompositeExpression("a${v}b${v}").getValue(New.<String,Object>hashMap("v","1")));
		assertEquals("a1b11",SPEL.createCompositeExpression("a${v}b${v}1").getValue(New.<String,Object>hashMap("v","1")));
		assertEquals("1/edit",SPEL.createCompositeExpression("${id}/edit").getValue(New.<String,Object>hashMap("id","1")));
		try {
	        SPEL.createCompositeExpression("a${v}b${v}${xx");
	        fail("Should throw exception");
        } catch (ExpressionException e) {

        }
	}

	@Test
	public void testArrayItem() {
		int[] a = new int[]{1,2,3,4,5};

		Map<String, Object> m = new HashMap<>();
		m.put("a", a);
		m.put("s", "str");

		Map<String, Object> vars = new HashMap<>();
		vars.put("a", a);
		vars.put("m", m);
		vars.put("index", 0);
		vars.put("p", "s");

		assertEquals(1, eval("a[0]",vars));
		assertEquals(1, eval("a[index]",vars));
		assertEquals(2, eval("a[index + 1]",vars));
		assertEquals(1, eval("m['a'][0]",vars));
		assertEquals("str", eval("m['s']",vars));
		assertEquals("str", eval("m[p]",vars));
	}

    @Test
    public void testProperty() {
		//map
        Map<String,Object> m = New.hashMap("a","b");
        assertEquals("b", eval("['a']", m));

        //getter
		Getter getter = new Getter() {
			@Override
			public Object get(String name) {
				return m.get(name);
			}
		};
		Map<String, Object> vars = New.hashMap("o", getter);
		assertEquals("b", eval("o['a']", vars));
    }

	@Test
	public void testStaticField() {
		assertEquals(Boolean.TRUE,eval("T(java.lang.Boolean).TRUE"));
		assertEquals(Boolean.TRUE,eval("T(Boolean).TRUE"));
		assertEquals(Boolean.TRUE,eval("T(Strings).isEmpty('')"));
	}

	@Test
	public void testVariableSpecialCharacters() {
		eval("$name");
		eval("_name");
	}

	@Test
	public void testSpecialOperator() {
        String s = "a";

        Map<String, Object> vars = new HashMap<>();
        vars.put("s", s);

        assertEquals(Boolean.TRUE, SPEL.createExpression("s.contains('a')").getValue(vars));
        assertEquals(Boolean.TRUE, SPEL.createExpression("s.startsWith('a')").getValue(vars));
        assertEquals(Boolean.TRUE, SPEL.createExpression("s.endsWith('a')").getValue(vars));
    }

}


text:
package org.atdl4j.ui.swing.widget;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.atdl4j.ui.impl.ControlHelper;
import org.atdl4j.ui.swing.SwingListener;

public class SwingTextFieldWidget
        extends AbstractSwingWidget<String> {

    private JFormattedTextField textField;
    private JLabel label;
    private JPanel wrapper;

    public void createWidget(JPanel parent) {
        // tooltip
        String tooltip = control.getTooltip();

        // label
        if (control.getLabel() != null) {
            label = new JLabel();
            label.setName(getName() + "/label");
            label.setText(control.getLabel());
            if (tooltip != null) {
                label.setToolTipText(tooltip);
            }
        }

        // textField
        textField = new JFormattedTextField();
        textField.setName(getName() + "/text");

        // init value
        if (ControlHelper.getInitValue(control, getAtdl4jOptions()) != null) {
            textField.setText((String) ControlHelper.getInitValue(control, getAtdl4jOptions()));
        }

        // tooltip
        if (tooltip != null) {
            textField.setToolTipText(tooltip);
        }

        if (label != null) {
            wrapper = new JPanel(new GridBagLayout());
            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;
            c.gridx = 0;
            c.gridy = 0;
            c.gridwidth = 1;
            c.weightx = 1.0;
            c.weighty = 1.0;
            c.insets = new Insets(0, 0, 0, 0);
            wrapper.add(label, c);
            c.gridx = 1;
            c.gridy = 0;
            c.insets = new Insets(0, 0, 0, 0);
            wrapper.add(textField, c);
            parent.add(wrapper);
        } else {
            parent.add(textField);
        }

        textField.setPreferredSize(new Dimension(100, textField.getPreferredSize().height));
        textField.revalidate();
    }

    public void setVisible(boolean visible) {
        if (wrapper != null) {
            wrapper.setVisible(visible);
        } else {
            super.setVisible(visible);
        }
    }

    public String getControlValueRaw() {
        String value = textField.getText();

        if ("".equals(value)) {
            return null;
        } else {
            return value;
        }
    }

    public void setValue(String value) {
        textField.setText((value == null) ? "" : value.toString());
    }

    public List<Component> getComponents() {
        List<Component> widgets = new ArrayList<Component>();
        if (label != null) {
            widgets.add(label);
        }
        widgets.add(textField);
        return widgets;
    }

    public List<Component> getComponentsExcludingLabel() {
        List<Component> widgets = new ArrayList<Component>();
        widgets.add(textField);
        return widgets;
    }

    public void addListener(SwingListener listener) {
        textField.getDocument().addDocumentListener(listener);
    }

    public void removeListener(SwingListener listener) {
        textField.getDocument().removeDocumentListener(listener);
    }

    /**
     * Overridden -- makes the textField appear non-editable vs. the default of
     * disabled.
     */
    public void processConstValueHasBeenSet() {
        textField.setEditable(false);
    }

    /*
     *
     */
    protected void processNullValueIndicatorChange(Boolean aOldNullValueInd, Boolean aNewNullValueInd) {
        if (Boolean.FALSE.equals(aNewNullValueInd)) {
            textField.setText("");
        }
    }

    /* (non-Javadoc)
     * @see org.atdl4j.ui.ControlUI#reinit()
     */
    @Override
    public void processReinit(Object aControlInitValue) {
        if ((textField != null)) {
            textField.setText((aControlInitValue != null) ? (String) aControlInitValue : "");
        }
    }

    @Override
    public List< ? extends Component> createBrickComponents() {

        List<Component> components = new ArrayList<Component>();

        // tooltip
        String tooltip = control.getTooltip();

        // label
        if (control.getLabel() != null) {
            label = new JLabel();
            label.setName(getName() + "/label");
            label.setText(control.getLabel());
            if (tooltip != null) {
                label.setToolTipText(tooltip);
            }
        }

        // textField
        textField = new JFormattedTextField();
        textField.setName(getName() + "/text");

        // init value
        if (ControlHelper.getInitValue(control, getAtdl4jOptions()) != null) {
            textField.setText((String) ControlHelper.getInitValue(control, getAtdl4jOptions()));
        }

        // tooltip
        if (tooltip != null) {
            textField.setToolTipText(tooltip);
        }

        if (label != null) {
            components.add(label);
        }
        components.add(textField);

        textField.setPreferredSize(new Dimension(100, textField.getPreferredSize().height));

        return components;
    }
}


text:
<?php

use ErpNET\App\Repositories\BaseMigration;
use Illuminate\Database\Schema\Blueprint;

class CreatePartnerGroupsTable extends BaseMigration {

	protected $table = 'partner_groups';

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function upMigration()
	{
		$this->createTable(function(Blueprint $table)
		{
			$table->increments('id');
			$table->timestamps();
            $table->softDeletes();

            $table->string('mandante')->index();

            $table->string('grupo');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function downMigration()
	{
		$this->dropTable();
	}

}