composer.phar 1.7 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. ØŽ��â������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phppa��£ qXpa��oÔ/ɶ������+���src/Composer/Autoload/ClassMapGenerator.php•��£ qX•��î$»'¶���������src/Composer/Cache.php÷��£ qX÷��;�¿à¶������%���src/Composer/Command/AboutCommand.phpÀ��£ qXÀ��ÄiWR¶������'���src/Composer/Command/ArchiveCommand.php ��£ qX ��ò±Ü›¶������$���src/Composer/Command/BaseCommand.phpÉ ��£ qXÉ ��—P!£¶������.���src/Composer/Command/BaseDependencyCommand.phpÉ��£ qXÉ��D{²Ð¶������*���src/Composer/Command/ClearCacheCommand.php^��£ qX^��ƒ÷�¶������&���src/Composer/Command/ConfigCommand.php¨G��£ qX¨G��`Ø/¶������-���src/Composer/Command/CreateProjectCommand.phpz4��£ qXz4��àŠÃ¶������'���src/Composer/Command/DependsCommand.php¶��£ qX¶��á0¶������(���src/Composer/Command/DiagnoseCommand.phpÌF��£ qXÌF��æ£Ò¶������,���src/Composer/Command/DumpAutoloadCommand.phpœ ��£ qXœ ��VÔˆæ¶������$���src/Composer/Command/ExecCommand.phpf��£ qXf��¹/|¶������&���src/Composer/Command/GlobalCommand.phpü��£ qXü��ÝH�\¶������$���src/Composer/Command/HomeCommand.php��£ qX��c¼±¶������$���src/Composer/Command/InitCommand.php5=��£ qX5=��À“,'¶������'���src/Composer/Command/InstallCommand.phpý��£ qXý��0ö:‰¶������(���src/Composer/Command/LicensesCommand.php$��£ qX$��²Jïë¶������(���src/Composer/Command/OutdatedCommand.phpÚ ��£ qXÚ ��LOÔù¶������)���src/Composer/Command/ProhibitsCommand.phpÊ��£ qXÊ��—ÕÓ€¶������&���src/Composer/Command/RemoveCommand.phpæ��£ qXæ��êðõ϶������'���src/Composer/Command/RequireCommand.phpé��£ qXé��énÞ–¶������)���src/Composer/Command/RunScriptCommand.phpŸ ��£ qXŸ ��ÎÀñ˶������+���src/Composer/Command/ScriptAliasCommand.php��£ qX��®%þ›¶������&���src/Composer/Command/SearchCommand.phpà��£ qXà��à2ó^¶������*���src/Composer/Command/SelfUpdateCommand.php60��£ qX60��<Í3¶������$���src/Composer/Command/ShowCommand.php&Z��£ qX&Z��>ë<b¶������&���src/Composer/Command/StatusCommand.php,��£ qX,��1–ql¶������(���src/Composer/Command/SuggestsCommand.php§ ��£ qX§ ��Ìxî]¶������&���src/Composer/Command/UpdateCommand.php["��£ qX["��IyYì¶������(���src/Composer/Command/ValidateCommand.php��£ qX��tN¹¶���������src/Composer/Composer.phpÿ��£ qXÿ��L%†›¶���������src/Composer/Config.php�"��£ qX�"��wqX¤¶������-���src/Composer/Config/ConfigSourceInterface.php��£ qX��³ [/¶������(���src/Composer/Config/JsonConfigSource.phpÅ��£ qXÅ��cnåR¶������$���src/Composer/Console/Application.phpG0��£ qXG0�� Â­Ô¶������,���src/Composer/Console/HtmlOutputFormatter.php3��£ qX3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��£ qXQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��£ qX��õÝv¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��£ qXC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��£ qX÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��£ qXý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���£ qXÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��£ qX¹��&¢e
  25. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��£ qXI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��£ qXh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��£ qX­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php°"��£ qX°"�� Ž%¶������+���src/Composer/DependencyResolver/Problem.php™��£ qX™��´‡Ä¶������+���src/Composer/DependencyResolver/Request.phpƒ��£ qXƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php��£ qX��Ê%û¶������+���src/Composer/DependencyResolver/RuleSet.php¶ ��£ qX¶ ��´Eÿ|¶������4���src/Composer/DependencyResolver/RuleSetGenerator.php4��£ qX4��G{#·¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��£ qX��}õÇù¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��£ qXi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpÜ��£ qXÜ��‰8¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpç��£ qXç��—Þȶ������*���src/Composer/DependencyResolver/Solver.phpn8��£ qXn8��í¡’R¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��£ qX˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.php¤��£ qX¤��Ä~¶������/���src/Composer/DependencyResolver/Transaction.phpó��£ qXó��óö«¶������-���src/Composer/Downloader/ArchiveDownloader.phpå��£ qXå��ƒdø¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���£ qXÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.phpG��£ qXG��Š(í»¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��£ qXÊ��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���£ qXÑ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpn��£ qXn��$!óî¶������/���src/Composer/Downloader/FilesystemException.php
  26. ��£ qX
  27. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.phpa ��£ qXa ��7,žI¶������)���src/Composer/Downloader/GitDownloader.phpš3��£ qXš3��/-¡¿¶������*���src/Composer/Downloader/GzipDownloader.phpó��£ qXó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php9 ��£ qX9 ��{]Öñ¶������*���src/Composer/Downloader/PathDownloader.php?��£ qX?��ðÔ¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��£ qXu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.phpÄ��£ qXÄ��ÐGÉŸ¶������*���src/Composer/Downloader/PharDownloader.phpå���£ qXå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��£ qXž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��£ qXG��†íV–¶������)���src/Composer/Downloader/TarDownloader.phpã���£ qXã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��£ qX=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÕ���£ qXÕ���RFἶ������)���src/Composer/Downloader/VcsDownloader.php��£ qX��ƺ¶������(���src/Composer/Downloader/XzDownloader.php§��£ qX§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpù ��£ qXù ��>Å¡¶������&���src/Composer/EventDispatcher/Event.php ��£ qX ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpò.��£ qXò.��ÆŸÊ�¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���£ qX©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���£ qXv���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���£ qXf���ËíM�¶���������src/Composer/Factory.php¦<��£ qX¦<��i‡@˶���������src/Composer/IO/BaseIO.phpŒ��£ qXŒ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��£ qX*��¢®hT¶���������src/Composer/IO/ConsoleIO.php@��£ qX@��¤ñâ¶���������src/Composer/IO/IOInterface.phpì��£ qXì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��£ qXÀ��F`sʶ���������src/Composer/Installer.php¸—��£ qX¸—��xsLɶ������*���src/Composer/Installer/BinaryInstaller.php��£ qX��³ *¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���£ qXË���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��£ qX-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��£ qX��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���£ qXÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��£ qXã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php^��£ qX^��Ír¶������/���src/Composer/Installer/MetapackageInstaller.phpœ��£ qXœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��£ qX+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��£ qXe��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��£ qX¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpâ ��£ qXâ ��;øiU¶������(���src/Composer/Installer/PearInstaller.php¢��£ qX¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.phpŸ��£ qXŸ��<tú,¶������+���src/Composer/Installer/ProjectInstaller.php��£ qX��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.phpª��£ qXª��àGö���������src/Composer/Json/JsonFile.php°��£ qX°���°žc¶������#���src/Composer/Json/JsonFormatter.php��£ qX��Ðqu¶������%���src/Composer/Json/JsonManipulator.phpþ0��£ qXþ0���kÌc¶������-���src/Composer/Json/JsonValidationException.php\��£ qX\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��£ qX��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php��£ qX��jø¾å¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.php���£ qX���MŸ2¶������0���src/Composer/Package/Archiver/ArchiveManager.php‡ ��£ qX‡ ��ñd¶������3���src/Composer/Package/Archiver/ArchiverInterface.phpï���£ qXï���<ʸ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��£ qX–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��£ qX��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpq��£ qXq��5¾i&¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php��£ qX��~”¸¶������.���src/Composer/Package/Archiver/PharArchiver.php��£ qX��£´£¶������-���src/Composer/Package/Archiver/ZipArchiver.php”��£ qX”��*K *¶������$���src/Composer/Package/BasePackage.php& ��£ qX& ��'ݶ������(���src/Composer/Package/CompletePackage.phpÿ��£ qXÿ��o+ã ¶������1���src/Composer/Package/CompletePackageInterface.phpõ��£ qXõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpë ��£ qXë ��Ó8WE¶���������src/Composer/Package/Link.phpˆ��£ qXˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��£ qX‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��£ qXd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��£ qX‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��£ qXi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��£ qXX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.php¸��£ qX¸��6 ¤¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��£ qXE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��£ qXù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���£ qX²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php½��£ qX½��I¢�i¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.php½1��£ qX½1��ÅnÚѶ���������src/Composer/Package/Locker.phpª!��£ qXª!���7e¾¶������ ���src/Composer/Package/Package.phpÉ��£ qXÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��£ qX ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��£ qX �� _€ø¶������$���src/Composer/Package/RootPackage.php��£ qX��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��£ qX¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpÍ��£ qXÍ��2¿Ï¿¶������.���src/Composer/Package/Version/VersionParser.phpø��£ qXø��¾3l¶������0���src/Composer/Package/Version/VersionSelector.phpK ��£ qXK ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���£ qXW���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���£ qX—���ûOâ>¶���������src/Composer/Plugin/Capable.php���£ qX���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��£ qXâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpÂ���£ qXÂ���^Íþ¶������'���src/Composer/Plugin/PluginInterface.phpô���£ qXô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��£ qX$��ëŽ"»¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��£ qX`���9-ζ������+���src/Composer/Repository/ArrayRepository.php��£ qX��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php» ��£ qX» ��ˆÝ÷<¶������*���src/Composer/Repository/BaseRepository.php_ ��£ qX_ ��–û߶������.���src/Composer/Repository/ComposerRepository.phpÛR��£ qXÛR��î%SÓ¶������/���src/Composer/Repository/CompositeRepository.php;��£ qX;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���£ qX…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php×��£ qX×��Iœª¶������4���src/Composer/Repository/InstalledArrayRepository.php£���£ qX£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���£ qX£���V
  28. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���£ qX‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���£ qXn���à“똶������-���src/Composer/Repository/PackageRepository.phpj��£ qXj��¥ôò̶������*���src/Composer/Repository/PathRepository.phpY ��£ qXY ��(—¾3¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��£ qXI��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��£ qXÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��£ qXí��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.phpÁ ��£ qXÁ ��O€ë¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��£ qX& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��£ qXq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��£ qXq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php%��£ qX%��j?“¶������,���src/Composer/Repository/Pear/PackageInfo.php°��£ qX°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��£ qX’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��£ qXª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php��£ qX��_Mì¶������-���src/Composer/Repository/RepositoryFactory.phpM��£ qXM��^ Æä¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��£ qXÛ��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php,
  29. ��£ qX,
  30. ��¾…\•¶������7���src/Composer/Repository/RepositorySecurityException.phpo���£ qXo���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpÍ��£ qXÍ��ÐfZ’¶������,���src/Composer/Repository/Vcs/FossilDriver.php;��£ qX;��#Ô�¶¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpV ��£ qXV ��ÔEœî¶������)���src/Composer/Repository/Vcs/GitDriver.phpó��£ qXó��±~ýâ¶������,���src/Composer/Repository/Vcs/GitHubDriver.phpy+��£ qXy+��´ZÓ™¶������,���src/Composer/Repository/Vcs/GitLabDriver.php ��£ qX ��ÂYȶ������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä
  31. ��£ qXä
  32. ��À0ñ“¶������(���src/Composer/Repository/Vcs/HgDriver.phpÀ��£ qXÀ��Ê­ç÷¶������.���src/Composer/Repository/Vcs/PerforceDriver.phpO ��£ qXO ��_eÉí¶������)���src/Composer/Repository/Vcs/SvnDriver.php¨��£ qX¨��›ƒ-¸¶������)���src/Composer/Repository/Vcs/VcsDriver.php„
  33. ��£ qX„
  34. ��­Ã¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��£ qX÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.php´��£ qX´��ªÖG¶������3���src/Composer/Repository/WritableArrayRepository.php��£ qX��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��£ qX‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���£ qXW���£VZt¶���������src/Composer/Script/Event.phpµ��£ qXµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���£ qXœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��£ qXP��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���£ qX��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��£ qXì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��£ qXË��>zx–¶���������src/Composer/Util/Bitbucket.phpµ��£ qXµ��Z±%N¶������$���src/Composer/Util/ComposerMirror.php±��£ qX±��­½øض������%���src/Composer/Util/ConfigValidator.php&��£ qX&��î:äü¶������"���src/Composer/Util/ErrorHandler.php‡��£ qX‡��He"¶������ ���src/Composer/Util/Filesystem.phps.��£ qXs.��›Í®à¶���������src/Composer/Util/Git.phpS$��£ qXS$��õ"þ ¶���������src/Composer/Util/GitHub.php¯
  35. ��£ qX¯
  36. ��àÏ ¶���������src/Composer/Util/GitLab.phpt ��£ qXt ��o2˜¶���������src/Composer/Util/IniHelper.php���£ qX���Çþ‚{¶������$���src/Composer/Util/NoProxyPattern.php¾��£ qX¾��Z+°m¶���������src/Composer/Util/Perforce.php2��£ qX2��IŽz¶���������src/Composer/Util/Platform.phpø��£ qXø��V¨È‚¶������%���src/Composer/Util/ProcessExecutor.php ��£ qX ��ˆ)sw¶������&���src/Composer/Util/RemoteFilesystem.phpé`��£ qXé`��xµCï¶���������src/Composer/Util/Silencer.phpñ��£ qXñ��mvý¶������!���src/Composer/Util/SpdxLicense.php��£ qX��¾7
  37. ñ¶������*���src/Composer/Util/StreamContextFactory.phpw��£ qXw��Ó;Ѷ���������src/Composer/Util/Svn.php¾��£ qX¾��Ík“ܶ���������src/Composer/Util/TlsHelper.phpš
  38. ��£ qXš
  39. ��û±‘ø¶���������src/Composer/XdebugHandler.php­��£ qX­��ƒRB€¶���������src/bootstrap.php¹��£ qX¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.phpÀ3��£ qXÀ3��y‹~ƶ������#���res/composer-repository-schema.jsonð��£ qXð���GÐà¶���������res/composer-schema.jsonÁk��£ qXÁk��ª†öÓ¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.jsoní��£ qXí��ÆÅz±¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.json e��£ qX e��ùe!‰¶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��£ qX�$��•�¥v¶������&���vendor/symfony/console/Application.phpW��£ qXW��rà :¶������*���vendor/symfony/console/Command/Command.php¯!��£ qX¯!��Z°Ñ2¶������.���vendor/symfony/console/Command/HelpCommand.phpÝ��£ qXÝ��.Ø™u¶������.���vendor/symfony/console/Command/ListCommand.phpZ��£ qXZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpï���£ qXï��� ÕH¸¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpß��£ qXß��µŒ°7¶������0���vendor/symfony/console/Descriptor/Descriptor.php���£ qX���;~Ķ������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���£ qXü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpš ��£ qXš ��l¬¶������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php|��£ qX|�� ‚Qš¶������4���vendor/symfony/console/Descriptor/TextDescriptor.phpá��£ qXá��ËhœÐ¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��£ qX��‹P$¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php²��£ qX²��Zk‰2¶������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��£ qXÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��£ qX��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��£ qXz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��£ qXÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���£ qXf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���£ qX¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���£ qX¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���£ qX’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���£ qX–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php° ��£ qX° ��æ�q@¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŠ��£ qXŠ��:߶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpL��£ qXL��Š�8<¶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php†��£ qX†��ÝRÚ­¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpL��£ qXL��.=b¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��£ qXx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpz��£ qXz��fÉÚý¶������.���vendor/symfony/console/Helper/DialogHelper.phpú��£ qXú��hX�ö������1���vendor/symfony/console/Helper/FormatterHelper.phpc��£ qXc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php��£ qX��‡Â<£¶������1���vendor/symfony/console/Helper/HelperInterface.phpç���£ qXç��� Çã¶������+���vendor/symfony/console/Helper/HelperSet.phpÐ��£ qXÐ��aˆ~ ¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��£ qXc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��£ qXÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.phps%��£ qXs%��鯦�¶������0���vendor/symfony/console/Helper/ProgressHelper.php\��£ qX\��?‹á¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpK��£ qXK��íÍ°¶������0���vendor/symfony/console/Helper/QuestionHelper.php���£ qX���Ôb£¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php[
  40. ��£ qX[
  41. ��gôB5¶������'���vendor/symfony/console/Helper/Table.php¤)��£ qX¤)��`fRƒ¶������+���vendor/symfony/console/Helper/TableCell.php:��£ qX:��7®�¶������-���vendor/symfony/console/Helper/TableHelper.php ��£ qX ��¦pm‡¶������0���vendor/symfony/console/Helper/TableSeparator.phpÍ���£ qXÍ���Qßa²¶������,���vendor/symfony/console/Helper/TableStyle.php
  42. ��£ qX
  43. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.php��£ qX��¯Üœ¶������+���vendor/symfony/console/Input/ArrayInput.php_
  44. ��£ qX_
  45. ��[µðɶ������&���vendor/symfony/console/Input/Input.phpª ��£ qXª ��¶¶������.���vendor/symfony/console/Input/InputArgument.php��£ qX��ÁÜ�¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���£ qXš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.php–��£ qX–��0Oly¶������/���vendor/symfony/console/Input/InputInterface.phpŸ��£ qXŸ��¥R6Û¶������,���vendor/symfony/console/Input/InputOption.php ��£ qX ��‡¹§¶������,���vendor/symfony/console/Input/StringInput.php˜��£ qX˜�� Ú¤¶���������vendor/symfony/console/LICENSE)��£ qX)��¹ô¶������/���vendor/symfony/console/Logger/ConsoleLogger.php< ��£ qX< ��:âÇl¶������0���vendor/symfony/console/Output/BufferedOutput.php_��£ qX_��ûBÍ·¶������/���vendor/symfony/console/Output/ConsoleOutput.phpµ��£ qXµ��
  46. ¢S\¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpå���£ qXå���rNô�¶������,���vendor/symfony/console/Output/NullOutput.phpÏ��£ qXÏ��®˜‹Z¶������(���vendor/symfony/console/Output/Output.phpš ��£ qXš ��01 ý¶������1���vendor/symfony/console/Output/OutputInterface.php��£ qX��ÓÚ>¶������.���vendor/symfony/console/Output/StreamOutput.phpÄ��£ qXÄ��õ핶������2���vendor/symfony/console/Question/ChoiceQuestion.php"
  47. ��£ qX"
  48. ��_౶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpé��£ qXé��ƒQ@¶������,���vendor/symfony/console/Question/Question.php#
  49. ��£ qX#
  50. ��e¯ ¶������ ���vendor/symfony/console/Shell.phpé��£ qXé��½fü‘¶������,���vendor/symfony/console/Style/OutputStyle.php_��£ qX_��ûµ¶������/���vendor/symfony/console/Style/StyleInterface.phpÔ��£ qXÔ�� ßÊj¶������-���vendor/symfony/console/Style/SymfonyStyle.phph��£ qXh��ŠGѶ������3���vendor/symfony/console/Tester/ApplicationTester.phpÔ��£ qXÔ��¬ì¤d¶������/���vendor/symfony/console/Tester/CommandTester.php®��£ qX®��EÙš|¶������(���vendor/symfony/debug/BufferingLogger.phpt��£ qXt��=�hܶ���������vendor/symfony/debug/Debug.phpé��£ qXé��Àxa?¶������)���vendor/symfony/debug/DebugClassLoader.phpå��£ qXå��¦ù3\¶������%���vendor/symfony/debug/ErrorHandler.php”A��£ qX”A��¿Á½¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php„��£ qX„��n�¡…¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��£ qX˜��-
  51. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��£ qX��-"ûd¶������6���vendor/symfony/debug/Exception/FatalErrorException.phpï��£ qXï��æ fz¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpD��£ qXD��¡ Âí¶������3���vendor/symfony/debug/Exception/FlattenException.php²��£ qX²��HòѶ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���£ qX~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpˆ��£ qXˆ��¢G‚n¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php†��£ qX†��¨LÚ:¶������)���vendor/symfony/debug/ExceptionHandler.php
  52. 3��£ qX
  53. 3��¹¨È£¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php5��£ qX5��ž Lô¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��£ qX��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpu��£ qXu��éj¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpÌ��£ qXÌ��ì�β¶���������vendor/symfony/debug/LICENSE)��£ qX)��¹ô¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���£ qXi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��£ qX¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��£ qX‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���£ qX¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.php×.��£ qX×.��G`f›¶������!���vendor/symfony/filesystem/LICENSE)��£ qX)��¹ô¶������)���vendor/symfony/filesystem/LockHandler.phpŽ��£ qXŽ��ü Å¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��£ qX\ ��Æ“É€¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php‘��£ qX‘��ao¦È¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php±��£ qX±��ä»Ê&¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��£ qX2��Q/ÇC¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��£ qX�� ¡¾¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��£ qXô��:?¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��£ qXŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php%��£ qX%��L¿EǶ������5���vendor/symfony/finder/Comparator/NumberComparator.php~��£ qX~��”‡ x¶������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���£ qX„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¯��£ qX¯��œôÔÁ¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���£ qX„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��£ qX)��ìcj=¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpÂ��£ qXÂ��v‚ȶ������/���vendor/symfony/finder/Expression/Expression.php��£ qX��µoÔ¶������)���vendor/symfony/finder/Expression/Glob.phpi��£ qXi��@Šº¶������*���vendor/symfony/finder/Expression/Regex.php��£ qX��p8�\¶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��£ qXÍ��²~øb¶������ ���vendor/symfony/finder/Finder.phpÂ-��£ qXÂ-��˜f´¶���������vendor/symfony/finder/Glob.phpK��£ qXK��já±n¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��£ qX]��tà±µ¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpz��£ qXz��ÂT-¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpð��£ qXð��ß0™¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpï��£ qXï��¾�Òâ¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��£ qX ��fQCe¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.php\��£ qX\��p‘'˜¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��£ qX5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��£ qXr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÀ��£ qXÀ��E™½Œ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php/��£ qX/��»ÇY¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��£ qXÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��£ qX ��eÚ¹ü¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpg��£ qXg��!Ô—é¶������3���vendor/symfony/finder/Iterator/SortableIterator.php,��£ qX,��–0õ¶���������vendor/symfony/finder/LICENSE)��£ qX)��¹ô¶������'���vendor/symfony/finder/Shell/Command.phpS ��£ qXS ��cC…™¶������%���vendor/symfony/finder/Shell/Shell.phpp��£ qXp��Ó}g¶������%���vendor/symfony/finder/SplFileInfo.phpÿ��£ qXÿ��Ë OÀ¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��£ qX)��î*L¶������-���vendor/symfony/polyfill-mbstring/Mbstring.phpÁ4��£ qXÁ4��^iS¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2A��£ qX2A��½=¨¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡A��£ qX¡A��Ú Í¶������.���vendor/symfony/polyfill-mbstring/bootstrap.php±��£ qX±��|Š©Ò¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���£ qXf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���£ qX¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���£ qX”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��£ qXx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��£ qX��. Ãá¶������5���vendor/symfony/process/Exception/RuntimeException.php˜���£ qX˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.phpƒ��£ qXƒ��•¨j¶���������vendor/symfony/process/LICENSE)��£ qX)��¹ô¶������.���vendor/symfony/process/PhpExecutableFinder.phpg��£ qXg���絶������%���vendor/symfony/process/PhpProcess.phpü��£ qXü��_—9¶������.���vendor/symfony/process/Pipes/AbstractPipes.php^��£ qX^��%s…ï¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��£ qXD��vØ������*���vendor/symfony/process/Pipes/UnixPipes.phpå��£ qXå��È¥¶������-���vendor/symfony/process/Pipes/WindowsPipes.php� ��£ qX� ��…®h¶������"���vendor/symfony/process/Process.phpÒR��£ qXÒR��û~D¶������)���vendor/symfony/process/ProcessBuilder.phpã
  54. ��£ qXã
  55. ��ʧ°ˆ¶������'���vendor/symfony/process/ProcessUtils.php8��£ qX8��ž�uš¶���������vendor/seld/jsonlint/LICENSE"��£ qX"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��£ qX*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php2��£ qX2��ò8;„¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��£ qX��‰„m!¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��£ qX��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���£ qX>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��£ qX"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��£ qX'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.php ��£ qX ��l½`߶������(���vendor/justinrainbow/json-schema/LICENSE ��£ qX ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpé��£ qXé��nš·í¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php™��£ qX™��ö̓™¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php6��£ qX6��hñÂ"¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¶��£ qX¶��˜¯F?¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.phpc��£ qXc��º«Dø¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpz
  56. ��£ qXz
  57. ��h¾Z¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php©��£ qX©��¢áìQ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpŸ
  58. ��£ qXŸ
  59. ��OSUü¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php§��£ qX§��õ$lV¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php;��£ qX;��:ùd¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php‚��£ qX‚��±êdc¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpÄ��£ qXÄ��—w[“¶������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php��£ qX��â�Ó¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.phpI��£ qXI��Øϱº¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php9��£ qX9��šèñ¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php���£ qX���hEäñ¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.php��£ qX��}§§¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpJ���£ qXJ���LZ£H¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php”���£ qX”���ëèÝH¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���£ qXu���¥ "œ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���£ qXw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÝ��£ qXÝ��¢ |¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpn���£ qXn���°oXm¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php„���£ qX„���'ð–X¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php���£ qX���Ÿû/Ƕ������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpi���£ qXi���ðjîT¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpü��£ qXü��à‘o–¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.phpD��£ qXD��,‘þ¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpI ��£ qXI ��Ùð÷¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.phpú���£ qXú���\kk¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpÜ���£ qXÜ���]j¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.phpt��£ qXt��I·ý�¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php��£ qX��æØ ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php*��£ qX*��-3ÿ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php©���£ qX©���CO¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php“ ��£ qX“ ��0÷ô¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpç��£ qXç��‹I?!¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.php‚���£ qX‚���’û/¡¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php„���£ qX„���ÄLkd¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpà��£ qXà��~qL¢¶������%���vendor/composer/spdx-licenses/LICENSE��£ qX��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpç��£ qXç��·–U ¶���������vendor/composer/semver/LICENSE��£ qX��Bhí¶������)���vendor/composer/semver/src/Comparator.php��£ qX��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��£ qX×��õî>Ž¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��£ qXª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���£ qXß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��£ qXé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��£ qX1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��£ qXv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��£ qX¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��£ qX��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php½��£ qX½��e¶���������vendor/psr/log/LICENSE=��£ qX=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��£ qX;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���£ qX`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���£ qXû���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���£ qX|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���£ qX§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��£ qXÆ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��£ qXi��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���£ qXž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ��£ qXü ��iq0ض���������vendor/autoload.php‚���£ qX‚���å—¶‘¶������'���vendor/composer/autoload_namespaces.phpd���£ qXd���Z¡¦H¶������!���vendor/composer/autoload_psr4.php˜��£ qX˜��ž{¢¶������%���vendor/composer/autoload_classmap.phpd���£ qXd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���£ qXÃ���ÒÂür¶������!���vendor/composer/autoload_real.phpI��£ qXI��w?¶������#���vendor/composer/autoload_static.php¬ ��£ qX¬ ��`q,“¶���������vendor/composer/ClassLoader.php��£ qX��ÿ�u"¶������(���vendor/composer/ca-bundle/res/cacert.pemE
  60. �£ qXE
  61. �]6Ø1¶������ ���bin/composerP��£ qXP��¼†d¶���������LICENSE3��£ qX3��û·þ¶������<?php
  62. namespace Composer\Autoload;
  63. use Composer\Config;
  64. use Composer\EventDispatcher\EventDispatcher;
  65. use Composer\Installer\InstallationManager;
  66. use Composer\IO\IOInterface;
  67. use Composer\Package\AliasPackage;
  68. use Composer\Package\PackageInterface;
  69. use Composer\Repository\InstalledRepositoryInterface;
  70. use Composer\Util\Filesystem;
  71. use Composer\Script\ScriptEvents;
  72. class AutoloadGenerator
  73. {
  74. private $eventDispatcher;
  75. private $io;
  76. private $devMode = false;
  77. private $classMapAuthoritative = false;
  78. private $apcu = false;
  79. private $runScripts = false;
  80. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  81. {
  82. $this->eventDispatcher = $eventDispatcher;
  83. $this->io = $io;
  84. }
  85. public function setDevMode($devMode = true)
  86. {
  87. $this->devMode = (boolean) $devMode;
  88. }
  89. public function setClassMapAuthoritative($classMapAuthoritative)
  90. {
  91. $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
  92. }
  93. public function setApcu($apcu)
  94. {
  95. $this->apcu = (boolean) $apcu;
  96. }
  97. public function setRunScripts($runScripts = true)
  98. {
  99. $this->runScripts = (boolean) $runScripts;
  100. }
  101. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  102. {
  103. if ($this->classMapAuthoritative) {
  104. $scanPsr0Packages = true;
  105. }
  106. if ($this->runScripts) {
  107. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  108. 'optimize' => (bool) $scanPsr0Packages,
  109. ));
  110. }
  111. $filesystem = new Filesystem();
  112. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  113. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  114. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  115. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  116. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  117. $targetDir = $vendorPath.'/'.$targetDir;
  118. $filesystem->ensureDirectoryExists($targetDir);
  119. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  120. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  121. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  122. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  123. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  124. $namespacesFile = <<<EOF
  125. <?php
  126. // autoload_namespaces.php @generated by Composer
  127. \$vendorDir = $vendorPathCode52;
  128. \$baseDir = $appBaseDirCode;
  129. return array(
  130. EOF;
  131. $psr4File = <<<EOF
  132. <?php
  133. // autoload_psr4.php @generated by Composer
  134. \$vendorDir = $vendorPathCode52;
  135. \$baseDir = $appBaseDirCode;
  136. return array(
  137. EOF;
  138. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  139. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  140. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  141. $exportedPaths = array();
  142. foreach ($paths as $path) {
  143. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  144. }
  145. $exportedPrefix = var_export($namespace, true);
  146. $namespacesFile .= " $exportedPrefix => ";
  147. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  148. }
  149. $namespacesFile .= ");\n";
  150. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  151. $exportedPaths = array();
  152. foreach ($paths as $path) {
  153. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  154. }
  155. $exportedPrefix = var_export($namespace, true);
  156. $psr4File .= " $exportedPrefix => ";
  157. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  158. }
  159. $psr4File .= ");\n";
  160. $classmapFile = <<<EOF
  161. <?php
  162. // autoload_classmap.php @generated by Composer
  163. \$vendorDir = $vendorPathCode52;
  164. \$baseDir = $appBaseDirCode;
  165. return array(
  166. EOF;
  167. $targetDirLoader = null;
  168. $mainAutoload = $mainPackage->getAutoload();
  169. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  170. $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
  171. $prefixes = implode(', ', array_map(function ($prefix) {
  172. return var_export($prefix, true);
  173. }, array_keys($mainAutoload['psr-0'])));
  174. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  175. $targetDirLoader = <<<EOF
  176. public static function autoload(\$class)
  177. {
  178. \$dir = $baseDirFromTargetDirCode . '/';
  179. \$prefixes = array($prefixes);
  180. foreach (\$prefixes as \$prefix) {
  181. if (0 !== strpos(\$class, \$prefix)) {
  182. continue;
  183. }
  184. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  185. if (!\$path = stream_resolve_include_path(\$path)) {
  186. return false;
  187. }
  188. require \$path;
  189. return true;
  190. }
  191. }
  192. EOF;
  193. }
  194. $blacklist = null;
  195. if (!empty($autoloads['exclude-from-classmap'])) {
  196. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  197. }
  198. $classMap = array();
  199. if ($scanPsr0Packages) {
  200. $namespacesToScan = array();
  201. foreach (array('psr-0', 'psr-4') as $psrType) {
  202. foreach ($autoloads[$psrType] as $namespace => $paths) {
  203. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  204. }
  205. }
  206. krsort($namespacesToScan);
  207. foreach ($namespacesToScan as $namespace => $groups) {
  208. foreach ($groups as $group) {
  209. foreach ($group['paths'] as $dir) {
  210. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  211. if (!is_dir($dir)) {
  212. continue;
  213. }
  214. $namespaceFilter = $namespace === '' ? null : $namespace;
  215. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  216. }
  217. }
  218. }
  219. }
  220. foreach ($autoloads['classmap'] as $dir) {
  221. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  222. }
  223. ksort($classMap);
  224. foreach ($classMap as $class => $code) {
  225. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  226. }
  227. $classmapFile .= ");\n";
  228. if (!$suffix) {
  229. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  230. $content = file_get_contents($vendorPath.'/autoload.php');
  231. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  232. $suffix = $match[1];
  233. }
  234. }
  235. if (!$suffix) {
  236. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  237. }
  238. }
  239. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  240. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  241. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  242. $includePathFilePath = $targetDir.'/include_paths.php';
  243. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  244. file_put_contents($includePathFilePath, $includePathFileContents);
  245. } elseif (file_exists($includePathFilePath)) {
  246. unlink($includePathFilePath);
  247. }
  248. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  249. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  250. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  251. } elseif (file_exists($includeFilesFilePath)) {
  252. unlink($includeFilesFilePath);
  253. }
  254. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  255. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  256. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  257. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  258. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  259. if ($this->runScripts) {
  260. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  261. 'optimize' => (bool) $scanPsr0Packages,
  262. ));
  263. }
  264. }
  265. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  266. {
  267. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  268. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  269. if (!isset($classMap[$class])) {
  270. $classMap[$class] = $pathCode;
  271. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  272. $this->io->writeError(
  273. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  274. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  275. );
  276. }
  277. }
  278. return $classMap;
  279. }
  280. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  281. {
  282. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  283. }
  284. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  285. {
  286. $packageMap = array(array($mainPackage, ''));
  287. foreach ($packages as $package) {
  288. if ($package instanceof AliasPackage) {
  289. continue;
  290. }
  291. $this->validatePackage($package);
  292. $packageMap[] = array(
  293. $package,
  294. $installationManager->getInstallPath($package),
  295. );
  296. }
  297. return $packageMap;
  298. }
  299. protected function validatePackage(PackageInterface $package)
  300. {
  301. $autoload = $package->getAutoload();
  302. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  303. $name = $package->getName();
  304. $package->getTargetDir();
  305. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  306. }
  307. if (!empty($autoload['psr-4'])) {
  308. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  309. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  310. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  311. }
  312. }
  313. }
  314. }
  315. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  316. {
  317. $mainPackageMap = array_shift($packageMap);
  318. $sortedPackageMap = $this->sortPackageMap($packageMap);
  319. $sortedPackageMap[] = $mainPackageMap;
  320. array_unshift($packageMap, $mainPackageMap);
  321. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  322. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  323. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  324. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  325. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  326. krsort($psr0);
  327. krsort($psr4);
  328. return array(
  329. 'psr-0' => $psr0,
  330. 'psr-4' => $psr4,
  331. 'classmap' => $classmap,
  332. 'files' => $files,
  333. 'exclude-from-classmap' => $exclude,
  334. );
  335. }
  336. public function createLoader(array $autoloads)
  337. {
  338. $loader = new ClassLoader();
  339. if (isset($autoloads['psr-0'])) {
  340. foreach ($autoloads['psr-0'] as $namespace => $path) {
  341. $loader->add($namespace, $path);
  342. }
  343. }
  344. if (isset($autoloads['psr-4'])) {
  345. foreach ($autoloads['psr-4'] as $namespace => $path) {
  346. $loader->addPsr4($namespace, $path);
  347. }
  348. }
  349. if (isset($autoloads['classmap'])) {
  350. foreach ($autoloads['classmap'] as $dir) {
  351. try {
  352. $loader->addClassMap($this->generateClassMap($dir, null, null, false));
  353. } catch (\RuntimeException $e) {
  354. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  355. }
  356. }
  357. }
  358. return $loader;
  359. }
  360. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  361. {
  362. $includePaths = array();
  363. foreach ($packageMap as $item) {
  364. list($package, $installPath) = $item;
  365. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  366. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  367. }
  368. foreach ($package->getIncludePaths() as $includePath) {
  369. $includePath = trim($includePath, '/');
  370. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  371. }
  372. }
  373. if (!$includePaths) {
  374. return;
  375. }
  376. $includePathsCode = '';
  377. foreach ($includePaths as $path) {
  378. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  379. }
  380. return <<<EOF
  381. <?php
  382. // include_paths.php @generated by Composer
  383. \$vendorDir = $vendorPathCode;
  384. \$baseDir = $appBaseDirCode;
  385. return array(
  386. $includePathsCode);
  387. EOF;
  388. }
  389. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  390. {
  391. $filesCode = '';
  392. foreach ($files as $fileIdentifier => $functionFile) {
  393. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  394. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  395. }
  396. if (!$filesCode) {
  397. return false;
  398. }
  399. return <<<EOF
  400. <?php
  401. // autoload_files.php @generated by Composer
  402. \$vendorDir = $vendorPathCode;
  403. \$baseDir = $appBaseDirCode;
  404. return array(
  405. $filesCode);
  406. EOF;
  407. }
  408. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  409. {
  410. if (!$filesystem->isAbsolutePath($path)) {
  411. $path = $basePath . '/' . $path;
  412. }
  413. $path = $filesystem->normalizePath($path);
  414. $baseDir = '';
  415. if (strpos($path.'/', $vendorPath.'/') === 0) {
  416. $path = substr($path, strlen($vendorPath));
  417. $baseDir = '$vendorDir';
  418. if ($path !== false) {
  419. $baseDir .= " . ";
  420. }
  421. } else {
  422. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  423. if (!$filesystem->isAbsolutePath($path)) {
  424. $baseDir = '$baseDir . ';
  425. $path = '/' . $path;
  426. }
  427. }
  428. if (preg_match('/\.phar$/', $path)) {
  429. $baseDir = "'phar://' . " . $baseDir;
  430. }
  431. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  432. }
  433. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  434. {
  435. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode)-1];
  436. if ("'" === $lastChar || '"' === $lastChar) {
  437. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  438. } else {
  439. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  440. }
  441. return <<<AUTOLOAD
  442. <?php
  443. // autoload.php @generated by Composer
  444. require_once $vendorPathToTargetDirCode;
  445. return ComposerAutoloaderInit$suffix::getLoader();
  446. AUTOLOAD;
  447. }
  448. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  449. {
  450. $file = <<<HEADER
  451. <?php
  452. // autoload_real.php @generated by Composer
  453. class ComposerAutoloaderInit$suffix
  454. {
  455. private static \$loader;
  456. public static function loadClassLoader(\$class)
  457. {
  458. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  459. require __DIR__ . '/ClassLoader.php';
  460. }
  461. }
  462. public static function getLoader()
  463. {
  464. if (null !== self::\$loader) {
  465. return self::\$loader;
  466. }
  467. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  468. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  469. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  470. HEADER;
  471. if ($useIncludePath) {
  472. $file .= <<<'INCLUDE_PATH'
  473. $includePaths = require __DIR__ . '/include_paths.php';
  474. array_push($includePaths, get_include_path());
  475. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  476. INCLUDE_PATH;
  477. }
  478. $file .= <<<STATIC_INIT
  479. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  480. if (\$useStaticLoader) {
  481. require_once __DIR__ . '/autoload_static.php';
  482. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  483. } else {
  484. STATIC_INIT;
  485. if (!$this->classMapAuthoritative) {
  486. $file .= <<<'PSR04'
  487. $map = require __DIR__ . '/autoload_namespaces.php';
  488. foreach ($map as $namespace => $path) {
  489. $loader->set($namespace, $path);
  490. }
  491. $map = require __DIR__ . '/autoload_psr4.php';
  492. foreach ($map as $namespace => $path) {
  493. $loader->setPsr4($namespace, $path);
  494. }
  495. PSR04;
  496. }
  497. if ($useClassMap) {
  498. $file .= <<<'CLASSMAP'
  499. $classMap = require __DIR__ . '/autoload_classmap.php';
  500. if ($classMap) {
  501. $loader->addClassMap($classMap);
  502. }
  503. CLASSMAP;
  504. }
  505. $file .= " }\n\n";
  506. if ($this->classMapAuthoritative) {
  507. $file .= <<<'CLASSMAPAUTHORITATIVE'
  508. $loader->setClassMapAuthoritative(true);
  509. CLASSMAPAUTHORITATIVE;
  510. }
  511. if ($this->apcu) {
  512. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  513. $file .= <<<APCU
  514. \$loader->setApcuPrefix('$apcuPrefix');
  515. APCU;
  516. }
  517. if ($useGlobalIncludePath) {
  518. $file .= <<<'INCLUDEPATH'
  519. $loader->setUseIncludePath(true);
  520. INCLUDEPATH;
  521. }
  522. if ($targetDirLoader) {
  523. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  524. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  525. REGISTER_TARGET_DIR_AUTOLOAD;
  526. }
  527. $file .= <<<REGISTER_LOADER
  528. \$loader->register($prependAutoloader);
  529. REGISTER_LOADER;
  530. if ($useIncludeFiles) {
  531. $file .= <<<INCLUDE_FILES
  532. if (\$useStaticLoader) {
  533. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  534. } else {
  535. \$includeFiles = require __DIR__ . '/autoload_files.php';
  536. }
  537. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  538. composerRequire$suffix(\$fileIdentifier, \$file);
  539. }
  540. INCLUDE_FILES;
  541. }
  542. $file .= <<<METHOD_FOOTER
  543. return \$loader;
  544. }
  545. METHOD_FOOTER;
  546. $file .= $targetDirLoader;
  547. if ($useIncludeFiles) {
  548. return $file . <<<FOOTER
  549. }
  550. function composerRequire$suffix(\$fileIdentifier, \$file)
  551. {
  552. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  553. require \$file;
  554. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  555. }
  556. }
  557. FOOTER;
  558. }
  559. return $file . <<<FOOTER
  560. }
  561. FOOTER;
  562. }
  563. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  564. {
  565. $staticPhpVersion = 50600;
  566. $file = <<<HEADER
  567. <?php
  568. // autoload_static.php @generated by Composer
  569. namespace Composer\Autoload;
  570. class ComposerStaticInit$suffix
  571. {
  572. HEADER;
  573. $loader = new ClassLoader();
  574. $map = require $targetDir . '/autoload_namespaces.php';
  575. foreach ($map as $namespace => $path) {
  576. $loader->set($namespace, $path);
  577. }
  578. $map = require $targetDir . '/autoload_psr4.php';
  579. foreach ($map as $namespace => $path) {
  580. $loader->setPsr4($namespace, $path);
  581. }
  582. $classMap = require $targetDir . '/autoload_classmap.php';
  583. if ($classMap) {
  584. $loader->addClassMap($classMap);
  585. }
  586. $filesystem = new Filesystem();
  587. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  588. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  589. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  590. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  591. $initializer = '';
  592. $prefix = "\0Composer\Autoload\ClassLoader\0";
  593. $prefixLen = strlen($prefix);
  594. if (file_exists($targetDir . '/autoload_files.php')) {
  595. $maps = array('files' => require $targetDir . '/autoload_files.php');
  596. } else {
  597. $maps = array();
  598. }
  599. foreach ((array) $loader as $prop => $value) {
  600. if ($value && 0 === strpos($prop, $prefix)) {
  601. $maps[substr($prop, $prefixLen)] = $value;
  602. }
  603. }
  604. foreach ($maps as $prop => $value) {
  605. if (count($value) > 32767) {
  606. $staticPhpVersion = 70000;
  607. }
  608. $value = var_export($value, true);
  609. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  610. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  611. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  612. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  613. if ('files' !== $prop) {
  614. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  615. }
  616. }
  617. return $file . <<<INITIALIZER
  618. public static function getInitializer(ClassLoader \$loader)
  619. {
  620. return \Closure::bind(function () use (\$loader) {
  621. $initializer
  622. }, null, ClassLoader::class);
  623. }
  624. }
  625. INITIALIZER;
  626. }
  627. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  628. {
  629. $autoloads = array();
  630. foreach ($packageMap as $item) {
  631. list($package, $installPath) = $item;
  632. $autoload = $package->getAutoload();
  633. if ($this->devMode && $package === $mainPackage) {
  634. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  635. }
  636. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  637. continue;
  638. }
  639. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  640. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  641. }
  642. foreach ($autoload[$type] as $namespace => $paths) {
  643. foreach ((array) $paths as $path) {
  644. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  645. if ($package === $mainPackage) {
  646. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  647. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  648. } else {
  649. $path = $package->getTargetDir() . '/' . $path;
  650. }
  651. }
  652. if ($type === 'exclude-from-classmap') {
  653. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  654. $path = str_replace('\\*\\*', '.+?', $path);
  655. $path = str_replace('\\*', '[^/]+?', $path);
  656. $updir = null;
  657. $path = preg_replace_callback(
  658. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  659. function ($matches) use (&$updir) {
  660. if (isset($matches[1])) {
  661. $updir = str_replace('\\.', '.', $matches[1]);
  662. }
  663. return '';
  664. },
  665. $path
  666. );
  667. if (empty($installPath)) {
  668. $installPath = strtr(getcwd(), '\\', '/');
  669. }
  670. $resolvedPath = realpath($installPath . '/' . $updir);
  671. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  672. continue;
  673. }
  674. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  675. if ($type === 'files') {
  676. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  677. continue;
  678. } elseif ($type === 'classmap') {
  679. $autoloads[] = $relativePath;
  680. continue;
  681. }
  682. $autoloads[$namespace][] = $relativePath;
  683. }
  684. }
  685. }
  686. return $autoloads;
  687. }
  688. protected function getFileIdentifier(PackageInterface $package, $path)
  689. {
  690. return md5($package->getName() . ':' . $path);
  691. }
  692. protected function sortPackageMap(array $packageMap)
  693. {
  694. $packages = array();
  695. $paths = array();
  696. $usageList = array();
  697. foreach ($packageMap as $item) {
  698. list($package, $path) = $item;
  699. $name = $package->getName();
  700. $packages[$name] = $package;
  701. $paths[$name] = $path;
  702. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  703. $target = $link->getTarget();
  704. $usageList[$target][] = $name;
  705. }
  706. }
  707. $computing = array();
  708. $computed = array();
  709. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  710. if (isset($computed[$name])) {
  711. return $computed[$name];
  712. }
  713. if (isset($computing[$name])) {
  714. return 0;
  715. }
  716. $computing[$name] = true;
  717. $weight = 0;
  718. if (isset($usageList[$name])) {
  719. foreach ($usageList[$name] as $user) {
  720. $weight -= 1 - $computeImportance($user);
  721. }
  722. }
  723. unset($computing[$name]);
  724. $computed[$name] = $weight;
  725. return $weight;
  726. };
  727. $weightList = array();
  728. foreach ($packages as $name => $package) {
  729. $weight = $computeImportance($name);
  730. $weightList[$name] = $weight;
  731. }
  732. $stable_sort = function (&$array) {
  733. static $transform, $restore;
  734. $i = 0;
  735. if (!$transform) {
  736. $transform = function (&$v, $k) use (&$i) {
  737. $v = array($v, ++$i, $k, $v);
  738. };
  739. $restore = function (&$v, $k) {
  740. $v = $v[3];
  741. };
  742. }
  743. array_walk($array, $transform);
  744. asort($array);
  745. array_walk($array, $restore);
  746. };
  747. $stable_sort($weightList);
  748. $sortedPackageMap = array();
  749. foreach (array_keys($weightList) as $name) {
  750. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  751. }
  752. return $sortedPackageMap;
  753. }
  754. protected function safeCopy($source, $target)
  755. {
  756. $source = fopen($source, 'r');
  757. $target = fopen($target, 'w+');
  758. stream_copy_to_stream($source, $target);
  759. fclose($source);
  760. fclose($target);
  761. }
  762. }
  763. <?php
  764. namespace Composer\Autoload;
  765. use Symfony\Component\Finder\Finder;
  766. use Composer\IO\IOInterface;
  767. use Composer\Util\Filesystem;
  768. class ClassMapGenerator
  769. {
  770. public static function dump($dirs, $file)
  771. {
  772. $maps = array();
  773. foreach ($dirs as $dir) {
  774. $maps = array_merge($maps, static::createMap($dir));
  775. }
  776. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  777. }
  778. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  779. {
  780. if (is_string($path)) {
  781. if (is_file($path)) {
  782. $path = array(new \SplFileInfo($path));
  783. } elseif (is_dir($path)) {
  784. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  785. } else {
  786. throw new \RuntimeException(
  787. 'Could not scan for classes inside "'.$path.
  788. '" which does not appear to be a file nor a folder'
  789. );
  790. }
  791. }
  792. $map = array();
  793. $filesystem = new Filesystem();
  794. $cwd = getcwd();
  795. foreach ($path as $file) {
  796. $filePath = $file->getPathname();
  797. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  798. continue;
  799. }
  800. if (!$filesystem->isAbsolutePath($filePath)) {
  801. $filePath = $cwd . '/' . $filePath;
  802. $filePath = $filesystem->normalizePath($filePath);
  803. } else {
  804. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  805. }
  806. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  807. continue;
  808. }
  809. $classes = self::findClasses($filePath);
  810. foreach ($classes as $class) {
  811. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  812. continue;
  813. }
  814. if (!isset($map[$class])) {
  815. $map[$class] = $filePath;
  816. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  817. $io->writeError(
  818. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  819. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  820. );
  821. }
  822. }
  823. }
  824. return $map;
  825. }
  826. private static function findClasses($path)
  827. {
  828. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  829. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  830. $extraTypes .= '|enum';
  831. }
  832. $contents = @php_strip_whitespace($path);
  833. if (!$contents) {
  834. if (!file_exists($path)) {
  835. $message = 'File at "%s" does not exist, check your classmap definitions';
  836. } elseif (!is_readable($path)) {
  837. $message = 'File at "%s" is not readable, check its permissions';
  838. } elseif ('' === trim(file_get_contents($path))) {
  839. return array();
  840. } else {
  841. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  842. }
  843. $error = error_get_last();
  844. if (isset($error['message'])) {
  845. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  846. }
  847. throw new \RuntimeException(sprintf($message, $path));
  848. }
  849. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  850. return array();
  851. }
  852. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  853. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  854. if (substr($contents, 0, 2) !== '<?') {
  855. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  856. if ($replacements === 0) {
  857. return array();
  858. }
  859. }
  860. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  861. $pos = strrpos($contents, '?>');
  862. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  863. $contents = substr($contents, 0, $pos);
  864. }
  865. preg_match_all('{
  866. (?:
  867. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  868. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  869. )
  870. }ix', $contents, $matches);
  871. $classes = array();
  872. $namespace = '';
  873. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  874. if (!empty($matches['ns'][$i])) {
  875. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  876. } else {
  877. $name = $matches['name'][$i];
  878. if ($name === 'extends' || $name === 'implements') {
  879. continue;
  880. }
  881. if ($name[0] === ':') {
  882. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  883. } elseif ($matches['type'][$i] === 'enum') {
  884. $name = rtrim($name, ':');
  885. }
  886. $classes[] = ltrim($namespace . $name, '\\');
  887. }
  888. }
  889. return $classes;
  890. }
  891. }
  892. <?php
  893. namespace Composer;
  894. use Composer\IO\IOInterface;
  895. use Composer\Util\Filesystem;
  896. use Composer\Util\Silencer;
  897. use Symfony\Component\Finder\Finder;
  898. class Cache
  899. {
  900. private static $cacheCollected = false;
  901. private $io;
  902. private $root;
  903. private $enabled = true;
  904. private $whitelist;
  905. private $filesystem;
  906. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  907. {
  908. $this->io = $io;
  909. $this->root = rtrim($cacheDir, '/\\') . '/';
  910. $this->whitelist = $whitelist;
  911. $this->filesystem = $filesystem ?: new Filesystem();
  912. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  913. $this->enabled = false;
  914. return;
  915. }
  916. if (
  917. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  918. || !is_writable($this->root)
  919. ) {
  920. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  921. $this->enabled = false;
  922. }
  923. }
  924. public function isEnabled()
  925. {
  926. return $this->enabled;
  927. }
  928. public function getRoot()
  929. {
  930. return $this->root;
  931. }
  932. public function read($file)
  933. {
  934. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  935. if ($this->enabled && file_exists($this->root . $file)) {
  936. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  937. return file_get_contents($this->root . $file);
  938. }
  939. return false;
  940. }
  941. public function write($file, $contents)
  942. {
  943. if ($this->enabled) {
  944. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  945. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  946. try {
  947. return file_put_contents($this->root . $file, $contents);
  948. } catch (\ErrorException $e) {
  949. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  950. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  951. unlink($this->root . $file);
  952. $message = sprintf(
  953. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  954. $this->root . $file,
  955. $m[1],
  956. $m[2],
  957. @disk_free_space($this->root . dirname($file))
  958. );
  959. $this->io->writeError($message);
  960. return false;
  961. }
  962. throw $e;
  963. }
  964. }
  965. return false;
  966. }
  967. public function copyFrom($file, $source)
  968. {
  969. if ($this->enabled) {
  970. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  971. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  972. if (!file_exists($source)) {
  973. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  974. } elseif ($this->io->isDebug()) {
  975. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  976. }
  977. return copy($source, $this->root . $file);
  978. }
  979. return false;
  980. }
  981. public function copyTo($file, $target)
  982. {
  983. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  984. if ($this->enabled && file_exists($this->root . $file)) {
  985. try {
  986. touch($this->root . $file, filemtime($this->root . $file), time());
  987. } catch (\ErrorException $e) {
  988. Silencer::call('touch', $this->root . $file);
  989. }
  990. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  991. return copy($this->root . $file, $target);
  992. }
  993. return false;
  994. }
  995. public function gcIsNecessary()
  996. {
  997. return (!self::$cacheCollected && !mt_rand(0, 50));
  998. }
  999. public function remove($file)
  1000. {
  1001. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1002. if ($this->enabled && file_exists($this->root . $file)) {
  1003. return $this->filesystem->unlink($this->root . $file);
  1004. }
  1005. return false;
  1006. }
  1007. public function gc($ttl, $maxSize)
  1008. {
  1009. if ($this->enabled) {
  1010. $expire = new \DateTime();
  1011. $expire->modify('-'.$ttl.' seconds');
  1012. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1013. foreach ($finder as $file) {
  1014. $this->filesystem->unlink($file->getPathname());
  1015. }
  1016. $totalSize = $this->filesystem->size($this->root);
  1017. if ($totalSize > $maxSize) {
  1018. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1019. while ($totalSize > $maxSize && $iterator->valid()) {
  1020. $filepath = $iterator->current()->getPathname();
  1021. $totalSize -= $this->filesystem->size($filepath);
  1022. $this->filesystem->unlink($filepath);
  1023. $iterator->next();
  1024. }
  1025. }
  1026. self::$cacheCollected = true;
  1027. return true;
  1028. }
  1029. return false;
  1030. }
  1031. public function sha1($file)
  1032. {
  1033. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1034. if ($this->enabled && file_exists($this->root . $file)) {
  1035. return sha1_file($this->root . $file);
  1036. }
  1037. return false;
  1038. }
  1039. public function sha256($file)
  1040. {
  1041. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1042. if ($this->enabled && file_exists($this->root . $file)) {
  1043. return hash_file('sha256', $this->root . $file);
  1044. }
  1045. return false;
  1046. }
  1047. protected function getFinder()
  1048. {
  1049. return Finder::create()->in($this->root)->files();
  1050. }
  1051. }
  1052. <?php
  1053. namespace Composer\Command;
  1054. use Symfony\Component\Console\Input\InputInterface;
  1055. use Symfony\Component\Console\Output\OutputInterface;
  1056. class AboutCommand extends BaseCommand
  1057. {
  1058. protected function configure()
  1059. {
  1060. $this
  1061. ->setName('about')
  1062. ->setDescription('Short information about Composer')
  1063. ->setHelp(<<<EOT
  1064. <info>php composer.phar about</info>
  1065. EOT
  1066. )
  1067. ;
  1068. }
  1069. protected function execute(InputInterface $input, OutputInterface $output)
  1070. {
  1071. $this->getIO()->write(<<<EOT
  1072. <info>Composer - Package Management for PHP</info>
  1073. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1074. See https://getcomposer.org/ for more information.</comment>
  1075. EOT
  1076. );
  1077. }
  1078. }
  1079. <?php
  1080. namespace Composer\Command;
  1081. use Composer\Factory;
  1082. use Composer\IO\IOInterface;
  1083. use Composer\Config;
  1084. use Composer\Repository\CompositeRepository;
  1085. use Composer\Repository\RepositoryFactory;
  1086. use Composer\Script\ScriptEvents;
  1087. use Composer\Plugin\CommandEvent;
  1088. use Composer\Plugin\PluginEvents;
  1089. use Composer\Util\Filesystem;
  1090. use Symfony\Component\Console\Input\InputArgument;
  1091. use Symfony\Component\Console\Input\InputInterface;
  1092. use Symfony\Component\Console\Input\InputOption;
  1093. use Symfony\Component\Console\Output\OutputInterface;
  1094. class ArchiveCommand extends BaseCommand
  1095. {
  1096. protected function configure()
  1097. {
  1098. $this
  1099. ->setName('archive')
  1100. ->setDescription('Create an archive of this composer package')
  1101. ->setDefinition(array(
  1102. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1103. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1104. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1105. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1106. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1107. .' Note that the format will be appended.'),
  1108. ))
  1109. ->setHelp(<<<EOT
  1110. The <info>archive</info> command creates an archive of the specified format
  1111. containing the files and directories of the Composer project or the specified
  1112. package in the specified version and writes it to the specified directory.
  1113. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1114. EOT
  1115. )
  1116. ;
  1117. }
  1118. protected function execute(InputInterface $input, OutputInterface $output)
  1119. {
  1120. $config = Factory::createConfig();
  1121. $composer = $this->getComposer(false);
  1122. if ($composer) {
  1123. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1124. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1125. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1126. }
  1127. if (null === $input->getOption('format')) {
  1128. $input->setOption('format', $config->get('archive-format'));
  1129. }
  1130. if (null === $input->getOption('dir')) {
  1131. $input->setOption('dir', $config->get('archive-dir'));
  1132. }
  1133. $returnCode = $this->archive(
  1134. $this->getIO(),
  1135. $config,
  1136. $input->getArgument('package'),
  1137. $input->getArgument('version'),
  1138. $input->getOption('format'),
  1139. $input->getOption('dir'),
  1140. $input->getOption('file')
  1141. );
  1142. if (0 === $returnCode && $composer) {
  1143. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1144. }
  1145. return $returnCode;
  1146. }
  1147. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null)
  1148. {
  1149. $factory = new Factory;
  1150. $downloadManager = $factory->createDownloadManager($io, $config);
  1151. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1152. if ($packageName) {
  1153. $package = $this->selectPackage($io, $packageName, $version);
  1154. if (!$package) {
  1155. return 1;
  1156. }
  1157. } else {
  1158. $package = $this->getComposer()->getPackage();
  1159. }
  1160. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1161. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName);
  1162. $fs = new Filesystem;
  1163. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1164. $io->writeError('Created: ', false);
  1165. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1166. return 0;
  1167. }
  1168. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1169. {
  1170. $io->writeError('<info>Searching for the specified package.</info>');
  1171. if ($composer = $this->getComposer(false)) {
  1172. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1173. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1174. } else {
  1175. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1176. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1177. $repo = new CompositeRepository($defaultRepos);
  1178. }
  1179. $packages = $repo->findPackages($packageName, $version);
  1180. if (count($packages) > 1) {
  1181. $package = reset($packages);
  1182. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1183. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) { return $p->getPrettyString(); }, $packages)).'.');
  1184. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1185. } elseif ($packages) {
  1186. $package = reset($packages);
  1187. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1188. } else {
  1189. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1190. return false;
  1191. }
  1192. return $package;
  1193. }
  1194. }
  1195. <?php
  1196. namespace Composer\Command;
  1197. use Composer\Composer;
  1198. use Composer\Config;
  1199. use Composer\Console\Application;
  1200. use Composer\IO\IOInterface;
  1201. use Composer\IO\NullIO;
  1202. use Symfony\Component\Console\Input\InputInterface;
  1203. use Symfony\Component\Console\Output\OutputInterface;
  1204. use Symfony\Component\Console\Command\Command;
  1205. abstract class BaseCommand extends Command
  1206. {
  1207. private $composer;
  1208. private $io;
  1209. public function getComposer($required = true, $disablePlugins = null)
  1210. {
  1211. if (null === $this->composer) {
  1212. $application = $this->getApplication();
  1213. if ($application instanceof Application) {
  1214. $this->composer = $application->getComposer($required, $disablePlugins);
  1215. } elseif ($required) {
  1216. throw new \RuntimeException(
  1217. 'Could not create a Composer\Composer instance, you must inject '.
  1218. 'one if this command is not used with a Composer\Console\Application instance'
  1219. );
  1220. }
  1221. }
  1222. return $this->composer;
  1223. }
  1224. public function setComposer(Composer $composer)
  1225. {
  1226. $this->composer = $composer;
  1227. }
  1228. public function resetComposer()
  1229. {
  1230. $this->composer = null;
  1231. $this->getApplication()->resetComposer();
  1232. }
  1233. public function isProxyCommand()
  1234. {
  1235. return false;
  1236. }
  1237. public function getIO()
  1238. {
  1239. if (null === $this->io) {
  1240. $application = $this->getApplication();
  1241. if ($application instanceof Application) {
  1242. $this->io = $application->getIO();
  1243. } else {
  1244. $this->io = new NullIO();
  1245. }
  1246. }
  1247. return $this->io;
  1248. }
  1249. public function setIO(IOInterface $io)
  1250. {
  1251. $this->io = $io;
  1252. }
  1253. protected function initialize(InputInterface $input, OutputInterface $output)
  1254. {
  1255. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1256. $input->setOption('no-progress', true);
  1257. }
  1258. parent::initialize($input, $output);
  1259. }
  1260. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1261. {
  1262. $preferSource = false;
  1263. $preferDist = false;
  1264. switch ($config->get('preferred-install')) {
  1265. case 'source':
  1266. $preferSource = true;
  1267. break;
  1268. case 'dist':
  1269. $preferDist = true;
  1270. break;
  1271. case 'auto':
  1272. default:
  1273. break;
  1274. }
  1275. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1276. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1277. $preferDist = $input->getOption('prefer-dist');
  1278. }
  1279. return array($preferSource, $preferDist);
  1280. }
  1281. }
  1282. <?php
  1283. namespace Composer\Command;
  1284. use Composer\DependencyResolver\Pool;
  1285. use Composer\Package\Link;
  1286. use Composer\Package\PackageInterface;
  1287. use Composer\Repository\ArrayRepository;
  1288. use Composer\Repository\CompositeRepository;
  1289. use Composer\Repository\PlatformRepository;
  1290. use Composer\Repository\RepositoryFactory;
  1291. use Composer\Plugin\CommandEvent;
  1292. use Composer\Plugin\PluginEvents;
  1293. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1294. use Composer\Package\Version\VersionParser;
  1295. use Symfony\Component\Console\Helper\Table;
  1296. use Symfony\Component\Console\Input\InputArgument;
  1297. use Symfony\Component\Console\Input\InputInterface;
  1298. use Symfony\Component\Console\Input\InputOption;
  1299. use Symfony\Component\Console\Output\OutputInterface;
  1300. class BaseDependencyCommand extends BaseCommand
  1301. {
  1302. const ARGUMENT_PACKAGE = 'package';
  1303. const ARGUMENT_CONSTRAINT = 'constraint';
  1304. const OPTION_RECURSIVE = 'recursive';
  1305. const OPTION_TREE = 'tree';
  1306. protected $colors;
  1307. protected function configure()
  1308. {
  1309. $this->setDefinition(array(
  1310. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1311. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1312. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1313. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1314. ));
  1315. }
  1316. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1317. {
  1318. $composer = $this->getComposer();
  1319. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1320. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1321. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1322. $repository = new CompositeRepository(array(
  1323. new ArrayRepository(array($composer->getPackage())),
  1324. $composer->getRepositoryManager()->getLocalRepository(),
  1325. new PlatformRepository(array(), $platformOverrides),
  1326. ));
  1327. $pool = new Pool();
  1328. $pool->addRepository($repository);
  1329. list($needle, $textConstraint) = array_pad(
  1330. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1331. 2,
  1332. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1333. );
  1334. $packages = $pool->whatProvides($needle);
  1335. if (empty($packages)) {
  1336. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1337. }
  1338. if (!$repository->findPackage($needle, $textConstraint)) {
  1339. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1340. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1341. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1342. }
  1343. }
  1344. $needles = array($needle);
  1345. if ($inverted) {
  1346. foreach ($packages as $package) {
  1347. $needles = array_merge($needles, array_map(function (Link $link) {
  1348. return $link->getTarget();
  1349. }, $package->getReplaces()));
  1350. }
  1351. }
  1352. if ('*' !== $textConstraint) {
  1353. $versionParser = new VersionParser();
  1354. $constraint = $versionParser->parseConstraints($textConstraint);
  1355. } else {
  1356. $constraint = null;
  1357. }
  1358. $renderTree = $input->getOption(self::OPTION_TREE);
  1359. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1360. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1361. if (empty($results)) {
  1362. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1363. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1364. $needle, $extra));
  1365. } elseif ($renderTree) {
  1366. $this->initStyles($output);
  1367. $root = $packages[0];
  1368. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1369. $this->printTree($results);
  1370. } else {
  1371. $this->printTable($output, $results);
  1372. }
  1373. return 0;
  1374. }
  1375. protected function printTable(OutputInterface $output, $results)
  1376. {
  1377. $table = array();
  1378. $doubles = array();
  1379. do {
  1380. $queue = array();
  1381. $rows = array();
  1382. foreach ($results as $result) {
  1383. list($package, $link, $children) = $result;
  1384. $unique = (string) $link;
  1385. if (isset($doubles[$unique])) {
  1386. continue;
  1387. }
  1388. $doubles[$unique] = true;
  1389. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1390. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1391. if ($children) {
  1392. $queue = array_merge($queue, $children);
  1393. }
  1394. }
  1395. $results = $queue;
  1396. $table = array_merge($rows, $table);
  1397. } while (!empty($results));
  1398. $renderer = new Table($output);
  1399. $renderer->setStyle('compact');
  1400. $renderer->getStyle()->setVerticalBorderChar('');
  1401. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1402. $renderer->setRows($table)->render();
  1403. }
  1404. protected function initStyles(OutputInterface $output)
  1405. {
  1406. $this->colors = array(
  1407. 'green',
  1408. 'yellow',
  1409. 'cyan',
  1410. 'magenta',
  1411. 'blue',
  1412. );
  1413. foreach ($this->colors as $color) {
  1414. $style = new OutputFormatterStyle($color);
  1415. $output->getFormatter()->setStyle($color, $style);
  1416. }
  1417. }
  1418. protected function printTree($results, $prefix = '', $level = 1)
  1419. {
  1420. $count = count($results);
  1421. $idx = 0;
  1422. foreach ($results as $result) {
  1423. list($package, $link, $children) = $result;
  1424. $color = $this->colors[$level % count($this->colors)];
  1425. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1426. $isLast = (++$idx == $count);
  1427. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1428. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1429. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1430. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1431. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1432. if ($children) {
  1433. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1434. }
  1435. }
  1436. }
  1437. private function writeTreeLine($line)
  1438. {
  1439. $io = $this->getIO();
  1440. if (!$io->isDecorated()) {
  1441. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1442. }
  1443. $io->write($line);
  1444. }
  1445. }
  1446. <?php
  1447. namespace Composer\Command;
  1448. use Composer\Cache;
  1449. use Composer\Factory;
  1450. use Symfony\Component\Console\Input\InputInterface;
  1451. use Symfony\Component\Console\Output\OutputInterface;
  1452. class ClearCacheCommand extends BaseCommand
  1453. {
  1454. protected function configure()
  1455. {
  1456. $this
  1457. ->setName('clear-cache')
  1458. ->setAliases(array('clearcache'))
  1459. ->setDescription('Clears composer\'s internal package cache.')
  1460. ->setHelp(<<<EOT
  1461. The <info>clear-cache</info> deletes all cached packages from composer's
  1462. cache directory.
  1463. EOT
  1464. )
  1465. ;
  1466. }
  1467. protected function execute(InputInterface $input, OutputInterface $output)
  1468. {
  1469. $config = Factory::createConfig();
  1470. $io = $this->getIO();
  1471. $cachePaths = array(
  1472. 'cache-dir' => $config->get('cache-dir'),
  1473. 'cache-files-dir' => $config->get('cache-files-dir'),
  1474. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1475. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1476. );
  1477. foreach ($cachePaths as $key => $cachePath) {
  1478. $cachePath = realpath($cachePath);
  1479. if (!$cachePath) {
  1480. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1481. continue;
  1482. }
  1483. $cache = new Cache($io, $cachePath);
  1484. if (!$cache->isEnabled()) {
  1485. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1486. continue;
  1487. }
  1488. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1489. $cache->gc(0, 0);
  1490. }
  1491. $io->writeError('<info>All caches cleared.</info>');
  1492. }
  1493. }
  1494. <?php
  1495. namespace Composer\Command;
  1496. use Composer\Util\Platform;
  1497. use Composer\Util\Silencer;
  1498. use Symfony\Component\Console\Input\InputInterface;
  1499. use Symfony\Component\Console\Input\InputArgument;
  1500. use Symfony\Component\Console\Input\InputOption;
  1501. use Symfony\Component\Console\Output\OutputInterface;
  1502. use Composer\Config;
  1503. use Composer\Config\JsonConfigSource;
  1504. use Composer\Factory;
  1505. use Composer\Json\JsonFile;
  1506. use Composer\Semver\VersionParser;
  1507. use Composer\Package\BasePackage;
  1508. class ConfigCommand extends BaseCommand
  1509. {
  1510. protected $config;
  1511. protected $configFile;
  1512. protected $configSource;
  1513. protected $authConfigFile;
  1514. protected $authConfigSource;
  1515. protected function configure()
  1516. {
  1517. $this
  1518. ->setName('config')
  1519. ->setDescription('Set config options')
  1520. ->setDefinition(array(
  1521. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1522. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1523. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1524. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1525. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1526. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1527. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1528. new InputArgument('setting-key', null, 'Setting key'),
  1529. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1530. ))
  1531. ->setHelp(<<<EOT
  1532. This command allows you to edit composer config settings and repositories
  1533. in either the local composer.json file or the global config.json file.
  1534. Additionally it lets you edit most properties in the local composer.json.
  1535. To set a config setting:
  1536. <comment>%command.full_name% bin-dir bin/</comment>
  1537. To read a config setting:
  1538. <comment>%command.full_name% bin-dir</comment>
  1539. Outputs: <info>bin</info>
  1540. To edit the global config.json file:
  1541. <comment>%command.full_name% --global</comment>
  1542. To add a repository:
  1543. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1544. To remove a repository (repo is a short alias for repositories):
  1545. <comment>%command.full_name% --unset repo.foo</comment>
  1546. To disable packagist:
  1547. <comment>%command.full_name% repo.packagist false</comment>
  1548. You can alter repositories in the global config.json file by passing in the
  1549. <info>--global</info> option.
  1550. To edit the file in an external editor:
  1551. <comment>%command.full_name% --editor</comment>
  1552. To choose your editor you can set the "EDITOR" env variable.
  1553. To get a list of configuration values in the file:
  1554. <comment>%command.full_name% --list</comment>
  1555. You can always pass more than one option. As an example, if you want to edit the
  1556. global config.json file.
  1557. <comment>%command.full_name% --editor --global</comment>
  1558. EOT
  1559. )
  1560. ;
  1561. }
  1562. protected function initialize(InputInterface $input, OutputInterface $output)
  1563. {
  1564. parent::initialize($input, $output);
  1565. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1566. throw new \RuntimeException('--file and --global can not be combined');
  1567. }
  1568. $io = $this->getIO();
  1569. $this->config = Factory::createConfig($io);
  1570. $configFile = $input->getOption('global')
  1571. ? ($this->config->get('home') . '/config.json')
  1572. : ($input->getOption('file') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
  1573. if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
  1574. file_put_contents($configFile, "{\n}\n");
  1575. }
  1576. $this->configFile = new JsonFile($configFile, null, $io);
  1577. $this->configSource = new JsonConfigSource($this->configFile);
  1578. $authConfigFile = $input->getOption('global')
  1579. ? ($this->config->get('home') . '/auth.json')
  1580. : dirname(realpath($configFile)) . '/auth.json';
  1581. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1582. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1583. if ($input->getOption('global') && !$this->configFile->exists()) {
  1584. touch($this->configFile->getPath());
  1585. $this->configFile->write(array('config' => new \ArrayObject));
  1586. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1587. }
  1588. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1589. touch($this->authConfigFile->getPath());
  1590. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1591. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1592. }
  1593. if (!$this->configFile->exists()) {
  1594. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1595. }
  1596. }
  1597. protected function execute(InputInterface $input, OutputInterface $output)
  1598. {
  1599. if ($input->getOption('editor')) {
  1600. $editor = escapeshellcmd(getenv('EDITOR'));
  1601. if (!$editor) {
  1602. if (Platform::isWindows()) {
  1603. $editor = 'notepad';
  1604. } else {
  1605. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1606. if (exec('which '.$candidate)) {
  1607. $editor = $candidate;
  1608. break;
  1609. }
  1610. }
  1611. }
  1612. }
  1613. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1614. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1615. return 0;
  1616. }
  1617. if (!$input->getOption('global')) {
  1618. $this->config->merge($this->configFile->read());
  1619. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1620. }
  1621. if ($input->getOption('list')) {
  1622. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1623. return 0;
  1624. }
  1625. $settingKey = $input->getArgument('setting-key');
  1626. if (!$settingKey) {
  1627. return 0;
  1628. }
  1629. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1630. throw new \RuntimeException('You can not combine a setting value with --unset');
  1631. }
  1632. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1633. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1634. $rawData = $this->configFile->read();
  1635. $data = $this->config->all();
  1636. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1637. if (!isset($matches[1]) || $matches[1] === '') {
  1638. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1639. } else {
  1640. if (!isset($data['repositories'][$matches[1]])) {
  1641. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1642. }
  1643. $value = $data['repositories'][$matches[1]];
  1644. }
  1645. } elseif (strpos($settingKey, '.')) {
  1646. $bits = explode('.', $settingKey);
  1647. if ($bits[0] === 'extra') {
  1648. $data = $rawData;
  1649. } else {
  1650. $data = $data['config'];
  1651. }
  1652. $match = false;
  1653. foreach ($bits as $bit) {
  1654. $key = isset($key) ? $key.'.'.$bit : $bit;
  1655. $match = false;
  1656. if (isset($data[$key])) {
  1657. $match = true;
  1658. $data = $data[$key];
  1659. unset($key);
  1660. }
  1661. }
  1662. if (!$match) {
  1663. throw new \RuntimeException($settingKey.' is not defined.');
  1664. }
  1665. $value = $data;
  1666. } elseif (isset($data['config'][$settingKey])) {
  1667. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1668. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1669. $value = $rawData[$settingKey];
  1670. } else {
  1671. throw new \RuntimeException($settingKey.' is not defined');
  1672. }
  1673. if (is_array($value)) {
  1674. $value = json_encode($value);
  1675. }
  1676. $this->getIO()->write($value);
  1677. return 0;
  1678. }
  1679. $values = $input->getArgument('setting-value');
  1680. $booleanValidator = function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); };
  1681. $booleanNormalizer = function ($val) { return $val !== 'false' && (bool) $val; };
  1682. $uniqueConfigValues = array(
  1683. 'process-timeout' => array('is_numeric', 'intval'),
  1684. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1685. 'preferred-install' => array(
  1686. function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); },
  1687. function ($val) { return $val; },
  1688. ),
  1689. 'store-auths' => array(
  1690. function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); },
  1691. function ($val) {
  1692. if ('prompt' === $val) {
  1693. return 'prompt';
  1694. }
  1695. return $val !== 'false' && (bool) $val;
  1696. },
  1697. ),
  1698. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1699. 'vendor-dir' => array('is_string', function ($val) { return $val; }),
  1700. 'bin-dir' => array('is_string', function ($val) { return $val; }),
  1701. 'archive-dir' => array('is_string', function ($val) { return $val; }),
  1702. 'archive-format' => array('is_string', function ($val) { return $val; }),
  1703. 'data-dir' => array('is_string', function ($val) { return $val; }),
  1704. 'cache-dir' => array('is_string', function ($val) { return $val; }),
  1705. 'cache-files-dir' => array('is_string', function ($val) { return $val; }),
  1706. 'cache-repo-dir' => array('is_string', function ($val) { return $val; }),
  1707. 'cache-vcs-dir' => array('is_string', function ($val) { return $val; }),
  1708. 'cache-ttl' => array('is_numeric', 'intval'),
  1709. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1710. 'cache-files-maxsize' => array(
  1711. function ($val) { return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0; },
  1712. function ($val) { return $val; },
  1713. ),
  1714. 'bin-compat' => array(
  1715. function ($val) { return in_array($val, array('auto', 'full')); },
  1716. function ($val) { return $val; },
  1717. ),
  1718. 'discard-changes' => array(
  1719. function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); },
  1720. function ($val) {
  1721. if ('stash' === $val) {
  1722. return 'stash';
  1723. }
  1724. return $val !== 'false' && (bool) $val;
  1725. },
  1726. ),
  1727. 'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }),
  1728. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1729. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1730. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1731. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1732. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1733. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1734. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1735. 'cafile' => array(
  1736. function ($val) { return file_exists($val) && is_readable($val); },
  1737. function ($val) { return $val === 'null' ? null : $val; },
  1738. ),
  1739. 'capath' => array(
  1740. function ($val) { return is_dir($val) && is_readable($val); },
  1741. function ($val) { return $val === 'null' ? null : $val; },
  1742. ),
  1743. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1744. );
  1745. $multiConfigValues = array(
  1746. 'github-protocols' => array(
  1747. function ($vals) {
  1748. if (!is_array($vals)) {
  1749. return 'array expected';
  1750. }
  1751. foreach ($vals as $val) {
  1752. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1753. return 'valid protocols include: git, https, ssh';
  1754. }
  1755. }
  1756. return true;
  1757. },
  1758. function ($vals) {
  1759. return $vals;
  1760. },
  1761. ),
  1762. 'github-domains' => array(
  1763. function ($vals) {
  1764. if (!is_array($vals)) {
  1765. return 'array expected';
  1766. }
  1767. return true;
  1768. },
  1769. function ($vals) {
  1770. return $vals;
  1771. },
  1772. ),
  1773. 'gitlab-domains' => array(
  1774. function ($vals) {
  1775. if (!is_array($vals)) {
  1776. return 'array expected';
  1777. }
  1778. return true;
  1779. },
  1780. function ($vals) {
  1781. return $vals;
  1782. },
  1783. ),
  1784. );
  1785. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  1786. return $this->configSource->removeConfigSetting($settingKey);
  1787. }
  1788. if (isset($uniqueConfigValues[$settingKey])) {
  1789. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  1790. }
  1791. if (isset($multiConfigValues[$settingKey])) {
  1792. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  1793. }
  1794. $uniqueProps = array(
  1795. 'name' => array('is_string', function ($val) { return $val; }),
  1796. 'type' => array('is_string', function ($val) { return $val; }),
  1797. 'description' => array('is_string', function ($val) { return $val; }),
  1798. 'homepage' => array('is_string', function ($val) { return $val; }),
  1799. 'version' => array('is_string', function ($val) { return $val; }),
  1800. 'minimum-stability' => array(
  1801. function ($val) { return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]); },
  1802. function ($val) { return VersionParser::normalizeStability($val); }
  1803. ),
  1804. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  1805. );
  1806. $multiProps = array(
  1807. 'keywords' => array(
  1808. function ($vals) {
  1809. if (!is_array($vals)) {
  1810. return 'array expected';
  1811. }
  1812. return true;
  1813. },
  1814. function ($vals) {
  1815. return $vals;
  1816. },
  1817. ),
  1818. 'license' => array(
  1819. function ($vals) {
  1820. if (!is_array($vals)) {
  1821. return 'array expected';
  1822. }
  1823. return true;
  1824. },
  1825. function ($vals) {
  1826. return $vals;
  1827. },
  1828. ),
  1829. );
  1830. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  1831. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  1832. }
  1833. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  1834. return $this->configSource->removeProperty($settingKey);
  1835. }
  1836. if (isset($uniqueProps[$settingKey])) {
  1837. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  1838. }
  1839. if (isset($multiProps[$settingKey])) {
  1840. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  1841. }
  1842. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  1843. if ($input->getOption('unset')) {
  1844. return $this->configSource->removeRepository($matches[1]);
  1845. }
  1846. if (2 === count($values)) {
  1847. return $this->configSource->addRepository($matches[1], array(
  1848. 'type' => $values[0],
  1849. 'url' => $values[1],
  1850. ));
  1851. }
  1852. if (1 === count($values)) {
  1853. $value = strtolower($values[0]);
  1854. if (true === $booleanValidator($value)) {
  1855. if (false === $booleanNormalizer($value)) {
  1856. return $this->configSource->addRepository($matches[1], false);
  1857. }
  1858. } else {
  1859. $value = JsonFile::parseJson($values[0]);
  1860. return $this->configSource->addRepository($matches[1], $value);
  1861. }
  1862. }
  1863. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  1864. }
  1865. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  1866. if ($input->getOption('unset')) {
  1867. return $this->configSource->removeProperty($settingKey);
  1868. }
  1869. return $this->configSource->addProperty($settingKey, $values[0]);
  1870. }
  1871. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  1872. if ($input->getOption('unset')) {
  1873. return $this->configSource->removeConfigSetting($settingKey);
  1874. }
  1875. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  1876. }
  1877. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  1878. if ($input->getOption('unset')) {
  1879. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1880. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1881. return;
  1882. }
  1883. if ($matches[1] === 'bitbucket-oauth') {
  1884. if (2 !== count($values)) {
  1885. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  1886. }
  1887. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1888. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  1889. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  1890. if (1 !== count($values)) {
  1891. throw new \RuntimeException('Too many arguments, expected only one token');
  1892. }
  1893. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1894. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  1895. } elseif ($matches[1] === 'http-basic') {
  1896. if (2 !== count($values)) {
  1897. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  1898. }
  1899. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1900. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  1901. }
  1902. return;
  1903. }
  1904. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  1905. }
  1906. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  1907. {
  1908. list($validator, $normalizer) = $callbacks;
  1909. if (1 !== count($values)) {
  1910. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  1911. }
  1912. if (true !== $validation = $validator($values[0])) {
  1913. throw new \RuntimeException(sprintf(
  1914. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  1915. $values[0]
  1916. ));
  1917. }
  1918. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  1919. }
  1920. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  1921. {
  1922. list($validator, $normalizer) = $callbacks;
  1923. if (true !== $validation = $validator($values)) {
  1924. throw new \RuntimeException(sprintf(
  1925. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  1926. json_encode($values)
  1927. ));
  1928. }
  1929. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  1930. }
  1931. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  1932. {
  1933. $origK = $k;
  1934. $io = $this->getIO();
  1935. foreach ($contents as $key => $value) {
  1936. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  1937. continue;
  1938. }
  1939. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  1940. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  1941. $k .= preg_replace('{^config\.}', '', $key . '.');
  1942. $this->listConfiguration($value, $rawVal, $output, $k);
  1943. $k = $origK;
  1944. continue;
  1945. }
  1946. if (is_array($value)) {
  1947. $value = array_map(function ($val) {
  1948. return is_array($val) ? json_encode($val) : $val;
  1949. }, $value);
  1950. $value = '['.implode(', ', $value).']';
  1951. }
  1952. if (is_bool($value)) {
  1953. $value = var_export($value, true);
  1954. }
  1955. if (is_string($rawVal) && $rawVal != $value) {
  1956. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  1957. } else {
  1958. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  1959. }
  1960. }
  1961. }
  1962. }
  1963. <?php
  1964. namespace Composer\Command;
  1965. use Composer\Config;
  1966. use Composer\Factory;
  1967. use Composer\Installer;
  1968. use Composer\Installer\ProjectInstaller;
  1969. use Composer\Installer\InstallationManager;
  1970. use Composer\Installer\SuggestedPackagesReporter;
  1971. use Composer\IO\IOInterface;
  1972. use Composer\Package\BasePackage;
  1973. use Composer\DependencyResolver\Pool;
  1974. use Composer\DependencyResolver\Operation\InstallOperation;
  1975. use Composer\Package\Version\VersionSelector;
  1976. use Composer\Repository\RepositoryFactory;
  1977. use Composer\Repository\CompositeRepository;
  1978. use Composer\Repository\PlatformRepository;
  1979. use Composer\Repository\InstalledFilesystemRepository;
  1980. use Composer\Script\ScriptEvents;
  1981. use Composer\Util\Silencer;
  1982. use Symfony\Component\Console\Input\InputArgument;
  1983. use Symfony\Component\Console\Input\InputInterface;
  1984. use Symfony\Component\Console\Input\InputOption;
  1985. use Symfony\Component\Console\Output\OutputInterface;
  1986. use Symfony\Component\Finder\Finder;
  1987. use Composer\Json\JsonFile;
  1988. use Composer\Config\JsonConfigSource;
  1989. use Composer\Util\Filesystem;
  1990. use Composer\Package\Version\VersionParser;
  1991. class CreateProjectCommand extends BaseCommand
  1992. {
  1993. protected $suggestedPackagesReporter;
  1994. protected function configure()
  1995. {
  1996. $this
  1997. ->setName('create-project')
  1998. ->setDescription('Create new project from a package into given directory.')
  1999. ->setDefinition(array(
  2000. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2001. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2002. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2003. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2004. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2005. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2006. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2007. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2008. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2009. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2010. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2011. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2012. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2013. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2014. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
  2015. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2016. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2017. ))
  2018. ->setHelp(<<<EOT
  2019. The <info>create-project</info> command creates a new project from a given
  2020. package into a new directory. If executed without params and in a directory
  2021. with a composer.json file it installs the packages for the current project.
  2022. You can use this command to bootstrap new projects or setup a clean
  2023. version-controlled installation for developers of your project.
  2024. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2025. You can also specify the version with the package name using = or : as separator.
  2026. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2027. To install unstable packages, either specify the version you want, or use the
  2028. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2029. To setup a developer workable version you should create the project using the source
  2030. controlled code by appending the <info>'--prefer-source'</info> flag.
  2031. To install a package from another repository than the default one you
  2032. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2033. EOT
  2034. )
  2035. ;
  2036. }
  2037. protected function execute(InputInterface $input, OutputInterface $output)
  2038. {
  2039. $config = Factory::createConfig();
  2040. $io = $this->getIO();
  2041. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2042. if ($input->getOption('dev')) {
  2043. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2044. }
  2045. if ($input->getOption('no-custom-installers')) {
  2046. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2047. $input->setOption('no-plugins', true);
  2048. }
  2049. return $this->installProject(
  2050. $io,
  2051. $config,
  2052. $input,
  2053. $input->getArgument('package'),
  2054. $input->getArgument('directory'),
  2055. $input->getArgument('version'),
  2056. $input->getOption('stability'),
  2057. $preferSource,
  2058. $preferDist,
  2059. !$input->getOption('no-dev'),
  2060. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2061. $input->getOption('no-plugins'),
  2062. $input->getOption('no-scripts'),
  2063. $input->getOption('keep-vcs'),
  2064. $input->getOption('no-progress'),
  2065. $input->getOption('no-install'),
  2066. $input->getOption('ignore-platform-reqs'),
  2067. !$input->getOption('no-secure-http')
  2068. );
  2069. }
  2070. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2071. {
  2072. $oldCwd = getcwd();
  2073. $io->loadConfiguration($config);
  2074. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2075. if ($packageName !== null) {
  2076. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs, $secureHttp);
  2077. } else {
  2078. $installedFromVcs = false;
  2079. }
  2080. $composer = Factory::create($io, null, $disablePlugins);
  2081. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2082. $fs = new Filesystem();
  2083. if ($noScripts === false) {
  2084. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2085. }
  2086. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($composer->getConfig(), $input);
  2087. if ($noInstall === false) {
  2088. $installer = Installer::create($io, $composer);
  2089. $installer->setPreferSource($preferSource)
  2090. ->setPreferDist($preferDist)
  2091. ->setDevMode($installDevPackages)
  2092. ->setRunScripts(!$noScripts)
  2093. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2094. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter);
  2095. if ($disablePlugins) {
  2096. $installer->disablePlugins();
  2097. }
  2098. $status = $installer->run();
  2099. if (0 !== $status) {
  2100. return $status;
  2101. }
  2102. }
  2103. $hasVcs = $installedFromVcs;
  2104. if (!$keepVcs && $installedFromVcs
  2105. && (
  2106. !$io->isInteractive()
  2107. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2108. )
  2109. ) {
  2110. $finder = new Finder();
  2111. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2112. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2113. $finder->name($vcsName);
  2114. }
  2115. try {
  2116. $dirs = iterator_to_array($finder);
  2117. unset($finder);
  2118. foreach ($dirs as $dir) {
  2119. if (!$fs->removeDirectory($dir)) {
  2120. throw new \RuntimeException('Could not remove '.$dir);
  2121. }
  2122. }
  2123. } catch (\Exception $e) {
  2124. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2125. }
  2126. $hasVcs = false;
  2127. }
  2128. if (!$hasVcs) {
  2129. $package = $composer->getPackage();
  2130. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2131. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2132. foreach ($package->{'get'.$meta['method']}() as $link) {
  2133. if ($link->getPrettyConstraint() === 'self.version') {
  2134. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2135. }
  2136. }
  2137. }
  2138. }
  2139. if ($noScripts === false) {
  2140. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2141. }
  2142. chdir($oldCwd);
  2143. $vendorComposerDir = $composer->getConfig()->get('vendor-dir').'/composer';
  2144. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2145. Silencer::call('rmdir', $vendorComposerDir);
  2146. $vendorDir = $composer->getConfig()->get('vendor-dir');
  2147. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2148. Silencer::call('rmdir', $vendorDir);
  2149. }
  2150. }
  2151. return 0;
  2152. }
  2153. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2154. {
  2155. if (!$secureHttp) {
  2156. $config->merge(array('config' => array('secure-http' => false)));
  2157. }
  2158. if (null === $repository) {
  2159. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2160. } else {
  2161. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2162. }
  2163. $parser = new VersionParser();
  2164. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2165. $name = strtolower($requirements[0]['name']);
  2166. if (!$packageVersion && isset($requirements[0]['version'])) {
  2167. $packageVersion = $requirements[0]['version'];
  2168. }
  2169. if (null === $stability) {
  2170. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2171. $stability = $match[1];
  2172. } else {
  2173. $stability = VersionParser::parseStability($packageVersion);
  2174. }
  2175. }
  2176. $stability = VersionParser::normalizeStability($stability);
  2177. if (!isset(BasePackage::$stabilities[$stability])) {
  2178. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2179. }
  2180. $pool = new Pool($stability);
  2181. $pool->addRepository($sourceRepo);
  2182. $phpVersion = null;
  2183. $prettyPhpVersion = null;
  2184. if (!$ignorePlatformReqs) {
  2185. $platformOverrides = $config->get('platform') ?: array();
  2186. $platform = new PlatformRepository(array(), $platformOverrides);
  2187. $phpPackage = $platform->findPackage('php', '*');
  2188. $phpVersion = $phpPackage->getVersion();
  2189. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2190. }
  2191. $versionSelector = new VersionSelector($pool);
  2192. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2193. if (!$package) {
  2194. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2195. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2196. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2197. }
  2198. throw new \InvalidArgumentException($errorMessage .'.');
  2199. }
  2200. if (null === $directory) {
  2201. $parts = explode("/", $name, 2);
  2202. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2203. }
  2204. if (function_exists('pcntl_signal')) {
  2205. declare(ticks=100);
  2206. pcntl_signal(SIGINT, function () use ($directory) {
  2207. $fs = new Filesystem();
  2208. $fs->removeDirectory($directory);
  2209. exit(130);
  2210. });
  2211. }
  2212. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2213. if ($disablePlugins) {
  2214. $io->writeError('<info>Plugins have been disabled.</info>');
  2215. }
  2216. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2217. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2218. }
  2219. $dm = $this->createDownloadManager($io, $config);
  2220. $dm->setPreferSource($preferSource)
  2221. ->setPreferDist($preferDist)
  2222. ->setOutputProgress(!$noProgress);
  2223. $projectInstaller = new ProjectInstaller($directory, $dm);
  2224. $im = $this->createInstallationManager();
  2225. $im->addInstaller($projectInstaller);
  2226. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2227. $im->notifyInstalls($io);
  2228. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2229. $installedFromVcs = 'source' === $package->getInstallationSource();
  2230. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2231. chdir($directory);
  2232. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2233. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2234. return $installedFromVcs;
  2235. }
  2236. protected function createDownloadManager(IOInterface $io, Config $config)
  2237. {
  2238. $factory = new Factory();
  2239. return $factory->createDownloadManager($io, $config);
  2240. }
  2241. protected function createInstallationManager()
  2242. {
  2243. return new InstallationManager();
  2244. }
  2245. }
  2246. <?php
  2247. namespace Composer\Command;
  2248. use Symfony\Component\Console\Input\InputInterface;
  2249. use Symfony\Component\Console\Output\OutputInterface;
  2250. class DependsCommand extends BaseDependencyCommand
  2251. {
  2252. protected function configure()
  2253. {
  2254. parent::configure();
  2255. $this
  2256. ->setName('depends')
  2257. ->setAliases(array('why'))
  2258. ->setDescription('Shows which packages cause the given package to be installed')
  2259. ->setHelp(<<<EOT
  2260. Displays detailed information about where a package is referenced.
  2261. <info>php composer.phar depends composer/composer</info>
  2262. EOT
  2263. )
  2264. ;
  2265. }
  2266. protected function execute(InputInterface $input, OutputInterface $output)
  2267. {
  2268. return parent::doExecute($input, $output, false);
  2269. }
  2270. }
  2271. <?php
  2272. namespace Composer\Command;
  2273. use Composer\Composer;
  2274. use Composer\Factory;
  2275. use Composer\Config;
  2276. use Composer\Downloader\TransportException;
  2277. use Composer\Plugin\CommandEvent;
  2278. use Composer\Plugin\PluginEvents;
  2279. use Composer\Util\ConfigValidator;
  2280. use Composer\Util\IniHelper;
  2281. use Composer\Util\ProcessExecutor;
  2282. use Composer\Util\RemoteFilesystem;
  2283. use Composer\Util\StreamContextFactory;
  2284. use Composer\SelfUpdate\Keys;
  2285. use Composer\SelfUpdate\Versions;
  2286. use Composer\IO\NullIO;
  2287. use Symfony\Component\Console\Input\InputInterface;
  2288. use Symfony\Component\Console\Output\OutputInterface;
  2289. class DiagnoseCommand extends BaseCommand
  2290. {
  2291. protected $rfs;
  2292. protected $process;
  2293. protected $exitCode = 0;
  2294. protected function configure()
  2295. {
  2296. $this
  2297. ->setName('diagnose')
  2298. ->setDescription('Diagnoses the system to identify common errors.')
  2299. ->setHelp(<<<EOT
  2300. The <info>diagnose</info> command checks common errors to help debugging problems.
  2301. The process exit code will be 1 in case of warnings and 2 for errors.
  2302. EOT
  2303. )
  2304. ;
  2305. }
  2306. protected function execute(InputInterface $input, OutputInterface $output)
  2307. {
  2308. $composer = $this->getComposer(false);
  2309. $io = $this->getIO();
  2310. if ($composer) {
  2311. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2312. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2313. $io->write('Checking composer.json: ', false);
  2314. $this->outputResult($this->checkComposerSchema());
  2315. }
  2316. if ($composer) {
  2317. $config = $composer->getConfig();
  2318. } else {
  2319. $config = Factory::createConfig();
  2320. }
  2321. $config->merge(array('config' => array('secure-http' => false)));
  2322. $config->prohibitUrlByConfig('http://packagist.org', new NullIO);
  2323. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2324. $this->process = new ProcessExecutor($io);
  2325. $io->write('Checking platform settings: ', false);
  2326. $this->outputResult($this->checkPlatform());
  2327. $io->write('Checking git settings: ', false);
  2328. $this->outputResult($this->checkGit());
  2329. $io->write('Checking http connectivity to packagist: ', false);
  2330. $this->outputResult($this->checkHttp('http', $config));
  2331. $io->write('Checking https connectivity to packagist: ', false);
  2332. $this->outputResult($this->checkHttp('https', $config));
  2333. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2334. if (!empty($opts['http']['proxy'])) {
  2335. $io->write('Checking HTTP proxy: ', false);
  2336. $this->outputResult($this->checkHttpProxy());
  2337. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2338. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2339. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2340. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2341. }
  2342. if ($oauth = $config->get('github-oauth')) {
  2343. foreach ($oauth as $domain => $token) {
  2344. $io->write('Checking '.$domain.' oauth access: ', false);
  2345. $this->outputResult($this->checkGithubOauth($domain, $token));
  2346. }
  2347. } else {
  2348. $io->write('Checking github.com rate limit: ', false);
  2349. try {
  2350. $rate = $this->getGithubRateLimit('github.com');
  2351. $this->outputResult(true);
  2352. if (10 > $rate['remaining']) {
  2353. $io->write('<warning>WARNING</warning>');
  2354. $io->write(sprintf(
  2355. '<comment>Github has a rate limit on their API. '
  2356. . 'You currently have <options=bold>%u</options=bold> '
  2357. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2358. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2359. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2360. $rate['remaining'],
  2361. $rate['limit']
  2362. ));
  2363. }
  2364. } catch (\Exception $e) {
  2365. if ($e instanceof TransportException && $e->getCode() === 401) {
  2366. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2367. } else {
  2368. $this->outputResult($e);
  2369. }
  2370. }
  2371. }
  2372. $io->write('Checking disk free space: ', false);
  2373. $this->outputResult($this->checkDiskSpace($config));
  2374. if ('phar:' === substr(__FILE__, 0, 5)) {
  2375. $io->write('Checking pubkeys: ', false);
  2376. $this->outputResult($this->checkPubKeys($config));
  2377. $io->write('Checking composer version: ', false);
  2378. $this->outputResult($this->checkVersion($config));
  2379. }
  2380. return $this->exitCode;
  2381. }
  2382. private function checkComposerSchema()
  2383. {
  2384. $validator = new ConfigValidator($this->getIO());
  2385. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2386. if ($errors || $warnings) {
  2387. $messages = array(
  2388. 'error' => $errors,
  2389. 'warning' => $warnings,
  2390. );
  2391. $output = '';
  2392. foreach ($messages as $style => $msgs) {
  2393. foreach ($msgs as $msg) {
  2394. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2395. }
  2396. }
  2397. return rtrim($output);
  2398. }
  2399. return true;
  2400. }
  2401. private function checkGit()
  2402. {
  2403. $this->process->execute('git config color.ui', $output);
  2404. if (strtolower(trim($output)) === 'always') {
  2405. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2406. }
  2407. return true;
  2408. }
  2409. private function checkHttp($proto, Config $config)
  2410. {
  2411. $disableTls = false;
  2412. $result = array();
  2413. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2414. $disableTls = true;
  2415. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2416. }
  2417. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2418. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2419. }
  2420. try {
  2421. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2422. } catch (TransportException $e) {
  2423. if (false !== strpos($e->getMessage(), 'cafile')) {
  2424. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2425. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2426. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2427. } else {
  2428. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2429. }
  2430. }
  2431. if (count($result) > 0) {
  2432. return $result;
  2433. }
  2434. return true;
  2435. }
  2436. private function checkHttpProxy()
  2437. {
  2438. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2439. try {
  2440. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2441. $hash = reset($json['provider-includes']);
  2442. $hash = $hash['sha256'];
  2443. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2444. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2445. if (hash('sha256', $provider) !== $hash) {
  2446. return 'It seems that your proxy is modifying http traffic on the fly';
  2447. }
  2448. } catch (\Exception $e) {
  2449. return $e;
  2450. }
  2451. return true;
  2452. }
  2453. private function checkHttpProxyFullUriRequestParam()
  2454. {
  2455. $url = 'http://packagist.org/packages.json';
  2456. try {
  2457. $this->rfs->getContents('packagist.org', $url, false);
  2458. } catch (TransportException $e) {
  2459. try {
  2460. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2461. } catch (TransportException $e) {
  2462. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2463. }
  2464. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2465. }
  2466. return true;
  2467. }
  2468. private function checkHttpsProxyFullUriRequestParam()
  2469. {
  2470. if (!extension_loaded('openssl')) {
  2471. return 'You need the openssl extension installed for this check';
  2472. }
  2473. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2474. try {
  2475. $this->rfs->getContents('github.com', $url, false);
  2476. } catch (TransportException $e) {
  2477. try {
  2478. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2479. } catch (TransportException $e) {
  2480. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2481. }
  2482. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2483. }
  2484. return true;
  2485. }
  2486. private function checkGithubOauth($domain, $token)
  2487. {
  2488. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2489. try {
  2490. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2491. return $this->rfs->getContents($domain, $url, false, array(
  2492. 'retry-auth-failure' => false,
  2493. )) ? true : 'Unexpected error';
  2494. } catch (\Exception $e) {
  2495. if ($e instanceof TransportException && $e->getCode() === 401) {
  2496. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2497. }
  2498. return $e;
  2499. }
  2500. }
  2501. private function getGithubRateLimit($domain, $token = null)
  2502. {
  2503. if ($token) {
  2504. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2505. }
  2506. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2507. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2508. $data = json_decode($json, true);
  2509. return $data['resources']['core'];
  2510. }
  2511. private function checkDiskSpace($config)
  2512. {
  2513. $minSpaceFree = 1024 * 1024;
  2514. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2515. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2516. ) {
  2517. return '<error>The disk hosting '.$dir.' is full</error>';
  2518. }
  2519. return true;
  2520. }
  2521. private function checkPubKeys($config)
  2522. {
  2523. $home = $config->get('home');
  2524. $errors = array();
  2525. $io = $this->getIO();
  2526. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2527. $io->write('');
  2528. }
  2529. if (file_exists($home.'/keys.tags.pub')) {
  2530. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2531. } else {
  2532. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2533. }
  2534. if (file_exists($home.'/keys.dev.pub')) {
  2535. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2536. } else {
  2537. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2538. }
  2539. if ($errors) {
  2540. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2541. }
  2542. return $errors ?: true;
  2543. }
  2544. private function checkVersion($config)
  2545. {
  2546. $versionsUtil = new Versions($config, $this->rfs);
  2547. $latest = $versionsUtil->getLatest();
  2548. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2549. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2550. }
  2551. return true;
  2552. }
  2553. private function outputResult($result)
  2554. {
  2555. $io = $this->getIO();
  2556. if (true === $result) {
  2557. $io->write('<info>OK</info>');
  2558. return;
  2559. }
  2560. $hadError = false;
  2561. if ($result instanceof \Exception) {
  2562. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2563. }
  2564. if (!$result) {
  2565. $hadError = true;
  2566. } else {
  2567. if (!is_array($result)) {
  2568. $result = array($result);
  2569. }
  2570. foreach ($result as $message) {
  2571. if (false !== strpos($message, '<error>')) {
  2572. $hadError = true;
  2573. }
  2574. }
  2575. }
  2576. if ($hadError) {
  2577. $io->write('<error>FAIL</error>');
  2578. $this->exitCode = 2;
  2579. } else {
  2580. $io->write('<warning>WARNING</warning>');
  2581. $this->exitCode = 1;
  2582. }
  2583. if ($result) {
  2584. foreach ($result as $message) {
  2585. $io->write($message);
  2586. }
  2587. }
  2588. }
  2589. private function checkPlatform()
  2590. {
  2591. $output = '';
  2592. $out = function ($msg, $style) use (&$output) {
  2593. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2594. };
  2595. $errors = array();
  2596. $warnings = array();
  2597. $displayIniMessage = false;
  2598. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2599. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2600. if (!function_exists('json_decode')) {
  2601. $errors['json'] = true;
  2602. }
  2603. if (!extension_loaded('Phar')) {
  2604. $errors['phar'] = true;
  2605. }
  2606. if (!extension_loaded('filter')) {
  2607. $errors['filter'] = true;
  2608. }
  2609. if (!extension_loaded('hash')) {
  2610. $errors['hash'] = true;
  2611. }
  2612. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2613. $errors['iconv_mbstring'] = true;
  2614. }
  2615. if (!ini_get('allow_url_fopen')) {
  2616. $errors['allow_url_fopen'] = true;
  2617. }
  2618. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2619. $errors['ioncube'] = ioncube_loader_version();
  2620. }
  2621. if (PHP_VERSION_ID < 50302) {
  2622. $errors['php'] = PHP_VERSION;
  2623. }
  2624. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2625. $warnings['php'] = PHP_VERSION;
  2626. }
  2627. if (!extension_loaded('openssl')) {
  2628. $errors['openssl'] = true;
  2629. }
  2630. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2631. $warnings['openssl_version'] = true;
  2632. }
  2633. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2634. $warnings['apc_cli'] = true;
  2635. }
  2636. if (!extension_loaded('zlib')) {
  2637. $warnings['zlib'] = true;
  2638. }
  2639. ob_start();
  2640. phpinfo(INFO_GENERAL);
  2641. $phpinfo = ob_get_clean();
  2642. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2643. $configure = $match[1];
  2644. if (false !== strpos($configure, '--enable-sigchild')) {
  2645. $warnings['sigchild'] = true;
  2646. }
  2647. if (false !== strpos($configure, '--with-curlwrappers')) {
  2648. $warnings['curlwrappers'] = true;
  2649. }
  2650. }
  2651. if (ini_get('xdebug.profiler_enabled')) {
  2652. $warnings['xdebug_profile'] = true;
  2653. } elseif (extension_loaded('xdebug')) {
  2654. $warnings['xdebug_loaded'] = true;
  2655. }
  2656. if (!empty($errors)) {
  2657. foreach ($errors as $error => $current) {
  2658. switch ($error) {
  2659. case 'json':
  2660. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2661. $text .= "Install it or recompile php without --disable-json";
  2662. break;
  2663. case 'phar':
  2664. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2665. $text .= "Install it or recompile php without --disable-phar";
  2666. break;
  2667. case 'filter':
  2668. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2669. $text .= "Install it or recompile php without --disable-filter";
  2670. break;
  2671. case 'hash':
  2672. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2673. $text .= "Install it or recompile php without --disable-hash";
  2674. break;
  2675. case 'iconv_mbstring':
  2676. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2677. $text .= "Install either of them or recompile php without --disable-iconv";
  2678. break;
  2679. case 'unicode':
  2680. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2681. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2682. $text .= " detect_unicode = Off";
  2683. $displayIniMessage = true;
  2684. break;
  2685. case 'suhosin':
  2686. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2687. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  2688. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2689. $displayIniMessage = true;
  2690. break;
  2691. case 'php':
  2692. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2693. break;
  2694. case 'allow_url_fopen':
  2695. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2696. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2697. $text .= " allow_url_fopen = On";
  2698. $displayIniMessage = true;
  2699. break;
  2700. case 'ioncube':
  2701. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2702. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  2703. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2704. $displayIniMessage = true;
  2705. break;
  2706. case 'openssl':
  2707. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2708. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2709. break;
  2710. }
  2711. $out($text, 'error');
  2712. }
  2713. $output .= PHP_EOL;
  2714. }
  2715. if (!empty($warnings)) {
  2716. foreach ($warnings as $warning => $current) {
  2717. switch ($warning) {
  2718. case 'apc_cli':
  2719. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2720. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2721. $text .= " apc.enable_cli = Off";
  2722. $displayIniMessage = true;
  2723. break;
  2724. case 'zlib':
  2725. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  2726. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  2727. $displayIniMessage = true;
  2728. break;
  2729. case 'sigchild':
  2730. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2731. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2732. $text .= " https://bugs.php.net/bug.php?id=22999";
  2733. break;
  2734. case 'curlwrappers':
  2735. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2736. $text .= " Recompile it without this flag if possible";
  2737. break;
  2738. case 'php':
  2739. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2740. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2741. break;
  2742. case 'openssl_version':
  2743. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2744. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2745. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2746. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2747. break;
  2748. case 'xdebug_loaded':
  2749. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2750. $text .= " Disabling it when using Composer is recommended.";
  2751. break;
  2752. case 'xdebug_profile':
  2753. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2754. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2755. $text .= " xdebug.profiler_enabled = 0";
  2756. $displayIniMessage = true;
  2757. break;
  2758. }
  2759. $out($text, 'comment');
  2760. }
  2761. }
  2762. if ($displayIniMessage) {
  2763. $out($iniMessage, 'comment');
  2764. }
  2765. return !$warnings && !$errors ? true : $output;
  2766. }
  2767. }
  2768. <?php
  2769. namespace Composer\Command;
  2770. use Composer\Plugin\CommandEvent;
  2771. use Composer\Plugin\PluginEvents;
  2772. use Symfony\Component\Console\Input\InputInterface;
  2773. use Symfony\Component\Console\Input\InputOption;
  2774. use Symfony\Component\Console\Output\OutputInterface;
  2775. class DumpAutoloadCommand extends BaseCommand
  2776. {
  2777. protected function configure()
  2778. {
  2779. $this
  2780. ->setName('dump-autoload')
  2781. ->setAliases(array('dumpautoload'))
  2782. ->setDescription('Dumps the autoloader')
  2783. ->setDefinition(array(
  2784. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  2785. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  2786. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  2787. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  2788. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  2789. ))
  2790. ->setHelp(<<<EOT
  2791. <info>php composer.phar dump-autoload</info>
  2792. EOT
  2793. )
  2794. ;
  2795. }
  2796. protected function execute(InputInterface $input, OutputInterface $output)
  2797. {
  2798. $composer = $this->getComposer();
  2799. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  2800. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2801. $installationManager = $composer->getInstallationManager();
  2802. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  2803. $package = $composer->getPackage();
  2804. $config = $composer->getConfig();
  2805. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  2806. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  2807. $apcu = $input->getOption('apcu') || $config->get('apcu');
  2808. if ($optimize || $authoritative) {
  2809. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  2810. } else {
  2811. $this->getIO()->writeError('<info>Generating autoload files</info>');
  2812. }
  2813. $generator = $composer->getAutoloadGenerator();
  2814. $generator->setDevMode(!$input->getOption('no-dev'));
  2815. $generator->setClassMapAuthoritative($authoritative);
  2816. $generator->setApcu($apcu);
  2817. $generator->setRunScripts(!$input->getOption('no-scripts'));
  2818. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  2819. }
  2820. }
  2821. <?php
  2822. namespace Composer\Command;
  2823. use Symfony\Component\Console\Input\InputInterface;
  2824. use Symfony\Component\Console\Input\InputOption;
  2825. use Symfony\Component\Console\Output\OutputInterface;
  2826. use Symfony\Component\Console\Input\InputArgument;
  2827. class ExecCommand extends BaseCommand
  2828. {
  2829. protected function configure()
  2830. {
  2831. $this
  2832. ->setName('exec')
  2833. ->setDescription('Execute a vendored binary/script')
  2834. ->setDefinition(array(
  2835. new InputOption('list', 'l', InputOption::VALUE_NONE),
  2836. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  2837. new InputArgument(
  2838. 'args',
  2839. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  2840. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  2841. ),
  2842. ))
  2843. ;
  2844. }
  2845. protected function execute(InputInterface $input, OutputInterface $output)
  2846. {
  2847. $composer = $this->getComposer();
  2848. $binDir = $composer->getConfig()->get('bin-dir');
  2849. if ($input->getOption('list') || !$input->getArgument('binary')) {
  2850. $bins = glob($binDir . '/*');
  2851. $bins = array_merge($bins, array_map(function($e) { return "$e (local)"; }, $composer->getPackage()->getBinaries()));
  2852. if (!$bins) {
  2853. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  2854. }
  2855. $this->getIO()->write(<<<EOT
  2856. <comment>Available binaries:</comment>
  2857. EOT
  2858. );
  2859. foreach ($bins as $bin) {
  2860. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  2861. continue;
  2862. }
  2863. $previousBin = $bin;
  2864. $bin = basename($bin);
  2865. $this->getIO()->write(<<<EOT
  2866. <info>- $bin</info>
  2867. EOT
  2868. );
  2869. }
  2870. return 0;
  2871. }
  2872. $binary = $input->getArgument('binary');
  2873. $dispatcher = $composer->getEventDispatcher();
  2874. $dispatcher->addListener('__exec_command', $binary);
  2875. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  2876. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  2877. }
  2878. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  2879. }
  2880. }
  2881. <?php
  2882. namespace Composer\Command;
  2883. use Composer\Factory;
  2884. use Symfony\Component\Console\Input\InputInterface;
  2885. use Symfony\Component\Console\Input\InputArgument;
  2886. use Symfony\Component\Console\Input\StringInput;
  2887. use Symfony\Component\Console\Output\OutputInterface;
  2888. class GlobalCommand extends BaseCommand
  2889. {
  2890. protected function configure()
  2891. {
  2892. $this
  2893. ->setName('global')
  2894. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  2895. ->setDefinition(array(
  2896. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  2897. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  2898. ))
  2899. ->setHelp(<<<EOT
  2900. Use this command as a wrapper to run other Composer commands
  2901. within the global context of COMPOSER_HOME.
  2902. You can use this to install CLI utilities globally, all you need
  2903. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  2904. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  2905. and /home/<user>/.composer on unix systems.
  2906. If your system uses freedesktop.org standards, then it will first check
  2907. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  2908. Note: This path may vary depending on customizations to bin-dir in
  2909. composer.json or the environmental variable COMPOSER_BIN_DIR.
  2910. EOT
  2911. )
  2912. ;
  2913. }
  2914. public function run(InputInterface $input, OutputInterface $output)
  2915. {
  2916. $tokens = preg_split('{\s+}', $input->__toString());
  2917. $args = array();
  2918. foreach ($tokens as $token) {
  2919. if ($token && $token[0] !== '-') {
  2920. $args[] = $token;
  2921. if (count($args) >= 2) {
  2922. break;
  2923. }
  2924. }
  2925. }
  2926. if (count($args) < 2) {
  2927. return parent::run($input, $output);
  2928. }
  2929. $config = Factory::createConfig();
  2930. chdir($config->get('home'));
  2931. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  2932. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  2933. $this->getApplication()->resetComposer();
  2934. return $this->getApplication()->run($input, $output);
  2935. }
  2936. public function isProxyCommand()
  2937. {
  2938. return true;
  2939. }
  2940. }
  2941. <?php
  2942. namespace Composer\Command;
  2943. use Composer\Package\CompletePackageInterface;
  2944. use Composer\Repository\RepositoryInterface;
  2945. use Composer\Repository\ArrayRepository;
  2946. use Composer\Repository\RepositoryFactory;
  2947. use Composer\Util\Platform;
  2948. use Composer\Util\ProcessExecutor;
  2949. use Symfony\Component\Console\Input\InputArgument;
  2950. use Symfony\Component\Console\Input\InputOption;
  2951. use Symfony\Component\Console\Input\InputInterface;
  2952. use Symfony\Component\Console\Output\OutputInterface;
  2953. class HomeCommand extends BaseCommand
  2954. {
  2955. protected function configure()
  2956. {
  2957. $this
  2958. ->setName('browse')
  2959. ->setAliases(array('home'))
  2960. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  2961. ->setDefinition(array(
  2962. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package(s) to browse to.'),
  2963. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  2964. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  2965. ))
  2966. ->setHelp(<<<EOT
  2967. The home command opens or shows a package's repository URL or
  2968. homepage in your default browser.
  2969. To open the homepage by default, use -H or --homepage.
  2970. To show instead of open the repository or homepage URL, use -s or --show.
  2971. EOT
  2972. );
  2973. }
  2974. protected function execute(InputInterface $input, OutputInterface $output)
  2975. {
  2976. $repos = $this->initializeRepos();
  2977. $io = $this->getIO();
  2978. $return = 0;
  2979. foreach ($input->getArgument('packages') as $packageName) {
  2980. $handled = false;
  2981. $packageExists = false;
  2982. foreach ($repos as $repo) {
  2983. foreach ($repo->findPackages($packageName) as $package) {
  2984. $packageExists = true;
  2985. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  2986. $handled = true;
  2987. break 2;
  2988. }
  2989. }
  2990. }
  2991. if (!$packageExists) {
  2992. $return = 1;
  2993. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  2994. }
  2995. if (!$handled) {
  2996. $return = 1;
  2997. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  2998. }
  2999. }
  3000. return $return;
  3001. }
  3002. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3003. {
  3004. $support = $package->getSupport();
  3005. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3006. if (!$url || $showHomepage) {
  3007. $url = $package->getHomepage();
  3008. }
  3009. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3010. return false;
  3011. }
  3012. if ($showOnly) {
  3013. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3014. } else {
  3015. $this->openBrowser($url);
  3016. }
  3017. return true;
  3018. }
  3019. private function openBrowser($url)
  3020. {
  3021. $url = ProcessExecutor::escape($url);
  3022. $process = new ProcessExecutor($this->getIO());
  3023. if (Platform::isWindows()) {
  3024. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3025. }
  3026. $linux = $process->execute('which xdg-open', $output);
  3027. $osx = $process->execute('which open', $output);
  3028. if (0 === $linux) {
  3029. $process->execute('xdg-open ' . $url, $output);
  3030. } elseif (0 === $osx) {
  3031. $process->execute('open ' . $url, $output);
  3032. } else {
  3033. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3034. }
  3035. }
  3036. private function initializeRepos()
  3037. {
  3038. $composer = $this->getComposer(false);
  3039. if ($composer) {
  3040. return array_merge(
  3041. array(new ArrayRepository(array($composer->getPackage()))),
  3042. array($composer->getRepositoryManager()->getLocalRepository()),
  3043. $composer->getRepositoryManager()->getRepositories()
  3044. );
  3045. }
  3046. return RepositoryFactory::defaultRepos($this->getIO());
  3047. }
  3048. }
  3049. <?php
  3050. namespace Composer\Command;
  3051. use Composer\DependencyResolver\Pool;
  3052. use Composer\Json\JsonFile;
  3053. use Composer\Factory;
  3054. use Composer\Repository\RepositoryFactory;
  3055. use Composer\Package\BasePackage;
  3056. use Composer\Package\Version\VersionParser;
  3057. use Composer\Package\Version\VersionSelector;
  3058. use Composer\Repository\CompositeRepository;
  3059. use Composer\Repository\PlatformRepository;
  3060. use Composer\Util\ProcessExecutor;
  3061. use Symfony\Component\Console\Input\InputInterface;
  3062. use Symfony\Component\Console\Input\InputOption;
  3063. use Symfony\Component\Console\Output\OutputInterface;
  3064. use Symfony\Component\Process\Process;
  3065. use Symfony\Component\Process\ExecutableFinder;
  3066. class InitCommand extends BaseCommand
  3067. {
  3068. protected $repos;
  3069. private $gitConfig;
  3070. private $pool;
  3071. protected function configure()
  3072. {
  3073. $this
  3074. ->setName('init')
  3075. ->setDescription('Creates a basic composer.json file in current directory.')
  3076. ->setDefinition(array(
  3077. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3078. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3079. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3080. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3081. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3082. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3083. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3084. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3085. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3086. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3087. ))
  3088. ->setHelp(<<<EOT
  3089. The <info>init</info> command creates a basic composer.json file
  3090. in the current directory.
  3091. <info>php composer.phar init</info>
  3092. EOT
  3093. )
  3094. ;
  3095. }
  3096. protected function execute(InputInterface $input, OutputInterface $output)
  3097. {
  3098. $io = $this->getIO();
  3099. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3100. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3101. if (isset($options['author'])) {
  3102. $options['authors'] = $this->formatAuthors($options['author']);
  3103. unset($options['author']);
  3104. }
  3105. $repositories = $input->getOption('repository');
  3106. if ($repositories) {
  3107. $config = Factory::createConfig($io);
  3108. foreach ($repositories as $repo) {
  3109. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3110. }
  3111. }
  3112. if (isset($options['stability'])) {
  3113. $options['minimum-stability'] = $options['stability'];
  3114. unset($options['stability']);
  3115. }
  3116. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3117. if (array() === $options['require']) {
  3118. $options['require'] = new \stdClass;
  3119. }
  3120. if (isset($options['require-dev'])) {
  3121. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3122. if (array() === $options['require-dev']) {
  3123. $options['require-dev'] = new \stdClass;
  3124. }
  3125. }
  3126. $file = new JsonFile(Factory::getComposerFile());
  3127. $json = $file->encode($options);
  3128. if ($input->isInteractive()) {
  3129. $io->writeError(array('', $json, ''));
  3130. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3131. $io->writeError('<error>Command aborted</error>');
  3132. return 1;
  3133. }
  3134. }
  3135. $file->write($options);
  3136. if ($input->isInteractive() && is_dir('.git')) {
  3137. $ignoreFile = realpath('.gitignore');
  3138. if (false === $ignoreFile) {
  3139. $ignoreFile = realpath('.') . '/.gitignore';
  3140. }
  3141. if (!$this->hasVendorIgnore($ignoreFile)) {
  3142. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3143. if ($io->askConfirmation($question, true)) {
  3144. $this->addVendorIgnore($ignoreFile);
  3145. }
  3146. }
  3147. }
  3148. }
  3149. protected function interact(InputInterface $input, OutputInterface $output)
  3150. {
  3151. $git = $this->getGitConfig();
  3152. $io = $this->getIO();
  3153. $formatter = $this->getHelperSet()->get('formatter');
  3154. $repositories = $input->getOption('repository');
  3155. if ($repositories) {
  3156. $config = Factory::createConfig($io);
  3157. $repos = array(new PlatformRepository);
  3158. foreach ($repositories as $repo) {
  3159. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3160. }
  3161. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3162. 'type' => 'composer',
  3163. 'url' => 'https://packagist.org',
  3164. ));
  3165. $this->repos = new CompositeRepository($repos);
  3166. unset($repos, $config, $repositories);
  3167. }
  3168. $io->writeError(array(
  3169. '',
  3170. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3171. '',
  3172. ));
  3173. $io->writeError(array(
  3174. '',
  3175. 'This command will guide you through creating your composer.json config.',
  3176. '',
  3177. ));
  3178. $cwd = realpath(".");
  3179. if (!$name = $input->getOption('name')) {
  3180. $name = basename($cwd);
  3181. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3182. $name = strtolower($name);
  3183. if (isset($git['github.user'])) {
  3184. $name = $git['github.user'] . '/' . $name;
  3185. } elseif (!empty($_SERVER['USERNAME'])) {
  3186. $name = $_SERVER['USERNAME'] . '/' . $name;
  3187. } elseif (get_current_user()) {
  3188. $name = get_current_user() . '/' . $name;
  3189. } else {
  3190. $name = $name . '/' . $name;
  3191. }
  3192. $name = strtolower($name);
  3193. } else {
  3194. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3195. throw new \InvalidArgumentException(
  3196. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3197. );
  3198. }
  3199. }
  3200. $name = $io->askAndValidate(
  3201. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3202. function ($value) use ($name) {
  3203. if (null === $value) {
  3204. return $name;
  3205. }
  3206. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3207. throw new \InvalidArgumentException(
  3208. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3209. );
  3210. }
  3211. return $value;
  3212. },
  3213. null,
  3214. $name
  3215. );
  3216. $input->setOption('name', $name);
  3217. $description = $input->getOption('description') ?: false;
  3218. $description = $io->ask(
  3219. 'Description [<comment>'.$description.'</comment>]: ',
  3220. $description
  3221. );
  3222. $input->setOption('description', $description);
  3223. if (null === $author = $input->getOption('author')) {
  3224. if (isset($git['user.name']) && isset($git['user.email'])) {
  3225. $author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
  3226. }
  3227. }
  3228. $self = $this;
  3229. $author = $io->askAndValidate(
  3230. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3231. function ($value) use ($self, $author) {
  3232. if ($value === 'n' || $value === 'no') {
  3233. return;
  3234. }
  3235. $value = $value ?: $author;
  3236. $author = $self->parseAuthorString($value);
  3237. return sprintf('%s <%s>', $author['name'], $author['email']);
  3238. },
  3239. null,
  3240. $author
  3241. );
  3242. $input->setOption('author', $author);
  3243. $minimumStability = $input->getOption('stability') ?: null;
  3244. $minimumStability = $io->askAndValidate(
  3245. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3246. function ($value) use ($self, $minimumStability) {
  3247. if (null === $value) {
  3248. return $minimumStability;
  3249. }
  3250. if (!isset(BasePackage::$stabilities[$value])) {
  3251. throw new \InvalidArgumentException(
  3252. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3253. implode(', ', array_keys(BasePackage::$stabilities))
  3254. );
  3255. }
  3256. return $value;
  3257. },
  3258. null,
  3259. $minimumStability
  3260. );
  3261. $input->setOption('stability', $minimumStability);
  3262. $type = $input->getOption('type') ?: false;
  3263. $type = $io->ask(
  3264. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3265. $type
  3266. );
  3267. $input->setOption('type', $type);
  3268. $license = $input->getOption('license') ?: false;
  3269. $license = $io->ask(
  3270. 'License [<comment>'.$license.'</comment>]: ',
  3271. $license
  3272. );
  3273. $input->setOption('license', $license);
  3274. $io->writeError(array('', 'Define your dependencies.', ''));
  3275. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3276. $requirements = array();
  3277. if ($io->askConfirmation($question, true)) {
  3278. $requirements = $this->determineRequirements($input, $output, $input->getOption('require'));
  3279. }
  3280. $input->setOption('require', $requirements);
  3281. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3282. $devRequirements = array();
  3283. if ($io->askConfirmation($question, true)) {
  3284. $devRequirements = $this->determineRequirements($input, $output, $input->getOption('require-dev'));
  3285. }
  3286. $input->setOption('require-dev', $devRequirements);
  3287. }
  3288. public function parseAuthorString($author)
  3289. {
  3290. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3291. if ($this->isValidEmail($match['email'])) {
  3292. return array(
  3293. 'name' => trim($match['name']),
  3294. 'email' => $match['email'],
  3295. );
  3296. }
  3297. }
  3298. throw new \InvalidArgumentException(
  3299. 'Invalid author string. Must be in the format: '.
  3300. 'John Smith <john@example.com>'
  3301. );
  3302. }
  3303. protected function findPackages($name)
  3304. {
  3305. return $this->getRepos()->search($name);
  3306. }
  3307. protected function getRepos()
  3308. {
  3309. if (!$this->repos) {
  3310. $this->repos = new CompositeRepository(array_merge(
  3311. array(new PlatformRepository),
  3312. RepositoryFactory::defaultRepos($this->getIO())
  3313. ));
  3314. }
  3315. return $this->repos;
  3316. }
  3317. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null)
  3318. {
  3319. if ($requires) {
  3320. $requires = $this->normalizeRequirements($requires);
  3321. $result = array();
  3322. $io = $this->getIO();
  3323. foreach ($requires as $requirement) {
  3324. if (!isset($requirement['version'])) {
  3325. $version = $this->findBestVersionForPackage($input, $requirement['name'], $phpVersion);
  3326. $requirement['version'] = $version;
  3327. $io->writeError(sprintf(
  3328. 'Using version <info>%s</info> for <info>%s</info>',
  3329. $requirement['version'],
  3330. $requirement['name']
  3331. ));
  3332. }
  3333. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3334. }
  3335. return $result;
  3336. }
  3337. $versionParser = new VersionParser();
  3338. $io = $this->getIO();
  3339. while (null !== $package = $io->ask('Search for a package: ')) {
  3340. $matches = $this->findPackages($package);
  3341. if (count($matches)) {
  3342. $exactMatch = null;
  3343. $choices = array();
  3344. foreach ($matches as $position => $foundPackage) {
  3345. $choices[] = sprintf(' <info>%5s</info> %s', "[$position]", $foundPackage['name']);
  3346. if ($foundPackage['name'] === $package) {
  3347. $exactMatch = true;
  3348. break;
  3349. }
  3350. }
  3351. if (!$exactMatch) {
  3352. $io->writeError(array(
  3353. '',
  3354. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3355. '',
  3356. ));
  3357. $io->writeError($choices);
  3358. $io->writeError('');
  3359. $validator = function ($selection) use ($matches, $versionParser) {
  3360. if ('' === $selection) {
  3361. return false;
  3362. }
  3363. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3364. $package = $matches[(int) $selection];
  3365. return $package['name'];
  3366. }
  3367. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3368. if (isset($packageMatches['version'])) {
  3369. $versionParser->parseConstraints($packageMatches['version']);
  3370. return $packageMatches['name'].' '.$packageMatches['version'];
  3371. }
  3372. return $packageMatches['name'];
  3373. }
  3374. throw new \Exception('Not a valid selection');
  3375. };
  3376. $package = $io->askAndValidate(
  3377. 'Enter package # to add, or the complete package name if it is not listed: ',
  3378. $validator,
  3379. 3,
  3380. false
  3381. );
  3382. }
  3383. if (false !== $package && false === strpos($package, ' ')) {
  3384. $validator = function ($input) {
  3385. $input = trim($input);
  3386. return $input ?: false;
  3387. };
  3388. $constraint = $io->askAndValidate(
  3389. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3390. $validator,
  3391. 3,
  3392. false
  3393. );
  3394. if (false === $constraint) {
  3395. $constraint = $this->findBestVersionForPackage($input, $package, $phpVersion);
  3396. $io->writeError(sprintf(
  3397. 'Using version <info>%s</info> for <info>%s</info>',
  3398. $constraint,
  3399. $package
  3400. ));
  3401. }
  3402. $package .= ' '.$constraint;
  3403. }
  3404. if (false !== $package) {
  3405. $requires[] = $package;
  3406. }
  3407. }
  3408. }
  3409. return $requires;
  3410. }
  3411. protected function formatAuthors($author)
  3412. {
  3413. return array($this->parseAuthorString($author));
  3414. }
  3415. protected function formatRequirements(array $requirements)
  3416. {
  3417. $requires = array();
  3418. $requirements = $this->normalizeRequirements($requirements);
  3419. foreach ($requirements as $requirement) {
  3420. $requires[$requirement['name']] = $requirement['version'];
  3421. }
  3422. return $requires;
  3423. }
  3424. protected function getGitConfig()
  3425. {
  3426. if (null !== $this->gitConfig) {
  3427. return $this->gitConfig;
  3428. }
  3429. $finder = new ExecutableFinder();
  3430. $gitBin = $finder->find('git');
  3431. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3432. $cmd->run();
  3433. if ($cmd->isSuccessful()) {
  3434. $this->gitConfig = array();
  3435. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3436. foreach ($matches as $match) {
  3437. $this->gitConfig[$match[1]] = $match[2];
  3438. }
  3439. return $this->gitConfig;
  3440. }
  3441. return $this->gitConfig = array();
  3442. }
  3443. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3444. {
  3445. if (!file_exists($ignoreFile)) {
  3446. return false;
  3447. }
  3448. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3449. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3450. foreach ($lines as $line) {
  3451. if (preg_match($pattern, $line)) {
  3452. return true;
  3453. }
  3454. }
  3455. return false;
  3456. }
  3457. protected function normalizeRequirements(array $requirements)
  3458. {
  3459. $parser = new VersionParser();
  3460. return $parser->parseNameVersionPairs($requirements);
  3461. }
  3462. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3463. {
  3464. $contents = "";
  3465. if (file_exists($ignoreFile)) {
  3466. $contents = file_get_contents($ignoreFile);
  3467. if ("\n" !== substr($contents, 0, -1)) {
  3468. $contents .= "\n";
  3469. }
  3470. }
  3471. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3472. }
  3473. protected function isValidEmail($email)
  3474. {
  3475. if (!function_exists('filter_var')) {
  3476. return true;
  3477. }
  3478. if (PHP_VERSION_ID < 50303) {
  3479. return true;
  3480. }
  3481. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3482. }
  3483. private function getPool(InputInterface $input)
  3484. {
  3485. if (!$this->pool) {
  3486. $this->pool = new Pool($this->getMinimumStability($input));
  3487. $this->pool->addRepository($this->getRepos());
  3488. }
  3489. return $this->pool;
  3490. }
  3491. private function getMinimumStability(InputInterface $input)
  3492. {
  3493. if ($input->hasOption('stability')) {
  3494. return $input->getOption('stability') ?: 'stable';
  3495. }
  3496. $file = Factory::getComposerFile();
  3497. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3498. if (!empty($composer['minimum-stability'])) {
  3499. return $composer['minimum-stability'];
  3500. }
  3501. }
  3502. return 'stable';
  3503. }
  3504. private function findBestVersionForPackage(InputInterface $input, $name, $phpVersion)
  3505. {
  3506. $versionSelector = new VersionSelector($this->getPool($input));
  3507. $package = $versionSelector->findBestCandidate($name, null, $phpVersion);
  3508. if (!$package) {
  3509. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3510. throw new \InvalidArgumentException(sprintf(
  3511. 'Could not find package %s at any version matching your PHP version %s', $name, $phpVersion
  3512. ));
  3513. }
  3514. throw new \InvalidArgumentException(sprintf(
  3515. 'Could not find package %s at any version for your minimum-stability (%s). Check the package spelling or your minimum-stability',
  3516. $name,
  3517. $this->getMinimumStability($input)
  3518. ));
  3519. }
  3520. return $versionSelector->findRecommendedRequireVersion($package);
  3521. }
  3522. }
  3523. <?php
  3524. namespace Composer\Command;
  3525. use Composer\Installer;
  3526. use Composer\Plugin\CommandEvent;
  3527. use Composer\Plugin\PluginEvents;
  3528. use Symfony\Component\Console\Input\InputInterface;
  3529. use Symfony\Component\Console\Input\InputOption;
  3530. use Symfony\Component\Console\Input\InputArgument;
  3531. use Symfony\Component\Console\Output\OutputInterface;
  3532. class InstallCommand extends BaseCommand
  3533. {
  3534. protected function configure()
  3535. {
  3536. $this
  3537. ->setName('install')
  3538. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3539. ->setDefinition(array(
  3540. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3541. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3542. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3543. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3544. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3545. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3546. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3547. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3548. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3549. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3550. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3551. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3552. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3553. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3554. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3555. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3556. ))
  3557. ->setHelp(<<<EOT
  3558. The <info>install</info> command reads the composer.lock file from
  3559. the current directory, processes it, and downloads and installs all the
  3560. libraries and dependencies outlined in that file. If the file does not
  3561. exist it will look for composer.json and do the same.
  3562. <info>php composer.phar install</info>
  3563. EOT
  3564. )
  3565. ;
  3566. }
  3567. protected function execute(InputInterface $input, OutputInterface $output)
  3568. {
  3569. $io = $this->getIO();
  3570. if ($args = $input->getArgument('packages')) {
  3571. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3572. return 1;
  3573. }
  3574. if ($input->getOption('no-custom-installers')) {
  3575. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3576. $input->setOption('no-plugins', true);
  3577. }
  3578. if ($input->getOption('dev')) {
  3579. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3580. }
  3581. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3582. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3583. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3584. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3585. $install = Installer::create($io, $composer);
  3586. $config = $composer->getConfig();
  3587. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  3588. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3589. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3590. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  3591. $install
  3592. ->setDryRun($input->getOption('dry-run'))
  3593. ->setVerbose($input->getOption('verbose'))
  3594. ->setPreferSource($preferSource)
  3595. ->setPreferDist($preferDist)
  3596. ->setDevMode(!$input->getOption('no-dev'))
  3597. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3598. ->setRunScripts(!$input->getOption('no-scripts'))
  3599. ->setSkipSuggest($input->getOption('no-suggest'))
  3600. ->setOptimizeAutoloader($optimize)
  3601. ->setClassMapAuthoritative($authoritative)
  3602. ->setApcuAutoloader($apcu)
  3603. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3604. ;
  3605. if ($input->getOption('no-plugins')) {
  3606. $install->disablePlugins();
  3607. }
  3608. return $install->run();
  3609. }
  3610. }
  3611. <?php
  3612. namespace Composer\Command;
  3613. use Composer\Json\JsonFile;
  3614. use Composer\Plugin\CommandEvent;
  3615. use Composer\Plugin\PluginEvents;
  3616. use Composer\Package\PackageInterface;
  3617. use Composer\Repository\RepositoryInterface;
  3618. use Symfony\Component\Console\Helper\Table;
  3619. use Symfony\Component\Console\Input\InputInterface;
  3620. use Symfony\Component\Console\Input\InputOption;
  3621. use Symfony\Component\Console\Output\OutputInterface;
  3622. class LicensesCommand extends BaseCommand
  3623. {
  3624. protected function configure()
  3625. {
  3626. $this
  3627. ->setName('licenses')
  3628. ->setDescription('Show information about licenses of dependencies')
  3629. ->setDefinition(array(
  3630. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3631. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3632. ))
  3633. ->setHelp(<<<EOT
  3634. The license command displays detailed information about the licenses of
  3635. the installed dependencies.
  3636. EOT
  3637. )
  3638. ;
  3639. }
  3640. protected function execute(InputInterface $input, OutputInterface $output)
  3641. {
  3642. $composer = $this->getComposer();
  3643. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3644. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3645. $root = $composer->getPackage();
  3646. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3647. if ($input->getOption('no-dev')) {
  3648. $packages = $this->filterRequiredPackages($repo, $root);
  3649. } else {
  3650. $packages = $this->appendPackages($repo->getPackages(), array());
  3651. }
  3652. ksort($packages);
  3653. $io = $this->getIO();
  3654. switch ($format = $input->getOption('format')) {
  3655. case 'text':
  3656. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3657. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3658. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3659. $io->write('Dependencies:');
  3660. $io->write('');
  3661. $table = new Table($output);
  3662. $table->setStyle('compact');
  3663. $table->getStyle()->setVerticalBorderChar('');
  3664. $table->getStyle()->setCellRowContentFormat('%s ');
  3665. $table->setHeaders(array('Name', 'Version', 'License'));
  3666. foreach ($packages as $package) {
  3667. $table->addRow(array(
  3668. $package->getPrettyName(),
  3669. $package->getFullPrettyVersion(),
  3670. implode(', ', $package->getLicense()) ?: 'none',
  3671. ));
  3672. }
  3673. $table->render();
  3674. break;
  3675. case 'json':
  3676. $dependencies = array();
  3677. foreach ($packages as $package) {
  3678. $dependencies[$package->getPrettyName()] = array(
  3679. 'version' => $package->getFullPrettyVersion(),
  3680. 'license' => $package->getLicense(),
  3681. );
  3682. }
  3683. $io->write(JsonFile::encode(array(
  3684. 'name' => $root->getPrettyName(),
  3685. 'version' => $root->getFullPrettyVersion(),
  3686. 'license' => $root->getLicense(),
  3687. 'dependencies' => $dependencies,
  3688. )));
  3689. break;
  3690. default:
  3691. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  3692. }
  3693. }
  3694. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  3695. {
  3696. $requires = array_keys($package->getRequires());
  3697. $packageListNames = array_keys($bucket);
  3698. $packages = array_filter(
  3699. $repo->getPackages(),
  3700. function ($package) use ($requires, $packageListNames) {
  3701. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  3702. }
  3703. );
  3704. $bucket = $this->appendPackages($packages, $bucket);
  3705. foreach ($packages as $package) {
  3706. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  3707. }
  3708. return $bucket;
  3709. }
  3710. public function appendPackages(array $packages, array $bucket)
  3711. {
  3712. foreach ($packages as $package) {
  3713. $bucket[$package->getName()] = $package;
  3714. }
  3715. return $bucket;
  3716. }
  3717. }
  3718. <?php
  3719. namespace Composer\Command;
  3720. use Symfony\Component\Console\Input\InputInterface;
  3721. use Symfony\Component\Console\Input\InputArgument;
  3722. use Symfony\Component\Console\Input\ArrayInput;
  3723. use Symfony\Component\Console\Input\InputOption;
  3724. use Symfony\Component\Console\Output\OutputInterface;
  3725. class OutdatedCommand extends ShowCommand
  3726. {
  3727. protected function configure()
  3728. {
  3729. $this
  3730. ->setName('outdated')
  3731. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  3732. ->setDefinition(array(
  3733. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  3734. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  3735. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  3736. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  3737. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  3738. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  3739. ))
  3740. ->setHelp(<<<EOT
  3741. The outdated command is just a proxy for `composer show -l`
  3742. The color coding for dependency versions is as such:
  3743. - <info>green</info>: Dependency is in the latest version and is up to date.
  3744. - <comment>yellow</comment>: Dependency has a new version available that includes backwards
  3745. compatibility breaks according to semver, so upgrade when you can but it
  3746. may involve work.
  3747. - <highlight>red</highlight>: Dependency has a new version that is semver-compatible and you should upgrade it.
  3748. EOT
  3749. )
  3750. ;
  3751. }
  3752. protected function execute(InputInterface $input, OutputInterface $output)
  3753. {
  3754. $args = array(
  3755. 'show',
  3756. '--latest' => true,
  3757. );
  3758. if (!$input->getOption('all')) {
  3759. $args['--outdated'] = true;
  3760. }
  3761. if ($input->getOption('direct')) {
  3762. $args['--direct'] = true;
  3763. }
  3764. if ($input->getArgument('package')) {
  3765. $args['package'] = $input->getArgument('package');
  3766. }
  3767. if ($input->getOption('strict')) {
  3768. $args['--strict'] = true;
  3769. }
  3770. if ($input->getOption('minor-only')) {
  3771. $args['--minor-only'] = true;
  3772. }
  3773. $input = new ArrayInput($args);
  3774. return $this->getApplication()->run($input, $output);
  3775. }
  3776. public function isProxyCommand()
  3777. {
  3778. return true;
  3779. }
  3780. }
  3781. <?php
  3782. namespace Composer\Command;
  3783. use Symfony\Component\Console\Input\InputInterface;
  3784. use Symfony\Component\Console\Output\OutputInterface;
  3785. class ProhibitsCommand extends BaseDependencyCommand
  3786. {
  3787. protected function configure()
  3788. {
  3789. parent::configure();
  3790. $this
  3791. ->setName('prohibits')
  3792. ->setAliases(array('why-not'))
  3793. ->setDescription('Shows which packages prevent the given package from being installed')
  3794. ->setHelp(<<<EOT
  3795. Displays detailed information about why a package cannot be installed.
  3796. <info>php composer.phar prohibits composer/composer</info>
  3797. EOT
  3798. )
  3799. ;
  3800. }
  3801. protected function execute(InputInterface $input, OutputInterface $output)
  3802. {
  3803. return parent::doExecute($input, $output, true);
  3804. }
  3805. }
  3806. <?php
  3807. namespace Composer\Command;
  3808. use Composer\Config\JsonConfigSource;
  3809. use Composer\Installer;
  3810. use Composer\Plugin\CommandEvent;
  3811. use Composer\Plugin\PluginEvents;
  3812. use Composer\Json\JsonFile;
  3813. use Composer\Factory;
  3814. use Symfony\Component\Console\Input\InputInterface;
  3815. use Symfony\Component\Console\Input\InputOption;
  3816. use Symfony\Component\Console\Input\InputArgument;
  3817. use Symfony\Component\Console\Output\OutputInterface;
  3818. class RemoveCommand extends BaseCommand
  3819. {
  3820. protected function configure()
  3821. {
  3822. $this
  3823. ->setName('remove')
  3824. ->setDescription('Removes a package from the require or require-dev')
  3825. ->setDefinition(array(
  3826. new InputArgument('packages', InputArgument::IS_ARRAY, 'Packages that should be removed.'),
  3827. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  3828. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3829. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3830. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3831. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3832. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  3833. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  3834. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3835. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3836. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3837. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3838. ))
  3839. ->setHelp(<<<EOT
  3840. The <info>remove</info> command removes a package from the current
  3841. list of installed packages
  3842. <info>php composer.phar remove</info>
  3843. EOT
  3844. )
  3845. ;
  3846. }
  3847. protected function execute(InputInterface $input, OutputInterface $output)
  3848. {
  3849. $packages = $input->getArgument('packages');
  3850. $packages = array_map('strtolower', $packages);
  3851. $file = Factory::getComposerFile();
  3852. $jsonFile = new JsonFile($file);
  3853. $composer = $jsonFile->read();
  3854. $composerBackup = file_get_contents($jsonFile->getPath());
  3855. $json = new JsonConfigSource($jsonFile);
  3856. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  3857. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  3858. $io = $this->getIO();
  3859. if ($input->getOption('update-with-dependencies')) {
  3860. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  3861. }
  3862. foreach (array('require', 'require-dev') as $linkType) {
  3863. if (isset($composer[$linkType])) {
  3864. foreach ($composer[$linkType] as $name => $version) {
  3865. $composer[$linkType][strtolower($name)] = $name;
  3866. }
  3867. }
  3868. }
  3869. foreach ($packages as $package) {
  3870. if (isset($composer[$type][$package])) {
  3871. $json->removeLink($type, $composer[$type][$package]);
  3872. } elseif (isset($composer[$altType][$package])) {
  3873. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  3874. if ($io->isInteractive()) {
  3875. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  3876. $json->removeLink($altType, $composer[$altType][$package]);
  3877. }
  3878. }
  3879. } else {
  3880. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  3881. }
  3882. }
  3883. if ($input->getOption('no-update')) {
  3884. return 0;
  3885. }
  3886. $this->resetComposer();
  3887. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3888. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3889. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  3890. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3891. $install = Installer::create($io, $composer);
  3892. $updateDevMode = !$input->getOption('update-no-dev');
  3893. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  3894. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  3895. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  3896. $install
  3897. ->setVerbose($input->getOption('verbose'))
  3898. ->setDevMode($updateDevMode)
  3899. ->setOptimizeAutoloader($optimize)
  3900. ->setClassMapAuthoritative($authoritative)
  3901. ->setApcuAutoloader($apcu)
  3902. ->setUpdate(true)
  3903. ->setUpdateWhitelist($packages)
  3904. ->setWhitelistDependencies(!$input->getOption('no-update-with-dependencies'))
  3905. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3906. ->setRunScripts(!$input->getOption('no-scripts'))
  3907. ;
  3908. $exception = null;
  3909. try {
  3910. $status = $install->run();
  3911. } catch (\Exception $exception) {
  3912. $status = 1;
  3913. }
  3914. if ($status !== 0) {
  3915. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  3916. file_put_contents($jsonFile->getPath(), $composerBackup);
  3917. }
  3918. if ($exception) {
  3919. throw $exception;
  3920. }
  3921. return $status;
  3922. }
  3923. }
  3924. <?php
  3925. namespace Composer\Command;
  3926. use Symfony\Component\Console\Input\InputInterface;
  3927. use Symfony\Component\Console\Input\InputArgument;
  3928. use Symfony\Component\Console\Input\InputOption;
  3929. use Symfony\Component\Console\Output\OutputInterface;
  3930. use Composer\Factory;
  3931. use Composer\Installer;
  3932. use Composer\Json\JsonFile;
  3933. use Composer\Json\JsonManipulator;
  3934. use Composer\Package\Version\VersionParser;
  3935. use Composer\Plugin\CommandEvent;
  3936. use Composer\Plugin\PluginEvents;
  3937. use Composer\Repository\CompositeRepository;
  3938. use Composer\Repository\PlatformRepository;
  3939. class RequireCommand extends InitCommand
  3940. {
  3941. protected function configure()
  3942. {
  3943. $this
  3944. ->setName('require')
  3945. ->setDescription('Adds required packages to your composer.json and installs them')
  3946. ->setDefinition(array(
  3947. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Required package name optionally including a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3948. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  3949. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3950. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3951. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3952. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3953. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3954. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3955. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3956. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies.'),
  3957. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3958. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  3959. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  3960. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  3961. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3962. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3963. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3964. ))
  3965. ->setHelp(<<<EOT
  3966. The require command adds required packages to your composer.json and installs them.
  3967. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  3968. If you do not want to install the new dependencies immediately you can call it with --no-update
  3969. EOT
  3970. )
  3971. ;
  3972. }
  3973. protected function execute(InputInterface $input, OutputInterface $output)
  3974. {
  3975. $file = Factory::getComposerFile();
  3976. $io = $this->getIO();
  3977. $newlyCreated = !file_exists($file);
  3978. if (!file_exists($file) && !file_put_contents($file, "{\n}\n")) {
  3979. $io->writeError('<error>'.$file.' could not be created.</error>');
  3980. return 1;
  3981. }
  3982. if (!is_readable($file)) {
  3983. $io->writeError('<error>'.$file.' is not readable.</error>');
  3984. return 1;
  3985. }
  3986. if (!is_writable($file)) {
  3987. $io->writeError('<error>'.$file.' is not writable.</error>');
  3988. return 1;
  3989. }
  3990. if (filesize($file) === 0) {
  3991. file_put_contents($file, "{\n}\n");
  3992. }
  3993. $json = new JsonFile($file);
  3994. $composerBackup = file_get_contents($json->getPath());
  3995. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3996. $repos = $composer->getRepositoryManager()->getRepositories();
  3997. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  3998. $this->repos = new CompositeRepository(array_merge(
  3999. array(new PlatformRepository(array(), $platformOverrides)),
  4000. $repos
  4001. ));
  4002. $phpVersion = $this->repos->findPackage('php', '*')->getVersion();
  4003. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion);
  4004. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4005. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4006. $requirements = $this->formatRequirements($requirements);
  4007. $versionParser = new VersionParser();
  4008. foreach ($requirements as $constraint) {
  4009. $versionParser->parseConstraints($constraint);
  4010. }
  4011. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4012. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4013. $composerDefinition = $json->read();
  4014. foreach ($requirements as $package => $version) {
  4015. $composerDefinition[$requireKey][$package] = $version;
  4016. unset($composerDefinition[$removeKey][$package]);
  4017. }
  4018. $json->write($composerDefinition);
  4019. }
  4020. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4021. if ($input->getOption('no-update')) {
  4022. return 0;
  4023. }
  4024. $updateDevMode = !$input->getOption('update-no-dev');
  4025. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4026. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4027. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4028. $this->resetComposer();
  4029. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4030. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4031. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4032. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4033. $install = Installer::create($io, $composer);
  4034. $install
  4035. ->setVerbose($input->getOption('verbose'))
  4036. ->setPreferSource($input->getOption('prefer-source'))
  4037. ->setPreferDist($input->getOption('prefer-dist'))
  4038. ->setDevMode($updateDevMode)
  4039. ->setRunScripts(!$input->getOption('no-scripts'))
  4040. ->setSkipSuggest($input->getOption('no-suggest'))
  4041. ->setOptimizeAutoloader($optimize)
  4042. ->setClassMapAuthoritative($authoritative)
  4043. ->setApcuAutoloader($apcu)
  4044. ->setUpdate(true)
  4045. ->setUpdateWhitelist(array_keys($requirements))
  4046. ->setWhitelistDependencies($input->getOption('update-with-dependencies'))
  4047. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4048. ->setPreferStable($input->getOption('prefer-stable'))
  4049. ->setPreferLowest($input->getOption('prefer-lowest'))
  4050. ;
  4051. $exception = null;
  4052. try {
  4053. $status = $install->run();
  4054. } catch (\Exception $exception) {
  4055. $status = 1;
  4056. }
  4057. if ($status !== 0) {
  4058. if ($newlyCreated) {
  4059. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4060. unlink($json->getPath());
  4061. } else {
  4062. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4063. file_put_contents($json->getPath(), $composerBackup);
  4064. }
  4065. }
  4066. if ($exception) {
  4067. throw $exception;
  4068. }
  4069. return $status;
  4070. }
  4071. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4072. {
  4073. $contents = file_get_contents($json->getPath());
  4074. $manipulator = new JsonManipulator($contents);
  4075. foreach ($new as $package => $constraint) {
  4076. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4077. return false;
  4078. }
  4079. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4080. return false;
  4081. }
  4082. }
  4083. file_put_contents($json->getPath(), $manipulator->getContents());
  4084. return true;
  4085. }
  4086. protected function interact(InputInterface $input, OutputInterface $output)
  4087. {
  4088. return;
  4089. }
  4090. }
  4091. <?php
  4092. namespace Composer\Command;
  4093. use Composer\Script\Event as ScriptEvent;
  4094. use Composer\Script\ScriptEvents;
  4095. use Composer\Util\ProcessExecutor;
  4096. use Symfony\Component\Console\Input\InputInterface;
  4097. use Symfony\Component\Console\Input\InputOption;
  4098. use Symfony\Component\Console\Input\InputArgument;
  4099. use Symfony\Component\Console\Output\OutputInterface;
  4100. class RunScriptCommand extends BaseCommand
  4101. {
  4102. protected $scriptEvents = array(
  4103. ScriptEvents::PRE_INSTALL_CMD,
  4104. ScriptEvents::POST_INSTALL_CMD,
  4105. ScriptEvents::PRE_UPDATE_CMD,
  4106. ScriptEvents::POST_UPDATE_CMD,
  4107. ScriptEvents::PRE_STATUS_CMD,
  4108. ScriptEvents::POST_STATUS_CMD,
  4109. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4110. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4111. ScriptEvents::PRE_ARCHIVE_CMD,
  4112. ScriptEvents::POST_ARCHIVE_CMD,
  4113. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4114. ScriptEvents::POST_AUTOLOAD_DUMP,
  4115. );
  4116. protected function configure()
  4117. {
  4118. $this
  4119. ->setName('run-script')
  4120. ->setDescription('Run the scripts defined in composer.json.')
  4121. ->setDefinition(array(
  4122. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4123. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4124. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4125. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4126. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4127. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4128. ))
  4129. ->setHelp(<<<EOT
  4130. The <info>run-script</info> command runs scripts defined in composer.json:
  4131. <info>php composer.phar run-script post-update-cmd</info>
  4132. EOT
  4133. )
  4134. ;
  4135. }
  4136. protected function execute(InputInterface $input, OutputInterface $output)
  4137. {
  4138. if ($input->getOption('list')) {
  4139. return $this->listScripts();
  4140. } elseif (!$input->getArgument('script')) {
  4141. throw new \RuntimeException('Missing required argument "script"');
  4142. }
  4143. $script = $input->getArgument('script');
  4144. if (!in_array($script, $this->scriptEvents)) {
  4145. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4146. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4147. }
  4148. }
  4149. $composer = $this->getComposer();
  4150. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4151. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4152. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4153. if (!$hasListeners) {
  4154. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4155. }
  4156. $args = $input->getArgument('args');
  4157. if (!is_null($timeout = $input->getOption('timeout'))) {
  4158. if (!ctype_digit($timeout)) {
  4159. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4160. }
  4161. ProcessExecutor::setTimeout((int) $timeout);
  4162. }
  4163. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4164. }
  4165. protected function listScripts()
  4166. {
  4167. $scripts = $this->getComposer()->getPackage()->getScripts();
  4168. if (!count($scripts)) {
  4169. return 0;
  4170. }
  4171. $io = $this->getIO();
  4172. $io->writeError('<info>scripts:</info>');
  4173. foreach ($scripts as $name => $script) {
  4174. $io->write(' ' . $name);
  4175. }
  4176. return 0;
  4177. }
  4178. }
  4179. <?php
  4180. namespace Composer\Command;
  4181. use Symfony\Component\Console\Input\InputInterface;
  4182. use Symfony\Component\Console\Input\InputOption;
  4183. use Symfony\Component\Console\Input\InputArgument;
  4184. use Symfony\Component\Console\Output\OutputInterface;
  4185. class ScriptAliasCommand extends BaseCommand
  4186. {
  4187. private $script;
  4188. public function __construct($script)
  4189. {
  4190. $this->script = $script;
  4191. parent::__construct();
  4192. }
  4193. protected function configure()
  4194. {
  4195. $this
  4196. ->setName($this->script)
  4197. ->setDescription('Run the '.$this->script.' script as defined in composer.json.')
  4198. ->setDefinition(array(
  4199. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4200. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4201. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4202. ))
  4203. ->setHelp(<<<EOT
  4204. The <info>run-script</info> command runs scripts defined in composer.json:
  4205. <info>php composer.phar run-script post-update-cmd</info>
  4206. EOT
  4207. )
  4208. ;
  4209. }
  4210. protected function execute(InputInterface $input, OutputInterface $output)
  4211. {
  4212. $composer = $this->getComposer();
  4213. $args = $input->getArguments();
  4214. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4215. }
  4216. }
  4217. <?php
  4218. namespace Composer\Command;
  4219. use Composer\Factory;
  4220. use Symfony\Component\Console\Input\InputInterface;
  4221. use Symfony\Component\Console\Input\InputArgument;
  4222. use Symfony\Component\Console\Input\InputOption;
  4223. use Symfony\Component\Console\Output\OutputInterface;
  4224. use Composer\Repository\CompositeRepository;
  4225. use Composer\Repository\PlatformRepository;
  4226. use Composer\Repository\RepositoryInterface;
  4227. use Composer\Plugin\CommandEvent;
  4228. use Composer\Plugin\PluginEvents;
  4229. class SearchCommand extends BaseCommand
  4230. {
  4231. protected $matches;
  4232. protected $lowMatches = array();
  4233. protected $tokens;
  4234. protected $output;
  4235. protected $onlyName;
  4236. protected function configure()
  4237. {
  4238. $this
  4239. ->setName('search')
  4240. ->setDescription('Search for packages')
  4241. ->setDefinition(array(
  4242. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4243. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4244. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4245. ))
  4246. ->setHelp(<<<EOT
  4247. The search command searches for packages by its name
  4248. <info>php composer.phar search symfony composer</info>
  4249. EOT
  4250. )
  4251. ;
  4252. }
  4253. protected function execute(InputInterface $input, OutputInterface $output)
  4254. {
  4255. $platformRepo = new PlatformRepository;
  4256. $io = $this->getIO();
  4257. if (!($composer = $this->getComposer(false))) {
  4258. $composer = Factory::create($this->getIO(), array());
  4259. }
  4260. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4261. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4262. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4263. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4264. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4265. $onlyName = $input->getOption('only-name');
  4266. $type = $input->getOption('type') ?: null;
  4267. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4268. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4269. foreach ($results as $result) {
  4270. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4271. }
  4272. }
  4273. }
  4274. <?php
  4275. namespace Composer\Command;
  4276. use Composer\Composer;
  4277. use Composer\Factory;
  4278. use Composer\Config;
  4279. use Composer\Util\Filesystem;
  4280. use Composer\SelfUpdate\Keys;
  4281. use Composer\SelfUpdate\Versions;
  4282. use Composer\IO\IOInterface;
  4283. use Composer\Downloader\FilesystemException;
  4284. use Symfony\Component\Console\Input\InputInterface;
  4285. use Symfony\Component\Console\Input\InputOption;
  4286. use Symfony\Component\Console\Input\InputArgument;
  4287. use Symfony\Component\Console\Output\OutputInterface;
  4288. use Symfony\Component\Finder\Finder;
  4289. class SelfUpdateCommand extends BaseCommand
  4290. {
  4291. const HOMEPAGE = 'getcomposer.org';
  4292. const OLD_INSTALL_EXT = '-old.phar';
  4293. protected function configure()
  4294. {
  4295. $this
  4296. ->setName('self-update')
  4297. ->setAliases(array('selfupdate'))
  4298. ->setDescription('Updates composer.phar to the latest version.')
  4299. ->setDefinition(array(
  4300. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4301. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4302. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4303. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4304. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4305. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4306. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4307. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4308. ))
  4309. ->setHelp(<<<EOT
  4310. The <info>self-update</info> command checks getcomposer.org for newer
  4311. versions of composer and if found, installs the latest.
  4312. <info>php composer.phar self-update</info>
  4313. EOT
  4314. )
  4315. ;
  4316. }
  4317. protected function execute(InputInterface $input, OutputInterface $output)
  4318. {
  4319. $config = Factory::createConfig();
  4320. if ($config->get('disable-tls') === true) {
  4321. $baseUrl = 'http://' . self::HOMEPAGE;
  4322. } else {
  4323. $baseUrl = 'https://' . self::HOMEPAGE;
  4324. }
  4325. $io = $this->getIO();
  4326. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4327. $versionsUtil = new Versions($config, $remoteFilesystem);
  4328. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4329. if ($input->getOption($channel)) {
  4330. $versionsUtil->setChannel($channel);
  4331. }
  4332. }
  4333. $cacheDir = $config->get('cache-dir');
  4334. $rollbackDir = $config->get('data-dir');
  4335. $home = $config->get('home');
  4336. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4337. if ($input->getOption('update-keys')) {
  4338. return $this->fetchKeys($io, $config);
  4339. }
  4340. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4341. if (!is_writable($tmpDir)) {
  4342. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4343. }
  4344. if ($input->getOption('rollback')) {
  4345. return $this->rollback($output, $rollbackDir, $localFilename);
  4346. }
  4347. $latest = $versionsUtil->getLatest();
  4348. $latestVersion = $latest['version'];
  4349. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4350. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4351. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4352. return 1;
  4353. }
  4354. if (Composer::VERSION === $updateVersion) {
  4355. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4356. if ($input->getOption('clean-backups')) {
  4357. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4358. }
  4359. return 0;
  4360. }
  4361. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4362. $backupFile = sprintf(
  4363. '%s/%s-%s%s',
  4364. $rollbackDir,
  4365. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4366. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4367. self::OLD_INSTALL_EXT
  4368. );
  4369. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4370. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4371. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4372. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4373. $io->writeError(' ', false);
  4374. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4375. $io->writeError('');
  4376. if (!file_exists($tempFilename) || !$signature) {
  4377. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4378. return 1;
  4379. }
  4380. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4381. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4382. } else {
  4383. if (!extension_loaded('openssl')) {
  4384. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4385. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4386. }
  4387. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4388. if (!file_exists($sigFile)) {
  4389. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4390. -----BEGIN PUBLIC KEY-----
  4391. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4392. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4393. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4394. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4395. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4396. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4397. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4398. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4399. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4400. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4401. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4402. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4403. -----END PUBLIC KEY-----
  4404. DEVPUBKEY
  4405. );
  4406. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4407. -----BEGIN PUBLIC KEY-----
  4408. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4409. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4410. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4411. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4412. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4413. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4414. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4415. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4416. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4417. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4418. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4419. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4420. -----END PUBLIC KEY-----
  4421. TAGSPUBKEY
  4422. );
  4423. }
  4424. $pubkeyid = openssl_pkey_get_public($sigFile);
  4425. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4426. if (!in_array('SHA384', openssl_get_md_methods())) {
  4427. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4428. }
  4429. $signature = json_decode($signature, true);
  4430. $signature = base64_decode($signature['sha384']);
  4431. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4432. openssl_free_key($pubkeyid);
  4433. if (!$verified) {
  4434. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  4435. }
  4436. }
  4437. if ($input->getOption('clean-backups')) {
  4438. $this->cleanBackups($rollbackDir);
  4439. }
  4440. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4441. @unlink($tempFilename);
  4442. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4443. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4444. return 1;
  4445. }
  4446. if (file_exists($backupFile)) {
  4447. $io->writeError('Use <info>composer self-update --rollback</info> to return to version '.Composer::VERSION);
  4448. } else {
  4449. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4450. }
  4451. }
  4452. protected function fetchKeys(IOInterface $io, Config $config)
  4453. {
  4454. if (!$io->isInteractive()) {
  4455. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4456. }
  4457. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4458. $validator = function ($value) {
  4459. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4460. throw new \UnexpectedValueException('Invalid input');
  4461. }
  4462. return trim($value)."\n";
  4463. };
  4464. $devKey = '';
  4465. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4466. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4467. while ($line = $io->ask('')) {
  4468. $devKey .= trim($line)."\n";
  4469. if (trim($line) === '-----END PUBLIC KEY-----') {
  4470. break;
  4471. }
  4472. }
  4473. }
  4474. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4475. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4476. $tagsKey = '';
  4477. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4478. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4479. while ($line = $io->ask('')) {
  4480. $tagsKey .= trim($line)."\n";
  4481. if (trim($line) === '-----END PUBLIC KEY-----') {
  4482. break;
  4483. }
  4484. }
  4485. }
  4486. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4487. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4488. $io->write('Public keys stored in '.$config->get('home'));
  4489. }
  4490. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4491. {
  4492. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4493. if (!$rollbackVersion) {
  4494. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4495. }
  4496. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4497. if (!is_file($oldFile)) {
  4498. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4499. }
  4500. if (!is_readable($oldFile)) {
  4501. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4502. }
  4503. $io = $this->getIO();
  4504. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4505. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4506. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4507. return 1;
  4508. }
  4509. return 0;
  4510. }
  4511. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4512. {
  4513. try {
  4514. @chmod($newFilename, fileperms($localFilename));
  4515. if (!ini_get('phar.readonly')) {
  4516. $phar = new \Phar($newFilename);
  4517. unset($phar);
  4518. }
  4519. if ($backupTarget && file_exists($localFilename)) {
  4520. @copy($localFilename, $backupTarget);
  4521. }
  4522. rename($newFilename, $localFilename);
  4523. return null;
  4524. } catch (\Exception $e) {
  4525. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4526. throw $e;
  4527. }
  4528. return $e;
  4529. }
  4530. }
  4531. protected function cleanBackups($rollbackDir, $except = null)
  4532. {
  4533. $finder = $this->getOldInstallationFinder($rollbackDir);
  4534. $io = $this->getIO();
  4535. $fs = new Filesystem;
  4536. foreach ($finder as $file) {
  4537. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4538. continue;
  4539. }
  4540. $file = (string) $file;
  4541. $io->writeError('<info>Removing: '.$file.'</info>');
  4542. $fs->remove($file);
  4543. }
  4544. }
  4545. protected function getLastBackupVersion($rollbackDir)
  4546. {
  4547. $finder = $this->getOldInstallationFinder($rollbackDir);
  4548. $finder->sortByName();
  4549. $files = iterator_to_array($finder);
  4550. if (count($files)) {
  4551. return basename(end($files), self::OLD_INSTALL_EXT);
  4552. }
  4553. return false;
  4554. }
  4555. protected function getOldInstallationFinder($rollbackDir)
  4556. {
  4557. $finder = Finder::create()
  4558. ->depth(0)
  4559. ->files()
  4560. ->name('*' . self::OLD_INSTALL_EXT)
  4561. ->in($rollbackDir);
  4562. return $finder;
  4563. }
  4564. }
  4565. <?php
  4566. namespace Composer\Command;
  4567. use Composer\DependencyResolver\Pool;
  4568. use Composer\DependencyResolver\DefaultPolicy;
  4569. use Composer\Package\CompletePackageInterface;
  4570. use Composer\Package\Version\VersionParser;
  4571. use Composer\Package\BasePackage;
  4572. use Composer\Package\Version\VersionSelector;
  4573. use Composer\Plugin\CommandEvent;
  4574. use Composer\Plugin\PluginEvents;
  4575. use Composer\Package\PackageInterface;
  4576. use Composer\Semver\Constraint\ConstraintInterface;
  4577. use Composer\Util\Platform;
  4578. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4579. use Symfony\Component\Console\Input\InputInterface;
  4580. use Symfony\Component\Console\Input\InputArgument;
  4581. use Symfony\Component\Console\Input\InputOption;
  4582. use Symfony\Component\Console\Output\OutputInterface;
  4583. use Composer\Repository\ArrayRepository;
  4584. use Composer\Repository\CompositeRepository;
  4585. use Composer\Repository\ComposerRepository;
  4586. use Composer\Repository\PlatformRepository;
  4587. use Composer\Repository\RepositoryInterface;
  4588. use Composer\Repository\RepositoryFactory;
  4589. use Composer\Spdx\SpdxLicenses;
  4590. use Composer\Composer;
  4591. use Composer\Semver\Semver;
  4592. class ShowCommand extends BaseCommand
  4593. {
  4594. protected $versionParser;
  4595. protected $colors;
  4596. private $pool;
  4597. protected function configure()
  4598. {
  4599. $this
  4600. ->setName('show')
  4601. ->setAliases(array('info'))
  4602. ->setDescription('Show information about packages')
  4603. ->setDefinition(array(
  4604. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4605. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4606. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  4607. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  4608. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4609. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4610. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4611. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4612. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4613. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4614. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  4615. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  4616. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4617. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4618. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4619. ))
  4620. ->setHelp(<<<EOT
  4621. The show command displays detailed information about a package, or
  4622. lists all packages available.
  4623. EOT
  4624. )
  4625. ;
  4626. }
  4627. protected function execute(InputInterface $input, OutputInterface $output)
  4628. {
  4629. $this->versionParser = new VersionParser;
  4630. if ($input->getOption('tree')) {
  4631. $this->initStyles($output);
  4632. }
  4633. $composer = $this->getComposer(false);
  4634. $io = $this->getIO();
  4635. if ($input->getOption('installed')) {
  4636. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  4637. }
  4638. if ($input->getOption('outdated')) {
  4639. $input->setOption('latest', true);
  4640. }
  4641. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  4642. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  4643. return 1;
  4644. }
  4645. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  4646. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  4647. return 1;
  4648. }
  4649. $platformOverrides = array();
  4650. if ($composer) {
  4651. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4652. }
  4653. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  4654. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  4655. if ($input->getOption('self')) {
  4656. $package = $this->getComposer()->getPackage();
  4657. $repos = $installedRepo = new ArrayRepository(array($package));
  4658. } elseif ($input->getOption('platform')) {
  4659. $repos = $installedRepo = $platformRepo;
  4660. } elseif ($input->getOption('available')) {
  4661. $installedRepo = $platformRepo;
  4662. if ($composer) {
  4663. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  4664. } else {
  4665. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4666. $repos = new CompositeRepository($defaultRepos);
  4667. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4668. }
  4669. } elseif ($input->getOption('all') && $composer) {
  4670. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4671. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4672. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4673. } elseif ($input->getOption('all')) {
  4674. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4675. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4676. $installedRepo = $platformRepo;
  4677. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  4678. } else {
  4679. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4680. }
  4681. if ($composer) {
  4682. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  4683. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4684. }
  4685. if ($input->getOption('latest') && null === $composer) {
  4686. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  4687. $input->setOption('latest', false);
  4688. }
  4689. $packageFilter = $input->getArgument('package');
  4690. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  4691. if (empty($package)) {
  4692. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  4693. if (empty($package)) {
  4694. $options = $input->getOptions();
  4695. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  4696. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  4697. }
  4698. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  4699. return;
  4700. }
  4701. } else {
  4702. $versions = array($package->getPrettyVersion() => $package->getVersion());
  4703. }
  4704. if ($input->getOption('tree')) {
  4705. $this->displayPackageTree($package, $installedRepo, $repos);
  4706. } else {
  4707. $latestPackage = null;
  4708. if ($input->getOption('latest')) {
  4709. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  4710. }
  4711. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  4712. $this->printLinks($package, 'requires');
  4713. $this->printLinks($package, 'devRequires', 'requires (dev)');
  4714. if ($package->getSuggests()) {
  4715. $io->write("\n<info>suggests</info>");
  4716. foreach ($package->getSuggests() as $suggested => $reason) {
  4717. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  4718. }
  4719. }
  4720. $this->printLinks($package, 'provides');
  4721. $this->printLinks($package, 'conflicts');
  4722. $this->printLinks($package, 'replaces');
  4723. }
  4724. return;
  4725. }
  4726. if ($input->getOption('tree')) {
  4727. $rootRequires = $this->getRootRequires();
  4728. foreach ($installedRepo->getPackages() as $package) {
  4729. if (in_array($package->getName(), $rootRequires, true)) {
  4730. $this->displayPackageTree($package, $installedRepo, $repos);
  4731. }
  4732. }
  4733. return 0;
  4734. }
  4735. if ($repos instanceof CompositeRepository) {
  4736. $repos = $repos->getRepositories();
  4737. } elseif (!is_array($repos)) {
  4738. $repos = array($repos);
  4739. }
  4740. $packages = array();
  4741. if (null !== $packageFilter) {
  4742. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  4743. }
  4744. $packageListFilter = array();
  4745. if ($input->getOption('direct')) {
  4746. $packageListFilter = $this->getRootRequires();
  4747. }
  4748. foreach ($repos as $repo) {
  4749. if ($repo === $platformRepo) {
  4750. $type = '<info>platform</info>:';
  4751. } elseif (
  4752. $repo === $installedRepo
  4753. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  4754. ) {
  4755. $type = '<info>installed</info>:';
  4756. } else {
  4757. $type = '<comment>available</comment>:';
  4758. }
  4759. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  4760. foreach ($repo->getProviderNames() as $name) {
  4761. if (!$packageFilter || preg_match($packageFilter, $name)) {
  4762. $packages[$type][$name] = $name;
  4763. }
  4764. }
  4765. } else {
  4766. foreach ($repo->getPackages() as $package) {
  4767. if (!isset($packages[$type][$package->getName()])
  4768. || !is_object($packages[$type][$package->getName()])
  4769. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  4770. ) {
  4771. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  4772. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  4773. $packages[$type][$package->getName()] = $package;
  4774. }
  4775. }
  4776. }
  4777. }
  4778. }
  4779. }
  4780. $showAllTypes = $input->getOption('all');
  4781. $showLatest = $input->getOption('latest');
  4782. $showMinorOnly = $input->getOption('minor-only');
  4783. $indent = $showAllTypes ? ' ' : '';
  4784. $latestPackages = array();
  4785. foreach (array('<info>platform</info>:' => true, '<comment>available</comment>:' => false, '<info>installed</info>:' => true) as $type => $showVersion) {
  4786. if (isset($packages[$type])) {
  4787. if ($showAllTypes) {
  4788. $io->write($type);
  4789. }
  4790. ksort($packages[$type]);
  4791. $nameLength = $versionLength = $latestLength = 0;
  4792. foreach ($packages[$type] as $package) {
  4793. if (is_object($package)) {
  4794. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  4795. if ($showVersion) {
  4796. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  4797. if ($showLatest) {
  4798. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  4799. if ($latestPackage === false) {
  4800. continue;
  4801. }
  4802. $latestPackages[$package->getPrettyName()] = $latestPackage;
  4803. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  4804. }
  4805. }
  4806. } else {
  4807. $nameLength = max($nameLength, strlen($package));
  4808. }
  4809. }
  4810. list($width) = $this->getApplication()->getTerminalDimensions();
  4811. if (null === $width) {
  4812. $width = PHP_INT_MAX;
  4813. }
  4814. if (Platform::isWindows()) {
  4815. $width--;
  4816. }
  4817. if ($input->getOption('path') && null === $composer) {
  4818. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  4819. $input->setOption('path', false);
  4820. }
  4821. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  4822. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion && ($nameLength + $versionLength + 3 <= $width);
  4823. $writeLatest = $writeVersion && $showLatest && ($nameLength + $versionLength + $latestLength + 3 <= $width);
  4824. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path') && ($nameLength + $versionLength + $latestLength + 24 <= $width);
  4825. $hasOutdatedPackages = false;
  4826. foreach ($packages[$type] as $package) {
  4827. if (is_object($package)) {
  4828. $latestPackackage = null;
  4829. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  4830. $latestPackackage = $latestPackages[$package->getPrettyName()];
  4831. }
  4832. if ($input->getOption('outdated') && $latestPackackage && $latestPackackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackackage->isAbandoned()) {
  4833. continue;
  4834. } elseif ($input->getOption('outdated')) {
  4835. $hasOutdatedPackages = true;
  4836. }
  4837. $io->write($indent . str_pad($package->getPrettyName(), $nameLength, ' '), false);
  4838. if ($writeVersion) {
  4839. $io->write(' ' . str_pad($package->getFullPrettyVersion(), $versionLength, ' '), false);
  4840. }
  4841. if ($writeLatest && $latestPackackage) {
  4842. $latestVersion = $latestPackackage->getFullPrettyVersion();
  4843. $style = $this->getVersionStyle($latestPackackage, $package);
  4844. $io->write(' <'.$style.'>' . str_pad($latestVersion, $latestLength, ' ') . '</'.$style.'>', false);
  4845. }
  4846. if ($writeDescription) {
  4847. $description = strtok($package->getDescription(), "\r\n");
  4848. $remaining = $width - $nameLength - $versionLength - 4;
  4849. if ($writeLatest) {
  4850. $remaining -= $latestLength;
  4851. }
  4852. if (strlen($description) > $remaining) {
  4853. $description = substr($description, 0, $remaining - 3) . '...';
  4854. }
  4855. $io->write(' ' . $description, false);
  4856. }
  4857. if ($writePath) {
  4858. $path = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  4859. $io->write(' ' . $path, false);
  4860. }
  4861. if ($latestPackackage && $latestPackackage->isAbandoned()) {
  4862. $replacement = (is_string($latestPackackage->getReplacementPackage()))
  4863. ? 'Use ' . $latestPackackage->getReplacementPackage() . ' instead'
  4864. : 'No replacement was suggested';
  4865. $io->writeError('');
  4866. $io->writeError(
  4867. sprintf(
  4868. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  4869. $package->getPrettyName(),
  4870. $replacement
  4871. ),
  4872. false
  4873. );
  4874. }
  4875. } else {
  4876. $io->write($indent . $package, false);
  4877. }
  4878. $io->write('');
  4879. }
  4880. if ($showAllTypes) {
  4881. $io->write('');
  4882. }
  4883. if ($input->getOption('strict') && $hasOutdatedPackages) {
  4884. return 1;
  4885. }
  4886. }
  4887. }
  4888. }
  4889. protected function getRootRequires()
  4890. {
  4891. $rootPackage = $this->getComposer()->getPackage();
  4892. return array_map(
  4893. 'strtolower',
  4894. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  4895. );
  4896. }
  4897. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  4898. {
  4899. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  4900. return 'info';
  4901. }
  4902. $constraint = $package->getVersion();
  4903. if (0 !== strpos($constraint, 'dev-')) {
  4904. $constraint = '^'.$constraint;
  4905. }
  4906. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  4907. return 'highlight';
  4908. }
  4909. return 'comment';
  4910. }
  4911. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  4912. {
  4913. $name = strtolower($name);
  4914. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  4915. $policy = new DefaultPolicy();
  4916. $pool = new Pool('dev');
  4917. $pool->addRepository($repos);
  4918. $matchedPackage = null;
  4919. $versions = array();
  4920. $matches = $pool->whatProvides($name, $constraint);
  4921. foreach ($matches as $index => $package) {
  4922. if ($package->getName() !== $name) {
  4923. unset($matches[$index]);
  4924. continue;
  4925. }
  4926. if (null === $version && $installedRepo->hasPackage($package)) {
  4927. $matchedPackage = $package;
  4928. }
  4929. $versions[$package->getPrettyVersion()] = $package->getVersion();
  4930. $matches[$index] = $package->getId();
  4931. }
  4932. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  4933. $matchedPackage = $pool->literalToPackage($preferred[0]);
  4934. }
  4935. return array($matchedPackage, $versions);
  4936. }
  4937. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  4938. {
  4939. $io = $this->getIO();
  4940. $io->write('<info>name</info> : ' . $package->getPrettyName());
  4941. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  4942. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  4943. $this->printVersions($package, $versions, $installedRepo);
  4944. if ($latestPackage) {
  4945. $style = $this->getVersionStyle($latestPackage, $package);
  4946. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  4947. } else {
  4948. $latestPackage = $package;
  4949. }
  4950. $io->write('<info>type</info> : ' . $package->getType());
  4951. $this->printLicenses($package);
  4952. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  4953. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  4954. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  4955. if ($latestPackage->isAbandoned()) {
  4956. $replacement = ($latestPackage->getReplacementPackage() !== null)
  4957. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  4958. : null;
  4959. $io->writeError(
  4960. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  4961. );
  4962. }
  4963. if ($package->getSupport()) {
  4964. $io->write("\n<info>support</info>");
  4965. foreach ($package->getSupport() as $type => $value) {
  4966. $io->write('<comment>' . $type . '</comment> : '.$value);
  4967. }
  4968. }
  4969. if ($package->getAutoload()) {
  4970. $io->write("\n<info>autoload</info>");
  4971. foreach ($package->getAutoload() as $type => $autoloads) {
  4972. $io->write('<comment>' . $type . '</comment>');
  4973. if ($type === 'psr-0') {
  4974. foreach ($autoloads as $name => $path) {
  4975. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  4976. }
  4977. } elseif ($type === 'psr-4') {
  4978. foreach ($autoloads as $name => $path) {
  4979. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  4980. }
  4981. } elseif ($type === 'classmap') {
  4982. $io->write(implode(', ', $autoloads));
  4983. }
  4984. }
  4985. if ($package->getIncludePaths()) {
  4986. $io->write('<comment>include-path</comment>');
  4987. $io->write(implode(', ', $package->getIncludePaths()));
  4988. }
  4989. }
  4990. }
  4991. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  4992. {
  4993. uasort($versions, 'version_compare');
  4994. $versions = array_keys(array_reverse($versions));
  4995. if ($installedRepo->hasPackage($package)) {
  4996. $installedVersion = $package->getPrettyVersion();
  4997. $key = array_search($installedVersion, $versions);
  4998. if (false !== $key) {
  4999. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5000. }
  5001. }
  5002. $versions = implode(', ', $versions);
  5003. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5004. }
  5005. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5006. {
  5007. $title = $title ?: $linkType;
  5008. $io = $this->getIO();
  5009. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5010. $io->write("\n<info>" . $title . "</info>");
  5011. foreach ($links as $link) {
  5012. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5013. }
  5014. }
  5015. }
  5016. protected function printLicenses(CompletePackageInterface $package)
  5017. {
  5018. $spdxLicenses = new SpdxLicenses();
  5019. $licenses = $package->getLicense();
  5020. $io = $this->getIO();
  5021. foreach ($licenses as $licenseId) {
  5022. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5023. if (!$license) {
  5024. $out = $licenseId;
  5025. } else {
  5026. if ($license[1] === true) {
  5027. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5028. } else {
  5029. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5030. }
  5031. }
  5032. $io->write('<info>license</info> : ' . $out);
  5033. }
  5034. }
  5035. protected function initStyles(OutputInterface $output)
  5036. {
  5037. $this->colors = array(
  5038. 'green',
  5039. 'yellow',
  5040. 'cyan',
  5041. 'magenta',
  5042. 'blue',
  5043. );
  5044. foreach ($this->colors as $color) {
  5045. $style = new OutputFormatterStyle($color);
  5046. $output->getFormatter()->setStyle($color, $style);
  5047. }
  5048. }
  5049. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  5050. {
  5051. $io = $this->getIO();
  5052. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  5053. $io->write(' ' . $package->getPrettyVersion(), false);
  5054. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  5055. if (is_object($package)) {
  5056. $requires = $package->getRequires();
  5057. $treeBar = '├';
  5058. $j = 0;
  5059. $total = count($requires);
  5060. foreach ($requires as $requireName => $require) {
  5061. $j++;
  5062. if ($j == 0) {
  5063. $this->writeTreeLine($treeBar);
  5064. }
  5065. if ($j == $total) {
  5066. $treeBar = 'â””';
  5067. }
  5068. $level = 1;
  5069. $color = $this->colors[$level];
  5070. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  5071. $this->writeTreeLine($info);
  5072. $treeBar = str_replace('â””', ' ', $treeBar);
  5073. $packagesInTree = array($package->getName(), $requireName);
  5074. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  5075. }
  5076. }
  5077. }
  5078. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  5079. {
  5080. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5081. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  5082. if (is_object($package)) {
  5083. $requires = $package->getRequires();
  5084. $treeBar = $previousTreeBar . ' ├';
  5085. $i = 0;
  5086. $total = count($requires);
  5087. foreach ($requires as $requireName => $require) {
  5088. $currentTree = $packagesInTree;
  5089. $i++;
  5090. if ($i == $total) {
  5091. $treeBar = $previousTreeBar . ' â””';
  5092. }
  5093. $colorIdent = $level % count($this->colors);
  5094. $color = $this->colors[$colorIdent];
  5095. $circularWarn = in_array($requireName, $currentTree) ? '(circular dependency aborted here)' : '';
  5096. $info = rtrim(sprintf('%s──<%s>%s</%s> %s %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint(), $circularWarn));
  5097. $this->writeTreeLine($info);
  5098. $treeBar = str_replace('â””', ' ', $treeBar);
  5099. if (!in_array($requireName, $currentTree)) {
  5100. $currentTree[] = $requireName;
  5101. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $currentTree, $treeBar, $level + 1);
  5102. }
  5103. }
  5104. }
  5105. }
  5106. private function writeTreeLine($line)
  5107. {
  5108. $io = $this->getIO();
  5109. if (!$io->isDecorated()) {
  5110. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5111. }
  5112. $io->write($line);
  5113. }
  5114. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5115. {
  5116. $name = $package->getName();
  5117. $versionSelector = new VersionSelector($this->getPool($composer));
  5118. $stability = $composer->getPackage()->getMinimumStability();
  5119. $flags = $composer->getPackage()->getStabilityFlags();
  5120. if (isset($flags[$name])) {
  5121. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5122. }
  5123. $bestStability = $stability;
  5124. if ($composer->getPackage()->getPreferStable()) {
  5125. $bestStability = $package->getStability();
  5126. }
  5127. $targetVersion = null;
  5128. if (0 === strpos($package->getVersion(), 'dev-')) {
  5129. $targetVersion = $package->getVersion();
  5130. }
  5131. if ($targetVersion === null && $minorOnly) {
  5132. $targetVersion = '^' . $package->getVersion();
  5133. }
  5134. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5135. }
  5136. private function getPool(Composer $composer)
  5137. {
  5138. if (!$this->pool) {
  5139. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5140. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5141. }
  5142. return $this->pool;
  5143. }
  5144. }
  5145. <?php
  5146. namespace Composer\Command;
  5147. use Symfony\Component\Console\Input\InputInterface;
  5148. use Symfony\Component\Console\Input\InputOption;
  5149. use Symfony\Component\Console\Output\OutputInterface;
  5150. use Composer\Downloader\ChangeReportInterface;
  5151. use Composer\Downloader\DvcsDownloaderInterface;
  5152. use Composer\Downloader\VcsCapableDownloaderInterface;
  5153. use Composer\Package\Dumper\ArrayDumper;
  5154. use Composer\Package\Version\VersionGuesser;
  5155. use Composer\Package\Version\VersionParser;
  5156. use Composer\Plugin\CommandEvent;
  5157. use Composer\Plugin\PluginEvents;
  5158. use Composer\Script\ScriptEvents;
  5159. use Composer\Util\ProcessExecutor;
  5160. class StatusCommand extends BaseCommand
  5161. {
  5162. const EXIT_CODE_ERRORS = 1;
  5163. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5164. const EXIT_CODE_VERSION_CHANGES = 4;
  5165. protected function configure()
  5166. {
  5167. $this
  5168. ->setName('status')
  5169. ->setDescription('Show a list of locally modified packages')
  5170. ->setDefinition(array(
  5171. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5172. ))
  5173. ->setHelp(<<<EOT
  5174. The status command displays a list of dependencies that have
  5175. been modified locally.
  5176. EOT
  5177. )
  5178. ;
  5179. }
  5180. protected function execute(InputInterface $input, OutputInterface $output)
  5181. {
  5182. $composer = $this->getComposer();
  5183. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5184. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5185. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5186. $dm = $composer->getDownloadManager();
  5187. $im = $composer->getInstallationManager();
  5188. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5189. $errors = array();
  5190. $io = $this->getIO();
  5191. $unpushedChanges = array();
  5192. $vcsVersionChanges = array();
  5193. $parser = new VersionParser;
  5194. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5195. $dumper = new ArrayDumper;
  5196. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5197. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5198. $targetDir = $im->getInstallPath($package);
  5199. if ($downloader instanceof ChangeReportInterface) {
  5200. if (is_link($targetDir)) {
  5201. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5202. }
  5203. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5204. $errors[$targetDir] = $changes;
  5205. }
  5206. }
  5207. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5208. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5209. switch ($package->getInstallationSource()) {
  5210. case 'source':
  5211. $previousRef = $package->getSourceReference();
  5212. break;
  5213. case 'dist':
  5214. $previousRef = $package->getDistReference();
  5215. break;
  5216. default:
  5217. $previousRef = null;
  5218. }
  5219. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5220. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5221. $vcsVersionChanges[$targetDir] = array(
  5222. 'previous' => array(
  5223. 'version' => $package->getPrettyVersion(),
  5224. 'ref' => $previousRef
  5225. ),
  5226. 'current' => array(
  5227. 'version' => $currentVersion['pretty_version'],
  5228. 'ref' => $currentVersion['commit'],
  5229. ),
  5230. );
  5231. }
  5232. }
  5233. }
  5234. if ($downloader instanceof DvcsDownloaderInterface) {
  5235. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5236. $unpushedChanges[$targetDir] = $unpushed;
  5237. }
  5238. }
  5239. }
  5240. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5241. $io->writeError('<info>No local changes</info>');
  5242. return 0;
  5243. }
  5244. if ($errors) {
  5245. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5246. foreach ($errors as $path => $changes) {
  5247. if ($input->getOption('verbose')) {
  5248. $indentedChanges = implode("\n", array_map(function ($line) {
  5249. return ' ' . ltrim($line);
  5250. }, explode("\n", $changes)));
  5251. $io->write('<info>'.$path.'</info>:');
  5252. $io->write($indentedChanges);
  5253. } else {
  5254. $io->write($path);
  5255. }
  5256. }
  5257. }
  5258. if ($unpushedChanges) {
  5259. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5260. foreach ($unpushedChanges as $path => $changes) {
  5261. if ($input->getOption('verbose')) {
  5262. $indentedChanges = implode("\n", array_map(function ($line) {
  5263. return ' ' . ltrim($line);
  5264. }, explode("\n", $changes)));
  5265. $io->write('<info>'.$path.'</info>:');
  5266. $io->write($indentedChanges);
  5267. } else {
  5268. $io->write($path);
  5269. }
  5270. }
  5271. }
  5272. if ($vcsVersionChanges) {
  5273. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5274. foreach ($vcsVersionChanges as $path => $changes) {
  5275. if ($input->getOption('verbose')) {
  5276. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5277. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5278. if ($io->isVeryVerbose()) {
  5279. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5280. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5281. }
  5282. $io->write('<info>'.$path.'</info>:');
  5283. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5284. } else {
  5285. $io->write($path);
  5286. }
  5287. }
  5288. }
  5289. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5290. $io->writeError('Use --verbose (-v) to see a list of files');
  5291. }
  5292. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5293. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5294. }
  5295. }
  5296. <?php
  5297. namespace Composer\Command;
  5298. use Composer\Repository\PlatformRepository;
  5299. use Symfony\Component\Console\Input\InputArgument;
  5300. use Symfony\Component\Console\Input\InputInterface;
  5301. use Symfony\Component\Console\Input\InputOption;
  5302. use Symfony\Component\Console\Output\OutputInterface;
  5303. class SuggestsCommand extends BaseCommand
  5304. {
  5305. protected function configure()
  5306. {
  5307. $this
  5308. ->setName('suggests')
  5309. ->setDescription('Show package suggestions')
  5310. ->setDefinition(array(
  5311. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5312. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5313. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5314. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5315. ))
  5316. ->setHelp(<<<EOT
  5317. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5318. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5319. EOT
  5320. )
  5321. ;
  5322. }
  5323. protected function execute(InputInterface $input, OutputInterface $output)
  5324. {
  5325. $lock = $this->getComposer()->getLocker()->getLockData();
  5326. if (empty($lock)) {
  5327. throw new \RuntimeException('Lockfile seems to be empty?');
  5328. }
  5329. $packages = $lock['packages'];
  5330. if (!$input->getOption('no-dev')) {
  5331. $packages += $lock['packages-dev'];
  5332. }
  5333. $filter = $input->getArgument('packages');
  5334. $installed = array();
  5335. foreach ($packages as $package) {
  5336. $installed[] = $package['name'];
  5337. if (!empty($package['provide'])) {
  5338. $installed = array_merge($installed, array_keys($package['provide']));
  5339. }
  5340. if (!empty($package['replace'])) {
  5341. $installed = array_merge($installed, array_keys($package['replace']));
  5342. }
  5343. }
  5344. $installed = array_flip($installed);
  5345. ksort($installed);
  5346. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5347. $suggesters = array();
  5348. $suggested = array();
  5349. foreach ($packages as $package) {
  5350. $packageName = $package['name'];
  5351. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5352. continue;
  5353. }
  5354. foreach ($package['suggest'] as $suggestion => $reason) {
  5355. if (false === strpos('/', $suggestion) && !is_null($platform->findPackage($suggestion, '*'))) {
  5356. continue;
  5357. }
  5358. if (!isset($installed[$suggestion])) {
  5359. $suggesters[$packageName][$suggestion] = $reason;
  5360. $suggested[$suggestion][$packageName] = $reason;
  5361. }
  5362. }
  5363. }
  5364. ksort($suggesters);
  5365. ksort($suggested);
  5366. $mode = 0;
  5367. $io = $this->getIO();
  5368. if ($input->getOption('by-package') || $io->isVerbose()) {
  5369. $mode |= 1;
  5370. }
  5371. if ($input->getOption('by-suggestion')) {
  5372. $mode |= 2;
  5373. }
  5374. if ($mode === 0) {
  5375. foreach (array_keys($suggested) as $suggestion) {
  5376. $io->write(sprintf('<info>%s</info>', $suggestion));
  5377. }
  5378. return;
  5379. }
  5380. if ($mode & 1) {
  5381. foreach ($suggesters as $suggester => $suggestions) {
  5382. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  5383. foreach ($suggestions as $suggestion => $reason) {
  5384. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  5385. }
  5386. $io->write('');
  5387. }
  5388. }
  5389. if ($mode & 2) {
  5390. if ($mode & 1) {
  5391. $io->write(str_repeat('-', 78));
  5392. }
  5393. foreach ($suggested as $suggestion => $suggesters) {
  5394. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  5395. foreach ($suggesters as $suggester => $reason) {
  5396. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  5397. }
  5398. $io->write('');
  5399. }
  5400. }
  5401. }
  5402. }
  5403. <?php
  5404. namespace Composer\Command;
  5405. use Composer\Composer;
  5406. use Composer\Installer;
  5407. use Composer\IO\IOInterface;
  5408. use Composer\Plugin\CommandEvent;
  5409. use Composer\Plugin\PluginEvents;
  5410. use Symfony\Component\Console\Helper\Table;
  5411. use Symfony\Component\Console\Input\InputInterface;
  5412. use Symfony\Component\Console\Input\InputOption;
  5413. use Symfony\Component\Console\Input\InputArgument;
  5414. use Symfony\Component\Console\Output\OutputInterface;
  5415. use Symfony\Component\Console\Question\Question;
  5416. class UpdateCommand extends BaseCommand
  5417. {
  5418. protected function configure()
  5419. {
  5420. $this
  5421. ->setName('update')
  5422. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5423. ->setDefinition(array(
  5424. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5425. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5426. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5427. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5428. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5429. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5430. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5431. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5432. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5433. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5434. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5435. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  5436. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist.'),
  5437. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5438. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5439. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5440. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5441. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5442. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5443. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5444. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5445. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  5446. ))
  5447. ->setHelp(<<<EOT
  5448. The <info>update</info> command reads the composer.json file from the
  5449. current directory, processes it, and updates, removes or installs all the
  5450. dependencies.
  5451. <info>php composer.phar update</info>
  5452. To limit the update operation to a few packages, you can list the package(s)
  5453. you want to update as such:
  5454. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5455. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5456. from a specific vendor:
  5457. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5458. To select packages names interactively with auto-completion use <info>-i</info>.
  5459. EOT
  5460. )
  5461. ;
  5462. }
  5463. protected function execute(InputInterface $input, OutputInterface $output)
  5464. {
  5465. $io = $this->getIO();
  5466. if ($input->getOption('no-custom-installers')) {
  5467. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5468. $input->setOption('no-plugins', true);
  5469. }
  5470. if ($input->getOption('dev')) {
  5471. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5472. }
  5473. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5474. $packages = $input->getArgument('packages');
  5475. if ($input->getOption('interactive')) {
  5476. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5477. }
  5478. if ($input->getOption('root-reqs')) {
  5479. $require = array_keys($composer->getPackage()->getRequires());
  5480. if (!$input->getOption('no-dev')) {
  5481. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  5482. $require = array_merge($require, $requireDev);
  5483. }
  5484. if (!empty($packages)) {
  5485. $packages = array_intersect($packages, $require);
  5486. } else {
  5487. $packages = $require;
  5488. }
  5489. }
  5490. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5491. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5492. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5493. $install = Installer::create($io, $composer);
  5494. $config = $composer->getConfig();
  5495. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  5496. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5497. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5498. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5499. $install
  5500. ->setDryRun($input->getOption('dry-run'))
  5501. ->setVerbose($input->getOption('verbose'))
  5502. ->setPreferSource($preferSource)
  5503. ->setPreferDist($preferDist)
  5504. ->setDevMode(!$input->getOption('no-dev'))
  5505. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5506. ->setRunScripts(!$input->getOption('no-scripts'))
  5507. ->setSkipSuggest($input->getOption('no-suggest'))
  5508. ->setOptimizeAutoloader($optimize)
  5509. ->setClassMapAuthoritative($authoritative)
  5510. ->setApcuAutoloader($apcu)
  5511. ->setUpdate(true)
  5512. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5513. ->setWhitelistDependencies($input->getOption('with-dependencies'))
  5514. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5515. ->setPreferStable($input->getOption('prefer-stable'))
  5516. ->setPreferLowest($input->getOption('prefer-lowest'))
  5517. ;
  5518. if ($input->getOption('no-plugins')) {
  5519. $install->disablePlugins();
  5520. }
  5521. return $install->run();
  5522. }
  5523. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5524. {
  5525. if (!$input->isInteractive()) {
  5526. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5527. }
  5528. $requires = array_merge(
  5529. $composer->getPackage()->getRequires(),
  5530. $composer->getPackage()->getDevRequires()
  5531. );
  5532. $autocompleterValues = array();
  5533. foreach ($requires as $require) {
  5534. $autocompleterValues[strtolower($require->getTarget())] = $require->getTarget();
  5535. }
  5536. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5537. foreach ($installedPackages as $package) {
  5538. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5539. }
  5540. $helper = $this->getHelper('question');
  5541. $question = new Question('<comment>Enter package name: </comment>', null);
  5542. $io->writeError('<info>Press enter without value to end submission</info>');
  5543. do {
  5544. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5545. $question->setAutocompleterValues($autocompleterValues);
  5546. $addedPackage = $helper->ask($input, $output, $question);
  5547. if (!is_string($addedPackage) || empty($addedPackage)) {
  5548. break;
  5549. }
  5550. $addedPackage = strtolower($addedPackage);
  5551. if (!in_array($addedPackage, $packages)) {
  5552. $packages[] = $addedPackage;
  5553. }
  5554. } while (true);
  5555. $packages = array_filter($packages);
  5556. if (!$packages) {
  5557. throw new \InvalidArgumentException('You must enter minimum one package.');
  5558. }
  5559. $table = new Table($output);
  5560. $table->setHeaders(array('Selected packages'));
  5561. foreach ($packages as $package) {
  5562. $table->addRow(array($package));
  5563. }
  5564. $table->render();
  5565. if ($io->askConfirmation(sprintf(
  5566. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  5567. 1 === count($packages) ? '' : 's'
  5568. ), true)) {
  5569. return $packages;
  5570. }
  5571. throw new \RuntimeException('Installation aborted.');
  5572. }
  5573. }
  5574. <?php
  5575. namespace Composer\Command;
  5576. use Composer\Factory;
  5577. use Composer\Package\Loader\ValidatingArrayLoader;
  5578. use Composer\Plugin\CommandEvent;
  5579. use Composer\Plugin\PluginEvents;
  5580. use Composer\Util\ConfigValidator;
  5581. use Symfony\Component\Console\Input\InputArgument;
  5582. use Symfony\Component\Console\Input\InputInterface;
  5583. use Symfony\Component\Console\Input\InputOption;
  5584. use Symfony\Component\Console\Output\OutputInterface;
  5585. class ValidateCommand extends BaseCommand
  5586. {
  5587. protected function configure()
  5588. {
  5589. $this
  5590. ->setName('validate')
  5591. ->setDescription('Validates a composer.json and composer.lock')
  5592. ->setDefinition(array(
  5593. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  5594. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  5595. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  5596. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  5597. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  5598. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json'),
  5599. ))
  5600. ->setHelp(<<<EOT
  5601. The validate command validates a given composer.json and composer.lock
  5602. Exit codes in case of errors are:
  5603. 1 validation warning(s), only when --strict is given
  5604. 2 validation error(s)
  5605. 3 file unreadable or missing
  5606. EOT
  5607. );
  5608. }
  5609. protected function execute(InputInterface $input, OutputInterface $output)
  5610. {
  5611. $file = $input->getArgument('file');
  5612. $io = $this->getIO();
  5613. if (!file_exists($file)) {
  5614. $io->writeError('<error>' . $file . ' not found.</error>');
  5615. return 3;
  5616. }
  5617. if (!is_readable($file)) {
  5618. $io->writeError('<error>' . $file . ' is not readable.</error>');
  5619. return 3;
  5620. }
  5621. $validator = new ConfigValidator($io);
  5622. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  5623. $checkPublish = !$input->getOption('no-check-publish');
  5624. $checkLock = !$input->getOption('no-check-lock');
  5625. $isStrict = $input->getOption('strict');
  5626. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5627. $lockErrors = array();
  5628. $composer = Factory::create($io, $file);
  5629. $locker = $composer->getLocker();
  5630. if ($locker->isLocked() && !$locker->isFresh()) {
  5631. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  5632. }
  5633. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  5634. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5635. if ($input->getOption('with-dependencies')) {
  5636. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5637. foreach ($localRepo->getPackages() as $package) {
  5638. $path = $composer->getInstallationManager()->getInstallPath($package);
  5639. $file = $path . '/composer.json';
  5640. if (is_dir($path) && file_exists($file)) {
  5641. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5642. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  5643. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5644. $exitCode = max($depCode, $exitCode);
  5645. }
  5646. }
  5647. }
  5648. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  5649. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5650. $exitCode = max($eventCode, $exitCode);
  5651. return $exitCode;
  5652. }
  5653. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  5654. {
  5655. if (!$errors && !$publishErrors && !$warnings) {
  5656. $io->write('<info>' . $name . ' is valid</info>');
  5657. } elseif (!$errors && !$publishErrors) {
  5658. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  5659. if ($printSchemaUrl) {
  5660. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5661. }
  5662. } elseif (!$errors) {
  5663. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  5664. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  5665. if ($printSchemaUrl) {
  5666. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5667. }
  5668. } else {
  5669. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  5670. }
  5671. if ($checkPublish) {
  5672. $errors = array_merge($errors, $publishErrors);
  5673. } else {
  5674. $warnings = array_merge($warnings, $publishErrors);
  5675. }
  5676. if ($checkLock) {
  5677. $errors = array_merge($errors, $lockErrors);
  5678. } else {
  5679. $warnings = array_merge($warnings, $lockErrors);
  5680. }
  5681. $messages = array(
  5682. 'error' => $errors,
  5683. 'warning' => $warnings,
  5684. );
  5685. foreach ($messages as $style => $msgs) {
  5686. foreach ($msgs as $msg) {
  5687. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  5688. }
  5689. }
  5690. }
  5691. }
  5692. <?php
  5693. namespace Composer;
  5694. use Composer\Package\RootPackageInterface;
  5695. use Composer\Package\Locker;
  5696. use Composer\Repository\RepositoryManager;
  5697. use Composer\Installer\InstallationManager;
  5698. use Composer\Plugin\PluginManager;
  5699. use Composer\Downloader\DownloadManager;
  5700. use Composer\EventDispatcher\EventDispatcher;
  5701. use Composer\Autoload\AutoloadGenerator;
  5702. class Composer
  5703. {
  5704. const VERSION = '1.3.1';
  5705. const BRANCH_ALIAS_VERSION = '';
  5706. const RELEASE_DATE = '2017-01-07 18:08:51';
  5707. private $package;
  5708. private $locker;
  5709. private $repositoryManager;
  5710. private $downloadManager;
  5711. private $installationManager;
  5712. private $pluginManager;
  5713. private $config;
  5714. private $eventDispatcher;
  5715. private $autoloadGenerator;
  5716. public function setPackage(RootPackageInterface $package)
  5717. {
  5718. $this->package = $package;
  5719. }
  5720. public function getPackage()
  5721. {
  5722. return $this->package;
  5723. }
  5724. public function setConfig(Config $config)
  5725. {
  5726. $this->config = $config;
  5727. }
  5728. public function getConfig()
  5729. {
  5730. return $this->config;
  5731. }
  5732. public function setLocker(Locker $locker)
  5733. {
  5734. $this->locker = $locker;
  5735. }
  5736. public function getLocker()
  5737. {
  5738. return $this->locker;
  5739. }
  5740. public function setRepositoryManager(RepositoryManager $manager)
  5741. {
  5742. $this->repositoryManager = $manager;
  5743. }
  5744. public function getRepositoryManager()
  5745. {
  5746. return $this->repositoryManager;
  5747. }
  5748. public function setDownloadManager(DownloadManager $manager)
  5749. {
  5750. $this->downloadManager = $manager;
  5751. }
  5752. public function getDownloadManager()
  5753. {
  5754. return $this->downloadManager;
  5755. }
  5756. public function setInstallationManager(InstallationManager $manager)
  5757. {
  5758. $this->installationManager = $manager;
  5759. }
  5760. public function getInstallationManager()
  5761. {
  5762. return $this->installationManager;
  5763. }
  5764. public function setPluginManager(PluginManager $manager)
  5765. {
  5766. $this->pluginManager = $manager;
  5767. }
  5768. public function getPluginManager()
  5769. {
  5770. return $this->pluginManager;
  5771. }
  5772. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  5773. {
  5774. $this->eventDispatcher = $eventDispatcher;
  5775. }
  5776. public function getEventDispatcher()
  5777. {
  5778. return $this->eventDispatcher;
  5779. }
  5780. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  5781. {
  5782. $this->autoloadGenerator = $autoloadGenerator;
  5783. }
  5784. public function getAutoloadGenerator()
  5785. {
  5786. return $this->autoloadGenerator;
  5787. }
  5788. }
  5789. <?php
  5790. namespace Composer;
  5791. use Composer\Config\ConfigSourceInterface;
  5792. use Composer\Downloader\TransportException;
  5793. use Composer\IO\IOInterface;
  5794. use Composer\Util\Platform;
  5795. class Config
  5796. {
  5797. const RELATIVE_PATHS = 1;
  5798. public static $defaultConfig = array(
  5799. 'process-timeout' => 300,
  5800. 'use-include-path' => false,
  5801. 'preferred-install' => 'auto',
  5802. 'notify-on-install' => true,
  5803. 'github-protocols' => array('https', 'ssh', 'git'),
  5804. 'vendor-dir' => 'vendor',
  5805. 'bin-dir' => '{$vendor-dir}/bin',
  5806. 'cache-dir' => '{$home}/cache',
  5807. 'data-dir' => '{$home}',
  5808. 'cache-files-dir' => '{$cache-dir}/files',
  5809. 'cache-repo-dir' => '{$cache-dir}/repo',
  5810. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  5811. 'cache-ttl' => 15552000,
  5812. 'cache-files-ttl' => null,
  5813. 'cache-files-maxsize' => '300MiB',
  5814. 'bin-compat' => 'auto',
  5815. 'discard-changes' => false,
  5816. 'autoloader-suffix' => null,
  5817. 'sort-packages' => false,
  5818. 'optimize-autoloader' => false,
  5819. 'classmap-authoritative' => false,
  5820. 'apcu-autoloader' => false,
  5821. 'prepend-autoloader' => true,
  5822. 'github-domains' => array('github.com'),
  5823. 'bitbucket-expose-hostname' => true,
  5824. 'disable-tls' => false,
  5825. 'secure-http' => true,
  5826. 'cafile' => null,
  5827. 'capath' => null,
  5828. 'github-expose-hostname' => true,
  5829. 'gitlab-domains' => array('gitlab.com'),
  5830. 'store-auths' => 'prompt',
  5831. 'platform' => array(),
  5832. 'archive-format' => 'tar',
  5833. 'archive-dir' => '.',
  5834. );
  5835. public static $defaultRepositories = array(
  5836. 'packagist.org' => array(
  5837. 'type' => 'composer',
  5838. 'url' => 'https?://packagist.org',
  5839. 'allow_ssl_downgrade' => true,
  5840. ),
  5841. );
  5842. private $config;
  5843. private $baseDir;
  5844. private $repositories;
  5845. private $configSource;
  5846. private $authConfigSource;
  5847. private $useEnvironment;
  5848. private $warnedHosts = array();
  5849. public function __construct($useEnvironment = true, $baseDir = null)
  5850. {
  5851. $this->config = static::$defaultConfig;
  5852. $this->repositories = static::$defaultRepositories;
  5853. $this->useEnvironment = (bool) $useEnvironment;
  5854. $this->baseDir = $baseDir;
  5855. }
  5856. public function setConfigSource(ConfigSourceInterface $source)
  5857. {
  5858. $this->configSource = $source;
  5859. }
  5860. public function getConfigSource()
  5861. {
  5862. return $this->configSource;
  5863. }
  5864. public function setAuthConfigSource(ConfigSourceInterface $source)
  5865. {
  5866. $this->authConfigSource = $source;
  5867. }
  5868. public function getAuthConfigSource()
  5869. {
  5870. return $this->authConfigSource;
  5871. }
  5872. public function merge($config)
  5873. {
  5874. if (!empty($config['config']) && is_array($config['config'])) {
  5875. foreach ($config['config'] as $key => $val) {
  5876. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  5877. $this->config[$key] = array_merge($this->config[$key], $val);
  5878. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  5879. if (is_array($val) || is_array($this->config[$key])) {
  5880. if (is_string($val)) {
  5881. $val = array('*' => $val);
  5882. }
  5883. if (is_string($this->config[$key])) {
  5884. $this->config[$key] = array('*' => $this->config[$key]);
  5885. }
  5886. $this->config[$key] = array_merge($this->config[$key], $val);
  5887. if (isset($this->config[$key]['*'])) {
  5888. $wildcard = $this->config[$key]['*'];
  5889. unset($this->config[$key]['*']);
  5890. $this->config[$key]['*'] = $wildcard;
  5891. }
  5892. } else {
  5893. $this->config[$key] = $val;
  5894. }
  5895. } else {
  5896. $this->config[$key] = $val;
  5897. }
  5898. }
  5899. }
  5900. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  5901. $this->repositories = array_reverse($this->repositories, true);
  5902. $newRepos = array_reverse($config['repositories'], true);
  5903. foreach ($newRepos as $name => $repository) {
  5904. if (false === $repository) {
  5905. $this->disableRepoByName($name);
  5906. continue;
  5907. }
  5908. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  5909. $this->disableRepoByName(key($repository));
  5910. continue;
  5911. }
  5912. if (is_int($name)) {
  5913. $this->repositories[] = $repository;
  5914. } else {
  5915. if ($name === 'packagist') {
  5916. $this->repositories[$name . '.org'] = $repository;
  5917. } else {
  5918. $this->repositories[$name] = $repository;
  5919. }
  5920. }
  5921. }
  5922. $this->repositories = array_reverse($this->repositories, true);
  5923. }
  5924. }
  5925. public function getRepositories()
  5926. {
  5927. return $this->repositories;
  5928. }
  5929. public function get($key, $flags = 0)
  5930. {
  5931. switch ($key) {
  5932. case 'vendor-dir':
  5933. case 'bin-dir':
  5934. case 'process-timeout':
  5935. case 'data-dir':
  5936. case 'cache-dir':
  5937. case 'cache-files-dir':
  5938. case 'cache-repo-dir':
  5939. case 'cache-vcs-dir':
  5940. case 'cafile':
  5941. case 'capath':
  5942. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  5943. $val = $this->getComposerEnv($env);
  5944. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  5945. $val = Platform::expandPath($val);
  5946. if (substr($key, -4) !== '-dir') {
  5947. return $val;
  5948. }
  5949. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  5950. case 'cache-ttl':
  5951. return (int) $this->config[$key];
  5952. case 'cache-files-maxsize':
  5953. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  5954. throw new \RuntimeException(
  5955. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  5956. );
  5957. }
  5958. $size = $matches[1];
  5959. if (isset($matches[2])) {
  5960. switch (strtolower($matches[2])) {
  5961. case 'g':
  5962. $size *= 1024;
  5963. case 'm':
  5964. $size *= 1024;
  5965. case 'k':
  5966. $size *= 1024;
  5967. break;
  5968. }
  5969. }
  5970. return $size;
  5971. case 'cache-files-ttl':
  5972. if (isset($this->config[$key])) {
  5973. return (int) $this->config[$key];
  5974. }
  5975. return (int) $this->config['cache-ttl'];
  5976. case 'home':
  5977. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  5978. return rtrim($this->process($val, $flags), '/\\');
  5979. case 'bin-compat':
  5980. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  5981. if (!in_array($value, array('auto', 'full'))) {
  5982. throw new \RuntimeException(
  5983. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  5984. );
  5985. }
  5986. return $value;
  5987. case 'discard-changes':
  5988. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  5989. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  5990. throw new \RuntimeException(
  5991. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  5992. );
  5993. }
  5994. if ('stash' === $env) {
  5995. return 'stash';
  5996. }
  5997. return $env !== 'false' && (bool) $env;
  5998. }
  5999. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6000. throw new \RuntimeException(
  6001. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6002. );
  6003. }
  6004. return $this->config[$key];
  6005. case 'github-protocols':
  6006. $protos = $this->config['github-protocols'];
  6007. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6008. unset($protos[$index]);
  6009. }
  6010. if (reset($protos) === 'http') {
  6011. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6012. }
  6013. return $protos;
  6014. case 'disable-tls':
  6015. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6016. case 'secure-http':
  6017. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6018. default:
  6019. if (!isset($this->config[$key])) {
  6020. return null;
  6021. }
  6022. return $this->process($this->config[$key], $flags);
  6023. }
  6024. }
  6025. public function all($flags = 0)
  6026. {
  6027. $all = array(
  6028. 'repositories' => $this->getRepositories(),
  6029. );
  6030. foreach (array_keys($this->config) as $key) {
  6031. $all['config'][$key] = $this->get($key, $flags);
  6032. }
  6033. return $all;
  6034. }
  6035. public function raw()
  6036. {
  6037. return array(
  6038. 'repositories' => $this->getRepositories(),
  6039. 'config' => $this->config,
  6040. );
  6041. }
  6042. public function has($key)
  6043. {
  6044. return array_key_exists($key, $this->config);
  6045. }
  6046. private function process($value, $flags)
  6047. {
  6048. $config = $this;
  6049. if (!is_string($value)) {
  6050. return $value;
  6051. }
  6052. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6053. return $config->get($match[1], $flags);
  6054. }, $value);
  6055. }
  6056. private function realpath($path)
  6057. {
  6058. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6059. return $path;
  6060. }
  6061. return $this->baseDir . '/' . $path;
  6062. }
  6063. private function getComposerEnv($var)
  6064. {
  6065. if ($this->useEnvironment) {
  6066. return getenv($var);
  6067. }
  6068. return false;
  6069. }
  6070. private function disableRepoByName($name)
  6071. {
  6072. if (isset($this->repositories[$name])) {
  6073. unset($this->repositories[$name]);
  6074. } else if ($name === 'packagist') {
  6075. unset($this->repositories['packagist.org']);
  6076. }
  6077. }
  6078. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6079. {
  6080. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6081. return;
  6082. }
  6083. $scheme = parse_url($url, PHP_URL_SCHEME);
  6084. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6085. if ($this->get('secure-http')) {
  6086. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6087. } elseif ($io) {
  6088. $host = parse_url($url, PHP_URL_HOST);
  6089. if (!isset($this->warnedHosts[$host])) {
  6090. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6091. }
  6092. $this->warnedHosts[$host] = true;
  6093. }
  6094. }
  6095. }
  6096. }
  6097. <?php
  6098. namespace Composer\Config;
  6099. interface ConfigSourceInterface
  6100. {
  6101. public function addRepository($name, $config);
  6102. public function removeRepository($name);
  6103. public function addConfigSetting($name, $value);
  6104. public function removeConfigSetting($name);
  6105. public function addProperty($name, $value);
  6106. public function removeProperty($name);
  6107. public function addLink($type, $name, $value);
  6108. public function removeLink($type, $name);
  6109. public function getName();
  6110. }
  6111. <?php
  6112. namespace Composer\Config;
  6113. use Composer\Json\JsonFile;
  6114. use Composer\Json\JsonManipulator;
  6115. use Composer\Util\Silencer;
  6116. class JsonConfigSource implements ConfigSourceInterface
  6117. {
  6118. private $file;
  6119. private $authConfig;
  6120. public function __construct(JsonFile $file, $authConfig = false)
  6121. {
  6122. $this->file = $file;
  6123. $this->authConfig = $authConfig;
  6124. }
  6125. public function getName()
  6126. {
  6127. return $this->file->getPath();
  6128. }
  6129. public function addRepository($name, $config)
  6130. {
  6131. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6132. $config['repositories'][$repo] = $repoConfig;
  6133. });
  6134. }
  6135. public function removeRepository($name)
  6136. {
  6137. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6138. unset($config['repositories'][$repo]);
  6139. });
  6140. }
  6141. public function addConfigSetting($name, $value)
  6142. {
  6143. $authConfig = $this->authConfig;
  6144. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6145. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6146. list($key, $host) = explode('.', $key, 2);
  6147. if ($authConfig) {
  6148. $config[$key][$host] = $val;
  6149. } else {
  6150. $config['config'][$key][$host] = $val;
  6151. }
  6152. } else {
  6153. $config['config'][$key] = $val;
  6154. }
  6155. });
  6156. }
  6157. public function removeConfigSetting($name)
  6158. {
  6159. $authConfig = $this->authConfig;
  6160. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6161. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6162. list($key, $host) = explode('.', $key, 2);
  6163. if ($authConfig) {
  6164. unset($config[$key][$host]);
  6165. } else {
  6166. unset($config['config'][$key][$host]);
  6167. }
  6168. } else {
  6169. unset($config['config'][$key]);
  6170. }
  6171. });
  6172. }
  6173. public function addProperty($name, $value)
  6174. {
  6175. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6176. if (substr($key, 0, 6) === 'extra.') {
  6177. $bits = explode('.', $key);
  6178. $last = array_pop($bits);
  6179. $arr =& $config['extra'];
  6180. foreach ($bits as $bit) {
  6181. if (!isset($arr[$bit])) {
  6182. $arr[$bit] = array();
  6183. }
  6184. $arr =& $arr[$bit];
  6185. }
  6186. $arr[$last] = $val;
  6187. } else {
  6188. $config[$key] = $val;
  6189. }
  6190. });
  6191. }
  6192. public function removeProperty($name)
  6193. {
  6194. $authConfig = $this->authConfig;
  6195. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6196. if (substr($key, 0, 6) === 'extra.') {
  6197. $bits = explode('.', $key);
  6198. $last = array_pop($bits);
  6199. $arr =& $config['extra'];
  6200. foreach ($bits as $bit) {
  6201. if (!isset($arr[$bit])) {
  6202. return;
  6203. }
  6204. $arr =& $arr[$bit];
  6205. }
  6206. unset($arr[$last]);
  6207. } else {
  6208. unset($config[$key]);
  6209. }
  6210. });
  6211. }
  6212. public function addLink($type, $name, $value)
  6213. {
  6214. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6215. $config[$type][$name] = $value;
  6216. });
  6217. }
  6218. public function removeLink($type, $name)
  6219. {
  6220. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6221. unset($config[$type][$name]);
  6222. });
  6223. }
  6224. protected function manipulateJson($method, $args, $fallback)
  6225. {
  6226. $args = func_get_args();
  6227. array_shift($args);
  6228. $fallback = array_pop($args);
  6229. if ($this->file->exists()) {
  6230. if (!is_writable($this->file->getPath())) {
  6231. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6232. }
  6233. if (!is_readable($this->file->getPath())) {
  6234. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6235. }
  6236. $contents = file_get_contents($this->file->getPath());
  6237. } elseif ($this->authConfig) {
  6238. $contents = "{\n}\n";
  6239. } else {
  6240. $contents = "{\n \"config\": {\n }\n}\n";
  6241. }
  6242. $manipulator = new JsonManipulator($contents);
  6243. $newFile = !$this->file->exists();
  6244. if ($this->authConfig && $method === 'addConfigSetting') {
  6245. $method = 'addSubNode';
  6246. list($mainNode, $name) = explode('.', $args[0], 2);
  6247. $args = array($mainNode, $name, $args[1]);
  6248. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6249. $method = 'removeSubNode';
  6250. list($mainNode, $name) = explode('.', $args[0], 2);
  6251. $args = array($mainNode, $name);
  6252. }
  6253. if (call_user_func_array(array($manipulator, $method), $args)) {
  6254. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6255. } else {
  6256. $config = $this->file->read();
  6257. $this->arrayUnshiftRef($args, $config);
  6258. call_user_func_array($fallback, $args);
  6259. $this->file->write($config);
  6260. }
  6261. if ($newFile) {
  6262. Silencer::call('chmod', $this->file->getPath(), 0600);
  6263. }
  6264. }
  6265. private function arrayUnshiftRef(&$array, &$value)
  6266. {
  6267. $return = array_unshift($array, '');
  6268. $array[0] = &$value;
  6269. return $return;
  6270. }
  6271. }
  6272. <?php
  6273. namespace Composer\Console;
  6274. use Composer\Util\Platform;
  6275. use Composer\Util\Silencer;
  6276. use Symfony\Component\Console\Application as BaseApplication;
  6277. use Symfony\Component\Console\Input\InputInterface;
  6278. use Symfony\Component\Console\Input\InputOption;
  6279. use Symfony\Component\Console\Output\OutputInterface;
  6280. use Composer\Command;
  6281. use Composer\Composer;
  6282. use Composer\Factory;
  6283. use Composer\IO\IOInterface;
  6284. use Composer\IO\ConsoleIO;
  6285. use Composer\Json\JsonValidationException;
  6286. use Composer\Util\ErrorHandler;
  6287. use Composer\EventDispatcher\ScriptExecutionException;
  6288. use Composer\Exception\NoSslException;
  6289. class Application extends BaseApplication
  6290. {
  6291. protected $composer;
  6292. protected $io;
  6293. private static $logo = ' ______
  6294. / ____/___ ____ ___ ____ ____ ________ _____
  6295. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6296. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6297. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6298. /_/
  6299. ';
  6300. private $hasPluginCommands = false;
  6301. private $disablePluginsByDefault = false;
  6302. public function __construct()
  6303. {
  6304. static $shutdownRegistered = false;
  6305. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6306. ini_set('xdebug.show_exception_trace', false);
  6307. ini_set('xdebug.scream', false);
  6308. }
  6309. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6310. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6311. }
  6312. if (!$shutdownRegistered) {
  6313. $shutdownRegistered = true;
  6314. register_shutdown_function(function () {
  6315. $lastError = error_get_last();
  6316. if ($lastError && $lastError['message'] &&
  6317. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6318. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6319. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6320. }
  6321. });
  6322. }
  6323. parent::__construct('Composer', Composer::VERSION);
  6324. }
  6325. public function run(InputInterface $input = null, OutputInterface $output = null)
  6326. {
  6327. if (null === $output) {
  6328. $output = Factory::createOutput();
  6329. }
  6330. return parent::run($input, $output);
  6331. }
  6332. public function doRun(InputInterface $input, OutputInterface $output)
  6333. {
  6334. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  6335. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  6336. ErrorHandler::register($io);
  6337. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  6338. $oldWorkingDir = getcwd();
  6339. chdir($newWorkDir);
  6340. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  6341. }
  6342. $commandName = '';
  6343. if ($name = $this->getCommandName($input)) {
  6344. try {
  6345. $commandName = $this->find($name)->getName();
  6346. } catch (\InvalidArgumentException $e) {
  6347. }
  6348. }
  6349. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  6350. try {
  6351. foreach ($this->getPluginCommands() as $command) {
  6352. if ($this->has($command->getName())) {
  6353. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  6354. } else {
  6355. $this->add($command);
  6356. }
  6357. }
  6358. } catch (NoSslException $e) {
  6359. }
  6360. $this->hasPluginCommands = true;
  6361. }
  6362. $isProxyCommand = false;
  6363. if ($name = $this->getCommandName($input)) {
  6364. try {
  6365. $command = $this->find($name);
  6366. $commandName = $command->getName();
  6367. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  6368. } catch (\InvalidArgumentException $e) {
  6369. }
  6370. }
  6371. if (!$isProxyCommand) {
  6372. $io->writeError(sprintf(
  6373. 'Running %s (%s) with %s on %s',
  6374. Composer::VERSION,
  6375. Composer::RELEASE_DATE,
  6376. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  6377. php_uname('s') . ' / ' . php_uname('r')
  6378. ), true, IOInterface::DEBUG);
  6379. if (PHP_VERSION_ID < 50302) {
  6380. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  6381. }
  6382. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN') || getenv('COMPOSER_ALLOW_XDEBUG')) {
  6383. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  6384. }
  6385. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  6386. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  6387. }
  6388. if (getenv('COMPOSER_NO_INTERACTION')) {
  6389. $input->setInteractive(false);
  6390. }
  6391. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  6392. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  6393. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  6394. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  6395. }
  6396. if ($uid = (int) getenv('SUDO_UID')) {
  6397. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  6398. }
  6399. }
  6400. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  6401. }
  6402. Silencer::call(function () use ($io) {
  6403. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  6404. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  6405. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  6406. }
  6407. });
  6408. $file = Factory::getComposerFile();
  6409. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  6410. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  6411. foreach ($composer['scripts'] as $script => $dummy) {
  6412. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6413. if ($this->has($script)) {
  6414. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  6415. } else {
  6416. $this->add(new Command\ScriptAliasCommand($script));
  6417. }
  6418. }
  6419. }
  6420. }
  6421. }
  6422. }
  6423. try {
  6424. if ($input->hasParameterOption('--profile')) {
  6425. $startTime = microtime(true);
  6426. $this->io->enableDebugging($startTime);
  6427. }
  6428. $result = parent::doRun($input, $output);
  6429. if (isset($oldWorkingDir)) {
  6430. chdir($oldWorkingDir);
  6431. }
  6432. if (isset($startTime)) {
  6433. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  6434. }
  6435. restore_error_handler();
  6436. return $result;
  6437. } catch (ScriptExecutionException $e) {
  6438. return $e->getCode();
  6439. } catch (\Exception $e) {
  6440. $this->hintCommonErrors($e);
  6441. restore_error_handler();
  6442. throw $e;
  6443. }
  6444. }
  6445. private function getNewWorkingDir(InputInterface $input)
  6446. {
  6447. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  6448. if (false !== $workingDir && !is_dir($workingDir)) {
  6449. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  6450. }
  6451. return $workingDir;
  6452. }
  6453. private function hintCommonErrors($exception)
  6454. {
  6455. $io = $this->getIO();
  6456. Silencer::suppress();
  6457. try {
  6458. $composer = $this->getComposer(false, true);
  6459. if ($composer) {
  6460. $config = $composer->getConfig();
  6461. $minSpaceFree = 1024 * 1024;
  6462. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  6463. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  6464. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  6465. ) {
  6466. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  6467. }
  6468. }
  6469. } catch (\Exception $e) {
  6470. }
  6471. Silencer::restore();
  6472. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  6473. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  6474. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  6475. }
  6476. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  6477. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  6478. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  6479. }
  6480. }
  6481. public function getComposer($required = true, $disablePlugins = null)
  6482. {
  6483. if (null === $disablePlugins) {
  6484. $disablePlugins = $this->disablePluginsByDefault;
  6485. }
  6486. if (null === $this->composer) {
  6487. try {
  6488. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6489. } catch (\InvalidArgumentException $e) {
  6490. if ($required) {
  6491. $this->io->writeError($e->getMessage());
  6492. exit(1);
  6493. }
  6494. } catch (JsonValidationException $e) {
  6495. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6496. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6497. throw new JsonValidationException($message);
  6498. }
  6499. }
  6500. return $this->composer;
  6501. }
  6502. public function resetComposer()
  6503. {
  6504. $this->composer = null;
  6505. }
  6506. public function getIO()
  6507. {
  6508. return $this->io;
  6509. }
  6510. public function getHelp()
  6511. {
  6512. return self::$logo . parent::getHelp();
  6513. }
  6514. protected function getDefaultCommands()
  6515. {
  6516. $commands = array_merge(parent::getDefaultCommands(), array(
  6517. new Command\AboutCommand(),
  6518. new Command\ConfigCommand(),
  6519. new Command\DependsCommand(),
  6520. new Command\ProhibitsCommand(),
  6521. new Command\InitCommand(),
  6522. new Command\InstallCommand(),
  6523. new Command\CreateProjectCommand(),
  6524. new Command\UpdateCommand(),
  6525. new Command\SearchCommand(),
  6526. new Command\ValidateCommand(),
  6527. new Command\ShowCommand(),
  6528. new Command\SuggestsCommand(),
  6529. new Command\RequireCommand(),
  6530. new Command\DumpAutoloadCommand(),
  6531. new Command\StatusCommand(),
  6532. new Command\ArchiveCommand(),
  6533. new Command\DiagnoseCommand(),
  6534. new Command\RunScriptCommand(),
  6535. new Command\LicensesCommand(),
  6536. new Command\GlobalCommand(),
  6537. new Command\ClearCacheCommand(),
  6538. new Command\RemoveCommand(),
  6539. new Command\HomeCommand(),
  6540. new Command\ExecCommand(),
  6541. new Command\OutdatedCommand(),
  6542. ));
  6543. if ('phar:' === substr(__FILE__, 0, 5)) {
  6544. $commands[] = new Command\SelfUpdateCommand();
  6545. }
  6546. return $commands;
  6547. }
  6548. public function getLongVersion()
  6549. {
  6550. if (Composer::BRANCH_ALIAS_VERSION) {
  6551. return sprintf(
  6552. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  6553. $this->getName(),
  6554. Composer::BRANCH_ALIAS_VERSION,
  6555. $this->getVersion(),
  6556. Composer::RELEASE_DATE
  6557. );
  6558. }
  6559. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  6560. }
  6561. protected function getDefaultInputDefinition()
  6562. {
  6563. $definition = parent::getDefaultInputDefinition();
  6564. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  6565. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  6566. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  6567. return $definition;
  6568. }
  6569. private function getPluginCommands()
  6570. {
  6571. $commands = array();
  6572. $composer = $this->getComposer(false, false);
  6573. if (null === $composer) {
  6574. $composer = Factory::createGlobal($this->io, false);
  6575. }
  6576. if (null !== $composer) {
  6577. $pm = $composer->getPluginManager();
  6578. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  6579. $newCommands = $capability->getCommands();
  6580. if (!is_array($newCommands)) {
  6581. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  6582. }
  6583. foreach ($newCommands as $command) {
  6584. if (!$command instanceof Command\BaseCommand) {
  6585. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  6586. }
  6587. }
  6588. $commands = array_merge($commands, $newCommands);
  6589. }
  6590. }
  6591. return $commands;
  6592. }
  6593. }
  6594. <?php
  6595. namespace Composer\Console;
  6596. use Symfony\Component\Console\Formatter\OutputFormatter;
  6597. class HtmlOutputFormatter extends OutputFormatter
  6598. {
  6599. private static $availableForegroundColors = array(
  6600. 30 => 'black',
  6601. 31 => 'red',
  6602. 32 => 'green',
  6603. 33 => 'yellow',
  6604. 34 => 'blue',
  6605. 35 => 'magenta',
  6606. 36 => 'cyan',
  6607. 37 => 'white',
  6608. );
  6609. private static $availableBackgroundColors = array(
  6610. 40 => 'black',
  6611. 41 => 'red',
  6612. 42 => 'green',
  6613. 43 => 'yellow',
  6614. 44 => 'blue',
  6615. 45 => 'magenta',
  6616. 46 => 'cyan',
  6617. 47 => 'white',
  6618. );
  6619. private static $availableOptions = array(
  6620. 1 => 'bold',
  6621. 4 => 'underscore',
  6622. );
  6623. public function __construct(array $styles = array())
  6624. {
  6625. parent::__construct(true, $styles);
  6626. }
  6627. public function format($message)
  6628. {
  6629. $formatted = parent::format($message);
  6630. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  6631. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  6632. }
  6633. private function formatHtml($matches)
  6634. {
  6635. $out = '<span style="';
  6636. foreach (explode(';', $matches[1]) as $code) {
  6637. if (isset(self::$availableForegroundColors[$code])) {
  6638. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  6639. } elseif (isset(self::$availableBackgroundColors[$code])) {
  6640. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  6641. } elseif (isset(self::$availableOptions[$code])) {
  6642. switch (self::$availableOptions[$code]) {
  6643. case 'bold':
  6644. $out .= 'font-weight:bold;';
  6645. break;
  6646. case 'underscore':
  6647. $out .= 'text-decoration:underline;';
  6648. break;
  6649. }
  6650. }
  6651. }
  6652. return $out.'">'.$matches[2].'</span>';
  6653. }
  6654. }
  6655. <?php
  6656. namespace Composer\DependencyResolver;
  6657. class Decisions implements \Iterator, \Countable
  6658. {
  6659. const DECISION_LITERAL = 0;
  6660. const DECISION_REASON = 1;
  6661. protected $pool;
  6662. protected $decisionMap;
  6663. protected $decisionQueue = array();
  6664. public function __construct($pool)
  6665. {
  6666. $this->pool = $pool;
  6667. $this->decisionMap = array();
  6668. }
  6669. public function decide($literal, $level, $why)
  6670. {
  6671. $this->addDecision($literal, $level);
  6672. $this->decisionQueue[] = array(
  6673. self::DECISION_LITERAL => $literal,
  6674. self::DECISION_REASON => $why,
  6675. );
  6676. }
  6677. public function satisfy($literal)
  6678. {
  6679. $packageId = abs($literal);
  6680. return (
  6681. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  6682. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  6683. );
  6684. }
  6685. public function conflict($literal)
  6686. {
  6687. $packageId = abs($literal);
  6688. return (
  6689. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  6690. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  6691. );
  6692. }
  6693. public function decided($literalOrPackageId)
  6694. {
  6695. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  6696. }
  6697. public function undecided($literalOrPackageId)
  6698. {
  6699. return empty($this->decisionMap[abs($literalOrPackageId)]);
  6700. }
  6701. public function decidedInstall($literalOrPackageId)
  6702. {
  6703. $packageId = abs($literalOrPackageId);
  6704. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  6705. }
  6706. public function decisionLevel($literalOrPackageId)
  6707. {
  6708. $packageId = abs($literalOrPackageId);
  6709. if (isset($this->decisionMap[$packageId])) {
  6710. return abs($this->decisionMap[$packageId]);
  6711. }
  6712. return 0;
  6713. }
  6714. public function decisionRule($literalOrPackageId)
  6715. {
  6716. $packageId = abs($literalOrPackageId);
  6717. foreach ($this->decisionQueue as $i => $decision) {
  6718. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  6719. return $decision[self::DECISION_REASON];
  6720. }
  6721. }
  6722. return null;
  6723. }
  6724. public function atOffset($queueOffset)
  6725. {
  6726. return $this->decisionQueue[$queueOffset];
  6727. }
  6728. public function validOffset($queueOffset)
  6729. {
  6730. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  6731. }
  6732. public function lastReason()
  6733. {
  6734. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  6735. }
  6736. public function lastLiteral()
  6737. {
  6738. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  6739. }
  6740. public function reset()
  6741. {
  6742. while ($decision = array_pop($this->decisionQueue)) {
  6743. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6744. }
  6745. }
  6746. public function resetToOffset($offset)
  6747. {
  6748. while (count($this->decisionQueue) > $offset + 1) {
  6749. $decision = array_pop($this->decisionQueue);
  6750. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6751. }
  6752. }
  6753. public function revertLast()
  6754. {
  6755. $this->decisionMap[abs($this->lastLiteral())] = 0;
  6756. array_pop($this->decisionQueue);
  6757. }
  6758. public function count()
  6759. {
  6760. return count($this->decisionQueue);
  6761. }
  6762. public function rewind()
  6763. {
  6764. end($this->decisionQueue);
  6765. }
  6766. public function current()
  6767. {
  6768. return current($this->decisionQueue);
  6769. }
  6770. public function key()
  6771. {
  6772. return key($this->decisionQueue);
  6773. }
  6774. public function next()
  6775. {
  6776. return prev($this->decisionQueue);
  6777. }
  6778. public function valid()
  6779. {
  6780. return false !== current($this->decisionQueue);
  6781. }
  6782. public function isEmpty()
  6783. {
  6784. return count($this->decisionQueue) === 0;
  6785. }
  6786. protected function addDecision($literal, $level)
  6787. {
  6788. $packageId = abs($literal);
  6789. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  6790. if ($previousDecision != 0) {
  6791. $literalString = $this->pool->literalToString($literal);
  6792. $package = $this->pool->literalToPackage($literal);
  6793. throw new SolverBugException(
  6794. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  6795. );
  6796. }
  6797. if ($literal > 0) {
  6798. $this->decisionMap[$packageId] = $level;
  6799. } else {
  6800. $this->decisionMap[$packageId] = -$level;
  6801. }
  6802. }
  6803. }
  6804. <?php
  6805. namespace Composer\DependencyResolver;
  6806. use Composer\Package\PackageInterface;
  6807. use Composer\Package\AliasPackage;
  6808. use Composer\Package\BasePackage;
  6809. use Composer\Semver\Constraint\Constraint;
  6810. class DefaultPolicy implements PolicyInterface
  6811. {
  6812. private $preferStable;
  6813. private $preferLowest;
  6814. public function __construct($preferStable = false, $preferLowest = false)
  6815. {
  6816. $this->preferStable = $preferStable;
  6817. $this->preferLowest = $preferLowest;
  6818. }
  6819. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  6820. {
  6821. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  6822. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  6823. }
  6824. $constraint = new Constraint($operator, $b->getVersion());
  6825. $version = new Constraint('==', $a->getVersion());
  6826. return $constraint->matchSpecific($version, true);
  6827. }
  6828. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  6829. {
  6830. $packages = array();
  6831. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  6832. if ($candidate !== $package) {
  6833. $packages[] = $candidate;
  6834. }
  6835. }
  6836. return $packages;
  6837. }
  6838. public function getPriority(Pool $pool, PackageInterface $package)
  6839. {
  6840. return $pool->getPriority($package->getRepository());
  6841. }
  6842. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  6843. {
  6844. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  6845. foreach ($packages as &$literals) {
  6846. $policy = $this;
  6847. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  6848. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  6849. });
  6850. }
  6851. foreach ($packages as &$literals) {
  6852. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  6853. $literals = $this->pruneToBestVersion($pool, $literals);
  6854. $literals = $this->pruneRemoteAliases($pool, $literals);
  6855. }
  6856. $selected = call_user_func_array('array_merge', $packages);
  6857. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  6858. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  6859. });
  6860. return $selected;
  6861. }
  6862. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  6863. {
  6864. $packages = array();
  6865. foreach ($literals as $literal) {
  6866. $packageName = $pool->literalToPackage($literal)->getName();
  6867. if (!isset($packages[$packageName])) {
  6868. $packages[$packageName] = array();
  6869. }
  6870. if (isset($installedMap[abs($literal)])) {
  6871. array_unshift($packages[$packageName], $literal);
  6872. } else {
  6873. $packages[$packageName][] = $literal;
  6874. }
  6875. }
  6876. return $packages;
  6877. }
  6878. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  6879. {
  6880. if ($a->getRepository() === $b->getRepository()) {
  6881. if ($a->getName() === $b->getName()) {
  6882. $aAliased = $a instanceof AliasPackage;
  6883. $bAliased = $b instanceof AliasPackage;
  6884. if ($aAliased && !$bAliased) {
  6885. return -1;
  6886. }
  6887. if (!$aAliased && $bAliased) {
  6888. return 1;
  6889. }
  6890. }
  6891. if (!$ignoreReplace) {
  6892. if ($this->replaces($a, $b)) {
  6893. return 1;
  6894. }
  6895. if ($this->replaces($b, $a)) {
  6896. return -1;
  6897. }
  6898. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  6899. $requiredVendor = substr($requiredPackage, 0, $pos);
  6900. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  6901. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  6902. if ($bIsSameVendor !== $aIsSameVendor) {
  6903. return $aIsSameVendor ? -1 : 1;
  6904. }
  6905. }
  6906. }
  6907. if ($a->id === $b->id) {
  6908. return 0;
  6909. }
  6910. return ($a->id < $b->id) ? -1 : 1;
  6911. }
  6912. if (isset($installedMap[$a->id])) {
  6913. return -1;
  6914. }
  6915. if (isset($installedMap[$b->id])) {
  6916. return 1;
  6917. }
  6918. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  6919. }
  6920. protected function replaces(PackageInterface $source, PackageInterface $target)
  6921. {
  6922. foreach ($source->getReplaces() as $link) {
  6923. if ($link->getTarget() === $target->getName()
  6924. ) {
  6925. return true;
  6926. }
  6927. }
  6928. return false;
  6929. }
  6930. protected function pruneToBestVersion(Pool $pool, $literals)
  6931. {
  6932. $operator = $this->preferLowest ? '<' : '>';
  6933. $bestLiterals = array($literals[0]);
  6934. $bestPackage = $pool->literalToPackage($literals[0]);
  6935. foreach ($literals as $i => $literal) {
  6936. if (0 === $i) {
  6937. continue;
  6938. }
  6939. $package = $pool->literalToPackage($literal);
  6940. if ($this->versionCompare($package, $bestPackage, $operator)) {
  6941. $bestPackage = $package;
  6942. $bestLiterals = array($literal);
  6943. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  6944. $bestLiterals[] = $literal;
  6945. }
  6946. }
  6947. return $bestLiterals;
  6948. }
  6949. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  6950. {
  6951. $selected = array();
  6952. $priority = null;
  6953. foreach ($literals as $literal) {
  6954. $package = $pool->literalToPackage($literal);
  6955. if (isset($installedMap[$package->id])) {
  6956. $selected[] = $literal;
  6957. continue;
  6958. }
  6959. if (null === $priority) {
  6960. $priority = $this->getPriority($pool, $package);
  6961. }
  6962. if ($this->getPriority($pool, $package) != $priority) {
  6963. break;
  6964. }
  6965. $selected[] = $literal;
  6966. }
  6967. return $selected;
  6968. }
  6969. protected function pruneRemoteAliases(Pool $pool, array $literals)
  6970. {
  6971. $hasLocalAlias = false;
  6972. foreach ($literals as $literal) {
  6973. $package = $pool->literalToPackage($literal);
  6974. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  6975. $hasLocalAlias = true;
  6976. break;
  6977. }
  6978. }
  6979. if (!$hasLocalAlias) {
  6980. return $literals;
  6981. }
  6982. $selected = array();
  6983. foreach ($literals as $literal) {
  6984. $package = $pool->literalToPackage($literal);
  6985. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  6986. $selected[] = $literal;
  6987. }
  6988. }
  6989. return $selected;
  6990. }
  6991. }
  6992. <?php
  6993. namespace Composer\DependencyResolver\Operation;
  6994. use Composer\Package\PackageInterface;
  6995. class InstallOperation extends SolverOperation
  6996. {
  6997. protected $package;
  6998. public function __construct(PackageInterface $package, $reason = null)
  6999. {
  7000. parent::__construct($reason);
  7001. $this->package = $package;
  7002. }
  7003. public function getPackage()
  7004. {
  7005. return $this->package;
  7006. }
  7007. public function getJobType()
  7008. {
  7009. return 'install';
  7010. }
  7011. public function __toString()
  7012. {
  7013. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7014. }
  7015. }
  7016. <?php
  7017. namespace Composer\DependencyResolver\Operation;
  7018. use Composer\Package\AliasPackage;
  7019. use Composer\Package\PackageInterface;
  7020. class MarkAliasInstalledOperation extends SolverOperation
  7021. {
  7022. protected $package;
  7023. public function __construct(AliasPackage $package, $reason = null)
  7024. {
  7025. parent::__construct($reason);
  7026. $this->package = $package;
  7027. }
  7028. public function getPackage()
  7029. {
  7030. return $this->package;
  7031. }
  7032. public function getJobType()
  7033. {
  7034. return 'markAliasInstalled';
  7035. }
  7036. public function __toString()
  7037. {
  7038. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7039. }
  7040. }
  7041. <?php
  7042. namespace Composer\DependencyResolver\Operation;
  7043. use Composer\Package\AliasPackage;
  7044. use Composer\Package\PackageInterface;
  7045. class MarkAliasUninstalledOperation extends SolverOperation
  7046. {
  7047. protected $package;
  7048. public function __construct(AliasPackage $package, $reason = null)
  7049. {
  7050. parent::__construct($reason);
  7051. $this->package = $package;
  7052. }
  7053. public function getPackage()
  7054. {
  7055. return $this->package;
  7056. }
  7057. public function getJobType()
  7058. {
  7059. return 'markAliasUninstalled';
  7060. }
  7061. public function __toString()
  7062. {
  7063. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7064. }
  7065. }
  7066. <?php
  7067. namespace Composer\DependencyResolver\Operation;
  7068. interface OperationInterface
  7069. {
  7070. public function getJobType();
  7071. public function getReason();
  7072. public function __toString();
  7073. }
  7074. <?php
  7075. namespace Composer\DependencyResolver\Operation;
  7076. use Composer\Package\PackageInterface;
  7077. abstract class SolverOperation implements OperationInterface
  7078. {
  7079. protected $reason;
  7080. public function __construct($reason = null)
  7081. {
  7082. $this->reason = $reason;
  7083. }
  7084. public function getReason()
  7085. {
  7086. return $this->reason;
  7087. }
  7088. protected function formatVersion(PackageInterface $package)
  7089. {
  7090. return $package->getFullPrettyVersion();
  7091. }
  7092. }
  7093. <?php
  7094. namespace Composer\DependencyResolver\Operation;
  7095. use Composer\Package\PackageInterface;
  7096. class UninstallOperation extends SolverOperation
  7097. {
  7098. protected $package;
  7099. public function __construct(PackageInterface $package, $reason = null)
  7100. {
  7101. parent::__construct($reason);
  7102. $this->package = $package;
  7103. }
  7104. public function getPackage()
  7105. {
  7106. return $this->package;
  7107. }
  7108. public function getJobType()
  7109. {
  7110. return 'uninstall';
  7111. }
  7112. public function __toString()
  7113. {
  7114. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7115. }
  7116. }
  7117. <?php
  7118. namespace Composer\DependencyResolver\Operation;
  7119. use Composer\Package\PackageInterface;
  7120. class UpdateOperation extends SolverOperation
  7121. {
  7122. protected $initialPackage;
  7123. protected $targetPackage;
  7124. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7125. {
  7126. parent::__construct($reason);
  7127. $this->initialPackage = $initial;
  7128. $this->targetPackage = $target;
  7129. }
  7130. public function getInitialPackage()
  7131. {
  7132. return $this->initialPackage;
  7133. }
  7134. public function getTargetPackage()
  7135. {
  7136. return $this->targetPackage;
  7137. }
  7138. public function getJobType()
  7139. {
  7140. return 'update';
  7141. }
  7142. public function __toString()
  7143. {
  7144. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7145. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7146. }
  7147. }
  7148. <?php
  7149. namespace Composer\DependencyResolver;
  7150. use Composer\Package\PackageInterface;
  7151. interface PolicyInterface
  7152. {
  7153. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7154. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7155. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7156. }
  7157. <?php
  7158. namespace Composer\DependencyResolver;
  7159. use Composer\Package\BasePackage;
  7160. use Composer\Package\AliasPackage;
  7161. use Composer\Package\Version\VersionParser;
  7162. use Composer\Semver\Constraint\ConstraintInterface;
  7163. use Composer\Semver\Constraint\Constraint;
  7164. use Composer\Semver\Constraint\EmptyConstraint;
  7165. use Composer\Repository\RepositoryInterface;
  7166. use Composer\Repository\CompositeRepository;
  7167. use Composer\Repository\ComposerRepository;
  7168. use Composer\Repository\InstalledRepositoryInterface;
  7169. use Composer\Repository\PlatformRepository;
  7170. use Composer\Package\PackageInterface;
  7171. class Pool implements \Countable
  7172. {
  7173. const MATCH_NAME = -1;
  7174. const MATCH_NONE = 0;
  7175. const MATCH = 1;
  7176. const MATCH_PROVIDE = 2;
  7177. const MATCH_REPLACE = 3;
  7178. const MATCH_FILTERED = 4;
  7179. protected $repositories = array();
  7180. protected $providerRepos = array();
  7181. protected $packages = array();
  7182. protected $packageByName = array();
  7183. protected $packageByExactName = array();
  7184. protected $acceptableStabilities;
  7185. protected $stabilityFlags;
  7186. protected $versionParser;
  7187. protected $providerCache = array();
  7188. protected $filterRequires;
  7189. protected $whitelist = null;
  7190. protected $id = 1;
  7191. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7192. {
  7193. $this->versionParser = new VersionParser;
  7194. $this->acceptableStabilities = array();
  7195. foreach (BasePackage::$stabilities as $stability => $value) {
  7196. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7197. $this->acceptableStabilities[$stability] = $value;
  7198. }
  7199. }
  7200. $this->stabilityFlags = $stabilityFlags;
  7201. $this->filterRequires = $filterRequires;
  7202. foreach ($filterRequires as $name => $constraint) {
  7203. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7204. unset($this->filterRequires[$name]);
  7205. }
  7206. }
  7207. }
  7208. public function setWhitelist($whitelist)
  7209. {
  7210. $this->whitelist = $whitelist;
  7211. $this->providerCache = array();
  7212. }
  7213. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7214. {
  7215. if ($repo instanceof CompositeRepository) {
  7216. $repos = $repo->getRepositories();
  7217. } else {
  7218. $repos = array($repo);
  7219. }
  7220. foreach ($repos as $repo) {
  7221. $this->repositories[] = $repo;
  7222. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7223. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7224. $this->providerRepos[] = $repo;
  7225. $repo->setRootAliases($rootAliases);
  7226. $repo->resetPackageIds();
  7227. } else {
  7228. foreach ($repo->getPackages() as $package) {
  7229. $names = $package->getNames();
  7230. $stability = $package->getStability();
  7231. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7232. $package->setId($this->id++);
  7233. $this->packages[] = $package;
  7234. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7235. foreach ($names as $provided) {
  7236. $this->packageByName[$provided][] = $package;
  7237. }
  7238. $name = $package->getName();
  7239. if (isset($rootAliases[$name][$package->getVersion()])) {
  7240. $alias = $rootAliases[$name][$package->getVersion()];
  7241. if ($package instanceof AliasPackage) {
  7242. $package = $package->getAliasOf();
  7243. }
  7244. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7245. $aliasPackage->setRootPackageAlias(true);
  7246. $aliasPackage->setId($this->id++);
  7247. $package->getRepository()->addPackage($aliasPackage);
  7248. $this->packages[] = $aliasPackage;
  7249. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7250. foreach ($aliasPackage->getNames() as $name) {
  7251. $this->packageByName[$name][] = $aliasPackage;
  7252. }
  7253. }
  7254. }
  7255. }
  7256. }
  7257. }
  7258. }
  7259. public function getPriority(RepositoryInterface $repo)
  7260. {
  7261. $priority = array_search($repo, $this->repositories, true);
  7262. if (false === $priority) {
  7263. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  7264. }
  7265. return -$priority;
  7266. }
  7267. public function packageById($id)
  7268. {
  7269. return $this->packages[$id - 1];
  7270. }
  7271. public function count()
  7272. {
  7273. return count($this->packages);
  7274. }
  7275. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  7276. {
  7277. if ($bypassFilters) {
  7278. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  7279. }
  7280. $key = ((int) $mustMatchName).$constraint;
  7281. if (isset($this->providerCache[$name][$key])) {
  7282. return $this->providerCache[$name][$key];
  7283. }
  7284. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  7285. }
  7286. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  7287. {
  7288. $candidates = array();
  7289. foreach ($this->providerRepos as $repo) {
  7290. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  7291. $candidates[] = $candidate;
  7292. if ($candidate->id < 1) {
  7293. $candidate->setId($this->id++);
  7294. $this->packages[$this->id - 2] = $candidate;
  7295. }
  7296. }
  7297. }
  7298. if ($mustMatchName) {
  7299. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  7300. return $candidate->getName() == $name;
  7301. });
  7302. if (isset($this->packageByExactName[$name])) {
  7303. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  7304. }
  7305. } elseif (isset($this->packageByName[$name])) {
  7306. $candidates = array_merge($candidates, $this->packageByName[$name]);
  7307. }
  7308. $matches = $provideMatches = array();
  7309. $nameMatch = false;
  7310. foreach ($candidates as $candidate) {
  7311. $aliasOfCandidate = null;
  7312. if ($candidate instanceof AliasPackage) {
  7313. $aliasOfCandidate = $candidate->getAliasOf();
  7314. }
  7315. if ($this->whitelist !== null && !$bypassFilters && (
  7316. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  7317. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  7318. )) {
  7319. continue;
  7320. }
  7321. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  7322. case self::MATCH_NONE:
  7323. break;
  7324. case self::MATCH_NAME:
  7325. $nameMatch = true;
  7326. break;
  7327. case self::MATCH:
  7328. $nameMatch = true;
  7329. $matches[] = $candidate;
  7330. break;
  7331. case self::MATCH_PROVIDE:
  7332. $provideMatches[] = $candidate;
  7333. break;
  7334. case self::MATCH_REPLACE:
  7335. $matches[] = $candidate;
  7336. break;
  7337. case self::MATCH_FILTERED:
  7338. break;
  7339. default:
  7340. throw new \UnexpectedValueException('Unexpected match type');
  7341. }
  7342. }
  7343. if ($nameMatch) {
  7344. return $matches;
  7345. }
  7346. return array_merge($matches, $provideMatches);
  7347. }
  7348. public function literalToPackage($literal)
  7349. {
  7350. $packageId = abs($literal);
  7351. return $this->packageById($packageId);
  7352. }
  7353. public function literalToPrettyString($literal, $installedMap)
  7354. {
  7355. $package = $this->literalToPackage($literal);
  7356. if (isset($installedMap[$package->id])) {
  7357. $prefix = ($literal > 0 ? 'keep' : 'remove');
  7358. } else {
  7359. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  7360. }
  7361. return $prefix.' '.$package->getPrettyString();
  7362. }
  7363. public function isPackageAcceptable($name, $stability)
  7364. {
  7365. foreach ((array) $name as $n) {
  7366. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  7367. return true;
  7368. }
  7369. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  7370. return true;
  7371. }
  7372. }
  7373. return false;
  7374. }
  7375. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  7376. {
  7377. $candidateName = $candidate->getName();
  7378. $candidateVersion = $candidate->getVersion();
  7379. $isDev = $candidate->getStability() === 'dev';
  7380. $isAlias = $candidate instanceof AliasPackage;
  7381. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  7382. $requireFilter = $this->filterRequires[$name];
  7383. } else {
  7384. $requireFilter = new EmptyConstraint;
  7385. }
  7386. if ($candidateName === $name) {
  7387. $pkgConstraint = new Constraint('==', $candidateVersion);
  7388. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  7389. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  7390. }
  7391. return self::MATCH_NAME;
  7392. }
  7393. $provides = $candidate->getProvides();
  7394. $replaces = $candidate->getReplaces();
  7395. if (isset($replaces[0]) || isset($provides[0])) {
  7396. foreach ($provides as $link) {
  7397. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7398. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7399. }
  7400. }
  7401. foreach ($replaces as $link) {
  7402. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7403. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7404. }
  7405. }
  7406. return self::MATCH_NONE;
  7407. }
  7408. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  7409. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7410. }
  7411. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  7412. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7413. }
  7414. return self::MATCH_NONE;
  7415. }
  7416. }
  7417. <?php
  7418. namespace Composer\DependencyResolver;
  7419. class Problem
  7420. {
  7421. protected $reasonSeen;
  7422. protected $reasons = array();
  7423. protected $section = 0;
  7424. protected $pool;
  7425. public function __construct(Pool $pool)
  7426. {
  7427. $this->pool = $pool;
  7428. }
  7429. public function addRule(Rule $rule)
  7430. {
  7431. $this->addReason(spl_object_hash($rule), array(
  7432. 'rule' => $rule,
  7433. 'job' => $rule->getJob(),
  7434. ));
  7435. }
  7436. public function getReasons()
  7437. {
  7438. return $this->reasons;
  7439. }
  7440. public function getPrettyString(array $installedMap = array())
  7441. {
  7442. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  7443. if (count($reasons) === 1) {
  7444. reset($reasons);
  7445. $reason = current($reasons);
  7446. $rule = $reason['rule'];
  7447. $job = $reason['job'];
  7448. if (isset($job['constraint'])) {
  7449. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7450. } else {
  7451. $packages = array();
  7452. }
  7453. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  7454. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  7455. $available = $this->pool->whatProvides($job['packageName']);
  7456. $version = count($available) ? $available[0]->getPrettyVersion() : phpversion();
  7457. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  7458. if (defined('HHVM_VERSION')) {
  7459. return $msg . 'your HHVM version does not satisfy that requirement.';
  7460. }
  7461. if ($job['packageName'] === 'hhvm') {
  7462. return $msg . 'you are running this with PHP and not HHVM.';
  7463. }
  7464. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  7465. }
  7466. if (0 === stripos($job['packageName'], 'ext-')) {
  7467. $ext = substr($job['packageName'], 4);
  7468. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7469. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  7470. }
  7471. if (0 === stripos($job['packageName'], 'lib-')) {
  7472. if (strtolower($job['packageName']) === 'lib-icu') {
  7473. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  7474. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  7475. }
  7476. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  7477. }
  7478. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  7479. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  7480. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  7481. }
  7482. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  7483. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  7484. }
  7485. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  7486. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  7487. }
  7488. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  7489. }
  7490. }
  7491. $messages = array();
  7492. foreach ($reasons as $reason) {
  7493. $rule = $reason['rule'];
  7494. $job = $reason['job'];
  7495. if ($job) {
  7496. $messages[] = $this->jobToText($job);
  7497. } elseif ($rule) {
  7498. if ($rule instanceof Rule) {
  7499. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  7500. }
  7501. }
  7502. }
  7503. return "\n - ".implode("\n - ", $messages);
  7504. }
  7505. protected function addReason($id, $reason)
  7506. {
  7507. if (!isset($this->reasonSeen[$id])) {
  7508. $this->reasonSeen[$id] = true;
  7509. $this->reasons[$this->section][] = $reason;
  7510. }
  7511. }
  7512. public function nextSection()
  7513. {
  7514. $this->section++;
  7515. }
  7516. protected function jobToText($job)
  7517. {
  7518. switch ($job['cmd']) {
  7519. case 'install':
  7520. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7521. if (!$packages) {
  7522. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  7523. }
  7524. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  7525. case 'update':
  7526. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  7527. case 'remove':
  7528. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  7529. }
  7530. if (isset($job['constraint'])) {
  7531. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7532. } else {
  7533. $packages = array();
  7534. }
  7535. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  7536. }
  7537. protected function getPackageList($packages)
  7538. {
  7539. $prepared = array();
  7540. foreach ($packages as $package) {
  7541. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7542. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7543. }
  7544. foreach ($prepared as $name => $package) {
  7545. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7546. }
  7547. return implode(', ', $prepared);
  7548. }
  7549. protected function constraintToText($constraint)
  7550. {
  7551. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  7552. }
  7553. }
  7554. <?php
  7555. namespace Composer\DependencyResolver;
  7556. use Composer\Semver\Constraint\ConstraintInterface;
  7557. class Request
  7558. {
  7559. protected $jobs;
  7560. public function __construct()
  7561. {
  7562. $this->jobs = array();
  7563. }
  7564. public function install($packageName, ConstraintInterface $constraint = null)
  7565. {
  7566. $this->addJob($packageName, 'install', $constraint);
  7567. }
  7568. public function update($packageName, ConstraintInterface $constraint = null)
  7569. {
  7570. $this->addJob($packageName, 'update', $constraint);
  7571. }
  7572. public function remove($packageName, ConstraintInterface $constraint = null)
  7573. {
  7574. $this->addJob($packageName, 'remove', $constraint);
  7575. }
  7576. public function fix($packageName, ConstraintInterface $constraint = null)
  7577. {
  7578. $this->addJob($packageName, 'install', $constraint, true);
  7579. }
  7580. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  7581. {
  7582. $packageName = strtolower($packageName);
  7583. $this->jobs[] = array(
  7584. 'cmd' => $cmd,
  7585. 'packageName' => $packageName,
  7586. 'constraint' => $constraint,
  7587. 'fixed' => $fixed,
  7588. );
  7589. }
  7590. public function updateAll()
  7591. {
  7592. $this->jobs[] = array('cmd' => 'update-all');
  7593. }
  7594. public function getJobs()
  7595. {
  7596. return $this->jobs;
  7597. }
  7598. }
  7599. <?php
  7600. namespace Composer\DependencyResolver;
  7601. use Composer\Package\CompletePackage;
  7602. use Composer\Package\PackageInterface;
  7603. use Composer\Package\Link;
  7604. class Rule
  7605. {
  7606. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  7607. const RULE_JOB_INSTALL = 2;
  7608. const RULE_JOB_REMOVE = 3;
  7609. const RULE_PACKAGE_CONFLICT = 6;
  7610. const RULE_PACKAGE_REQUIRES = 7;
  7611. const RULE_PACKAGE_OBSOLETES = 8;
  7612. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  7613. const RULE_PACKAGE_SAME_NAME = 10;
  7614. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  7615. const RULE_LEARNED = 12;
  7616. const RULE_PACKAGE_ALIAS = 13;
  7617. const BITFIELD_TYPE = 0;
  7618. const BITFIELD_REASON = 8;
  7619. const BITFIELD_DISABLED = 16;
  7620. public $literals;
  7621. protected $bitfield;
  7622. protected $reasonData;
  7623. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7624. {
  7625. sort($literals);
  7626. $this->literals = $literals;
  7627. $this->reasonData = $reasonData;
  7628. if ($job) {
  7629. $this->job = $job;
  7630. }
  7631. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  7632. ($reason << self::BITFIELD_REASON) |
  7633. (255 << self::BITFIELD_TYPE);
  7634. }
  7635. public function getHash()
  7636. {
  7637. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7638. return $data['hash'];
  7639. }
  7640. public function getJob()
  7641. {
  7642. return isset($this->job) ? $this->job : null;
  7643. }
  7644. public function getReason()
  7645. {
  7646. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  7647. }
  7648. public function getReasonData()
  7649. {
  7650. return $this->reasonData;
  7651. }
  7652. public function getRequiredPackage()
  7653. {
  7654. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  7655. return $this->reasonData;
  7656. }
  7657. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  7658. return $this->reasonData->getTarget();
  7659. }
  7660. }
  7661. public function equals(Rule $rule)
  7662. {
  7663. if (count($this->literals) != count($rule->literals)) {
  7664. return false;
  7665. }
  7666. for ($i = 0, $n = count($this->literals); $i < $n; $i++) {
  7667. if ($this->literals[$i] !== $rule->literals[$i]) {
  7668. return false;
  7669. }
  7670. }
  7671. return true;
  7672. }
  7673. public function setType($type)
  7674. {
  7675. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  7676. }
  7677. public function getType()
  7678. {
  7679. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  7680. }
  7681. public function disable()
  7682. {
  7683. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  7684. }
  7685. public function enable()
  7686. {
  7687. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  7688. }
  7689. public function isDisabled()
  7690. {
  7691. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7692. }
  7693. public function isEnabled()
  7694. {
  7695. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7696. }
  7697. public function isAssertion()
  7698. {
  7699. return 1 === count($this->literals);
  7700. }
  7701. public function getPrettyString(Pool $pool, array $installedMap = array())
  7702. {
  7703. $ruleText = '';
  7704. foreach ($this->literals as $i => $literal) {
  7705. if ($i != 0) {
  7706. $ruleText .= '|';
  7707. }
  7708. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  7709. }
  7710. switch ($this->getReason()) {
  7711. case self::RULE_INTERNAL_ALLOW_UPDATE:
  7712. return $ruleText;
  7713. case self::RULE_JOB_INSTALL:
  7714. return "Install command rule ($ruleText)";
  7715. case self::RULE_JOB_REMOVE:
  7716. return "Remove command rule ($ruleText)";
  7717. case self::RULE_PACKAGE_CONFLICT:
  7718. $package1 = $pool->literalToPackage($this->literals[0]);
  7719. $package2 = $pool->literalToPackage($this->literals[1]);
  7720. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  7721. case self::RULE_PACKAGE_REQUIRES:
  7722. $literals = $this->literals;
  7723. $sourceLiteral = array_shift($literals);
  7724. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  7725. $requires = array();
  7726. foreach ($literals as $literal) {
  7727. $requires[] = $pool->literalToPackage($literal);
  7728. }
  7729. $text = $this->reasonData->getPrettyString($sourcePackage);
  7730. if ($requires) {
  7731. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  7732. } else {
  7733. $targetName = $this->reasonData->getTarget();
  7734. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  7735. if (defined('HHVM_VERSION')) {
  7736. return $text . ' -> your HHVM version does not satisfy that requirement.';
  7737. }
  7738. if ($targetName === 'hhvm') {
  7739. return $text . ' -> you are running this with PHP and not HHVM.';
  7740. }
  7741. $packages = $pool->whatProvides($targetName);
  7742. $package = count($packages) ? current($packages) : phpversion();
  7743. if (!($package instanceof CompletePackage)) {
  7744. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  7745. }
  7746. $extra = $package->getExtra();
  7747. if (!empty($extra['config.platform'])) {
  7748. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7749. } else {
  7750. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7751. }
  7752. return $text;
  7753. }
  7754. if (0 === strpos($targetName, 'ext-')) {
  7755. $ext = substr($targetName, 4);
  7756. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7757. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  7758. }
  7759. if (0 === strpos($targetName, 'lib-')) {
  7760. $lib = substr($targetName, 4);
  7761. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  7762. }
  7763. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  7764. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  7765. }
  7766. return $text . ' -> no matching package found.';
  7767. }
  7768. return $text;
  7769. case self::RULE_PACKAGE_OBSOLETES:
  7770. return $ruleText;
  7771. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  7772. return $ruleText;
  7773. case self::RULE_PACKAGE_SAME_NAME:
  7774. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $this->literals) . '.';
  7775. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  7776. return $ruleText;
  7777. case self::RULE_LEARNED:
  7778. return 'Conclusion: '.$ruleText;
  7779. case self::RULE_PACKAGE_ALIAS:
  7780. return $ruleText;
  7781. default:
  7782. return '('.$ruleText.')';
  7783. }
  7784. }
  7785. protected function formatPackagesUnique($pool, array $packages)
  7786. {
  7787. $prepared = array();
  7788. foreach ($packages as $package) {
  7789. if (!is_object($package)) {
  7790. $package = $pool->literalToPackage($package);
  7791. }
  7792. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7793. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7794. }
  7795. foreach ($prepared as $name => $package) {
  7796. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7797. }
  7798. return implode(', ', $prepared);
  7799. }
  7800. public function __toString()
  7801. {
  7802. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7803. foreach ($this->literals as $i => $literal) {
  7804. if ($i != 0) {
  7805. $result .= '|';
  7806. }
  7807. $result .= $literal;
  7808. }
  7809. $result .= ')';
  7810. return $result;
  7811. }
  7812. }
  7813. <?php
  7814. namespace Composer\DependencyResolver;
  7815. class RuleSet implements \IteratorAggregate, \Countable
  7816. {
  7817. const TYPE_PACKAGE = 0;
  7818. const TYPE_JOB = 1;
  7819. const TYPE_LEARNED = 4;
  7820. public $ruleById;
  7821. protected static $types = array(
  7822. 255 => 'UNKNOWN',
  7823. self::TYPE_PACKAGE => 'PACKAGE',
  7824. self::TYPE_JOB => 'JOB',
  7825. self::TYPE_LEARNED => 'LEARNED',
  7826. );
  7827. protected $rules;
  7828. protected $nextRuleId;
  7829. protected $rulesByHash;
  7830. public function __construct()
  7831. {
  7832. $this->nextRuleId = 0;
  7833. foreach ($this->getTypes() as $type) {
  7834. $this->rules[$type] = array();
  7835. }
  7836. $this->rulesByHash = array();
  7837. }
  7838. public function add(Rule $rule, $type)
  7839. {
  7840. if (!isset(self::$types[$type])) {
  7841. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  7842. }
  7843. $hash = $rule->getHash();
  7844. if (isset($this->rulesByHash[$hash])) {
  7845. $potentialDuplicates = $this->rulesByHash[$hash];
  7846. foreach ($potentialDuplicates as $potentialDuplicate) {
  7847. if ($rule->equals($potentialDuplicate)) {
  7848. return;
  7849. }
  7850. }
  7851. }
  7852. if (!isset($this->rules[$type])) {
  7853. $this->rules[$type] = array();
  7854. }
  7855. $this->rules[$type][] = $rule;
  7856. $this->ruleById[$this->nextRuleId] = $rule;
  7857. $rule->setType($type);
  7858. $this->nextRuleId++;
  7859. if (!isset($this->rulesByHash[$hash])) {
  7860. $this->rulesByHash[$hash] = array($rule);
  7861. } else {
  7862. $this->rulesByHash[$hash][] = $rule;
  7863. }
  7864. }
  7865. public function count()
  7866. {
  7867. return $this->nextRuleId;
  7868. }
  7869. public function ruleById($id)
  7870. {
  7871. return $this->ruleById[$id];
  7872. }
  7873. public function getRules()
  7874. {
  7875. return $this->rules;
  7876. }
  7877. public function getIterator()
  7878. {
  7879. return new RuleSetIterator($this->getRules());
  7880. }
  7881. public function getIteratorFor($types)
  7882. {
  7883. if (!is_array($types)) {
  7884. $types = array($types);
  7885. }
  7886. $allRules = $this->getRules();
  7887. $rules = array();
  7888. foreach ($types as $type) {
  7889. $rules[$type] = $allRules[$type];
  7890. }
  7891. return new RuleSetIterator($rules);
  7892. }
  7893. public function getIteratorWithout($types)
  7894. {
  7895. if (!is_array($types)) {
  7896. $types = array($types);
  7897. }
  7898. $rules = $this->getRules();
  7899. foreach ($types as $type) {
  7900. unset($rules[$type]);
  7901. }
  7902. return new RuleSetIterator($rules);
  7903. }
  7904. public function getTypes()
  7905. {
  7906. $types = self::$types;
  7907. unset($types[255]);
  7908. return array_keys($types);
  7909. }
  7910. public function getPrettyString(Pool $pool = null)
  7911. {
  7912. $string = "\n";
  7913. foreach ($this->rules as $type => $rules) {
  7914. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  7915. foreach ($rules as $rule) {
  7916. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  7917. }
  7918. $string .= "\n\n";
  7919. }
  7920. return $string;
  7921. }
  7922. public function __toString()
  7923. {
  7924. return $this->getPrettyString(null);
  7925. }
  7926. }
  7927. <?php
  7928. namespace Composer\DependencyResolver;
  7929. use Composer\Package\PackageInterface;
  7930. use Composer\Package\AliasPackage;
  7931. use Composer\Repository\PlatformRepository;
  7932. class RuleSetGenerator
  7933. {
  7934. protected $policy;
  7935. protected $pool;
  7936. protected $rules;
  7937. protected $jobs;
  7938. protected $installedMap;
  7939. protected $whitelistedMap;
  7940. protected $addedMap;
  7941. public function __construct(PolicyInterface $policy, Pool $pool)
  7942. {
  7943. $this->policy = $policy;
  7944. $this->pool = $pool;
  7945. }
  7946. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  7947. {
  7948. $literals = array(-$package->id);
  7949. foreach ($providers as $provider) {
  7950. if ($provider === $package) {
  7951. return null;
  7952. }
  7953. $literals[] = $provider->id;
  7954. }
  7955. return new Rule($literals, $reason, $reasonData);
  7956. }
  7957. protected function createInstallOneOfRule(array $packages, $reason, $job)
  7958. {
  7959. $literals = array();
  7960. foreach ($packages as $package) {
  7961. $literals[] = $package->id;
  7962. }
  7963. return new Rule($literals, $reason, $job['packageName'], $job);
  7964. }
  7965. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  7966. {
  7967. return new Rule(array(-$package->id), $reason, $job['packageName'], $job);
  7968. }
  7969. protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  7970. {
  7971. if ($issuer === $provider) {
  7972. return null;
  7973. }
  7974. return new Rule(array(-$issuer->id, -$provider->id), $reason, $reasonData);
  7975. }
  7976. private function addRule($type, Rule $newRule = null)
  7977. {
  7978. if (!$newRule) {
  7979. return;
  7980. }
  7981. $this->rules->add($newRule, $type);
  7982. }
  7983. protected function whitelistFromPackage(PackageInterface $package)
  7984. {
  7985. $workQueue = new \SplQueue;
  7986. $workQueue->enqueue($package);
  7987. while (!$workQueue->isEmpty()) {
  7988. $package = $workQueue->dequeue();
  7989. if (isset($this->whitelistedMap[$package->id])) {
  7990. continue;
  7991. }
  7992. $this->whitelistedMap[$package->id] = true;
  7993. foreach ($package->getRequires() as $link) {
  7994. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  7995. foreach ($possibleRequires as $require) {
  7996. $workQueue->enqueue($require);
  7997. }
  7998. }
  7999. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8000. foreach ($obsoleteProviders as $provider) {
  8001. if ($provider === $package) {
  8002. continue;
  8003. }
  8004. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8005. $workQueue->enqueue($provider);
  8006. }
  8007. }
  8008. }
  8009. }
  8010. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8011. {
  8012. $workQueue = new \SplQueue;
  8013. $workQueue->enqueue($package);
  8014. while (!$workQueue->isEmpty()) {
  8015. $package = $workQueue->dequeue();
  8016. if (isset($this->addedMap[$package->id])) {
  8017. continue;
  8018. }
  8019. $this->addedMap[$package->id] = true;
  8020. foreach ($package->getRequires() as $link) {
  8021. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8022. continue;
  8023. }
  8024. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8025. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8026. foreach ($possibleRequires as $require) {
  8027. $workQueue->enqueue($require);
  8028. }
  8029. }
  8030. foreach ($package->getConflicts() as $link) {
  8031. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8032. foreach ($possibleConflicts as $conflict) {
  8033. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8034. }
  8035. }
  8036. $isInstalled = (isset($this->installedMap[$package->id]));
  8037. foreach ($package->getReplaces() as $link) {
  8038. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8039. foreach ($obsoleteProviders as $provider) {
  8040. if ($provider === $package) {
  8041. continue;
  8042. }
  8043. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8044. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8045. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, $link));
  8046. }
  8047. }
  8048. }
  8049. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  8050. foreach ($obsoleteProviders as $provider) {
  8051. if ($provider === $package) {
  8052. continue;
  8053. }
  8054. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8055. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8056. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8057. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8058. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, $package));
  8059. }
  8060. }
  8061. }
  8062. }
  8063. protected function obsoleteImpossibleForAlias($package, $provider)
  8064. {
  8065. $packageIsAlias = $package instanceof AliasPackage;
  8066. $providerIsAlias = $provider instanceof AliasPackage;
  8067. $impossible = (
  8068. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8069. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8070. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8071. );
  8072. return $impossible;
  8073. }
  8074. protected function whitelistFromJobs()
  8075. {
  8076. foreach ($this->jobs as $job) {
  8077. switch ($job['cmd']) {
  8078. case 'install':
  8079. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8080. foreach ($packages as $package) {
  8081. $this->whitelistFromPackage($package);
  8082. }
  8083. break;
  8084. }
  8085. }
  8086. }
  8087. protected function addRulesForJobs($ignorePlatformReqs)
  8088. {
  8089. foreach ($this->jobs as $job) {
  8090. switch ($job['cmd']) {
  8091. case 'install':
  8092. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8093. continue;
  8094. }
  8095. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8096. if ($packages) {
  8097. foreach ($packages as $package) {
  8098. if (!isset($this->installedMap[$package->id])) {
  8099. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8100. }
  8101. }
  8102. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8103. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8104. }
  8105. break;
  8106. case 'remove':
  8107. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8108. foreach ($packages as $package) {
  8109. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8110. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8111. }
  8112. break;
  8113. }
  8114. }
  8115. }
  8116. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8117. {
  8118. $this->jobs = $jobs;
  8119. $this->rules = new RuleSet;
  8120. $this->installedMap = $installedMap;
  8121. $this->whitelistedMap = array();
  8122. foreach ($this->installedMap as $package) {
  8123. $this->whitelistFromPackage($package);
  8124. }
  8125. $this->whitelistFromJobs();
  8126. $this->pool->setWhitelist($this->whitelistedMap);
  8127. $this->addedMap = array();
  8128. foreach ($this->installedMap as $package) {
  8129. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8130. }
  8131. $this->addRulesForJobs($ignorePlatformReqs);
  8132. return $this->rules;
  8133. }
  8134. }
  8135. <?php
  8136. namespace Composer\DependencyResolver;
  8137. class RuleSetIterator implements \Iterator
  8138. {
  8139. protected $rules;
  8140. protected $types;
  8141. protected $currentOffset;
  8142. protected $currentType;
  8143. protected $currentTypeOffset;
  8144. public function __construct(array $rules)
  8145. {
  8146. $this->rules = $rules;
  8147. $this->types = array_keys($rules);
  8148. sort($this->types);
  8149. $this->rewind();
  8150. }
  8151. public function current()
  8152. {
  8153. return $this->rules[$this->currentType][$this->currentOffset];
  8154. }
  8155. public function key()
  8156. {
  8157. return $this->currentType;
  8158. }
  8159. public function next()
  8160. {
  8161. $this->currentOffset++;
  8162. if (!isset($this->rules[$this->currentType])) {
  8163. return;
  8164. }
  8165. if ($this->currentOffset >= sizeof($this->rules[$this->currentType])) {
  8166. $this->currentOffset = 0;
  8167. do {
  8168. $this->currentTypeOffset++;
  8169. if (!isset($this->types[$this->currentTypeOffset])) {
  8170. $this->currentType = -1;
  8171. break;
  8172. }
  8173. $this->currentType = $this->types[$this->currentTypeOffset];
  8174. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  8175. }
  8176. }
  8177. public function rewind()
  8178. {
  8179. $this->currentOffset = 0;
  8180. $this->currentTypeOffset = -1;
  8181. $this->currentType = -1;
  8182. do {
  8183. $this->currentTypeOffset++;
  8184. if (!isset($this->types[$this->currentTypeOffset])) {
  8185. $this->currentType = -1;
  8186. break;
  8187. }
  8188. $this->currentType = $this->types[$this->currentTypeOffset];
  8189. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  8190. }
  8191. public function valid()
  8192. {
  8193. return isset($this->rules[$this->currentType])
  8194. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8195. }
  8196. }
  8197. <?php
  8198. namespace Composer\DependencyResolver;
  8199. class RuleWatchChain extends \SplDoublyLinkedList
  8200. {
  8201. protected $offset = 0;
  8202. public function seek($offset)
  8203. {
  8204. $this->rewind();
  8205. for ($i = 0; $i < $offset; $i++, $this->next());
  8206. }
  8207. public function remove()
  8208. {
  8209. $offset = $this->key();
  8210. $this->offsetUnset($offset);
  8211. $this->seek($offset);
  8212. }
  8213. }
  8214. <?php
  8215. namespace Composer\DependencyResolver;
  8216. class RuleWatchGraph
  8217. {
  8218. protected $watchChains = array();
  8219. public function insert(RuleWatchNode $node)
  8220. {
  8221. if ($node->getRule()->isAssertion()) {
  8222. return;
  8223. }
  8224. foreach (array($node->watch1, $node->watch2) as $literal) {
  8225. if (!isset($this->watchChains[$literal])) {
  8226. $this->watchChains[$literal] = new RuleWatchChain;
  8227. }
  8228. $this->watchChains[$literal]->unshift($node);
  8229. }
  8230. }
  8231. public function propagateLiteral($decidedLiteral, $level, $decisions)
  8232. {
  8233. $literal = -$decidedLiteral;
  8234. if (!isset($this->watchChains[$literal])) {
  8235. return null;
  8236. }
  8237. $chain = $this->watchChains[$literal];
  8238. $chain->rewind();
  8239. while ($chain->valid()) {
  8240. $node = $chain->current();
  8241. $otherWatch = $node->getOtherWatch($literal);
  8242. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  8243. $ruleLiterals = $node->getRule()->literals;
  8244. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  8245. return $literal !== $ruleLiteral &&
  8246. $otherWatch !== $ruleLiteral &&
  8247. !$decisions->conflict($ruleLiteral);
  8248. });
  8249. if ($alternativeLiterals) {
  8250. reset($alternativeLiterals);
  8251. $this->moveWatch($literal, current($alternativeLiterals), $node);
  8252. continue;
  8253. }
  8254. if ($decisions->conflict($otherWatch)) {
  8255. return $node->getRule();
  8256. }
  8257. $decisions->decide($otherWatch, $level, $node->getRule());
  8258. }
  8259. $chain->next();
  8260. }
  8261. return null;
  8262. }
  8263. protected function moveWatch($fromLiteral, $toLiteral, $node)
  8264. {
  8265. if (!isset($this->watchChains[$toLiteral])) {
  8266. $this->watchChains[$toLiteral] = new RuleWatchChain;
  8267. }
  8268. $node->moveWatch($fromLiteral, $toLiteral);
  8269. $this->watchChains[$fromLiteral]->remove();
  8270. $this->watchChains[$toLiteral]->unshift($node);
  8271. }
  8272. }
  8273. <?php
  8274. namespace Composer\DependencyResolver;
  8275. class RuleWatchNode
  8276. {
  8277. public $watch1;
  8278. public $watch2;
  8279. protected $rule;
  8280. public function __construct($rule)
  8281. {
  8282. $this->rule = $rule;
  8283. $literals = $rule->literals;
  8284. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  8285. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  8286. }
  8287. public function watch2OnHighest(Decisions $decisions)
  8288. {
  8289. $literals = $this->rule->literals;
  8290. if (count($literals) < 3) {
  8291. return;
  8292. }
  8293. $watchLevel = 0;
  8294. foreach ($literals as $literal) {
  8295. $level = $decisions->decisionLevel($literal);
  8296. if ($level > $watchLevel) {
  8297. $this->watch2 = $literal;
  8298. $watchLevel = $level;
  8299. }
  8300. }
  8301. }
  8302. public function getRule()
  8303. {
  8304. return $this->rule;
  8305. }
  8306. public function getOtherWatch($literal)
  8307. {
  8308. if ($this->watch1 == $literal) {
  8309. return $this->watch2;
  8310. } else {
  8311. return $this->watch1;
  8312. }
  8313. }
  8314. public function moveWatch($from, $to)
  8315. {
  8316. if ($this->watch1 == $from) {
  8317. $this->watch1 = $to;
  8318. } else {
  8319. $this->watch2 = $to;
  8320. }
  8321. }
  8322. }
  8323. <?php
  8324. namespace Composer\DependencyResolver;
  8325. use Composer\IO\IOInterface;
  8326. use Composer\Repository\RepositoryInterface;
  8327. use Composer\Repository\PlatformRepository;
  8328. class Solver
  8329. {
  8330. const BRANCH_LITERALS = 0;
  8331. const BRANCH_LEVEL = 1;
  8332. protected $policy;
  8333. protected $pool;
  8334. protected $installed;
  8335. protected $rules;
  8336. protected $ruleSetGenerator;
  8337. protected $jobs;
  8338. protected $updateMap = array();
  8339. protected $watchGraph;
  8340. protected $decisions;
  8341. protected $installedMap;
  8342. protected $propagateIndex;
  8343. protected $branches = array();
  8344. protected $problems = array();
  8345. protected $learnedPool = array();
  8346. protected $learnedWhy = array();
  8347. protected $io;
  8348. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  8349. {
  8350. $this->io = $io;
  8351. $this->policy = $policy;
  8352. $this->pool = $pool;
  8353. $this->installed = $installed;
  8354. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  8355. }
  8356. public function getRuleSetSize()
  8357. {
  8358. return count($this->rules);
  8359. }
  8360. private function makeAssertionRuleDecisions()
  8361. {
  8362. $decisionStart = count($this->decisions) - 1;
  8363. $rulesCount = count($this->rules);
  8364. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  8365. $rule = $this->rules->ruleById[$ruleIndex];
  8366. if (!$rule->isAssertion() || $rule->isDisabled()) {
  8367. continue;
  8368. }
  8369. $literals = $rule->literals;
  8370. $literal = $literals[0];
  8371. if (!$this->decisions->decided(abs($literal))) {
  8372. $this->decisions->decide($literal, 1, $rule);
  8373. continue;
  8374. }
  8375. if ($this->decisions->satisfy($literal)) {
  8376. continue;
  8377. }
  8378. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  8379. $rule->disable();
  8380. continue;
  8381. }
  8382. $conflict = $this->decisions->decisionRule($literal);
  8383. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  8384. $problem = new Problem($this->pool);
  8385. $problem->addRule($rule);
  8386. $problem->addRule($conflict);
  8387. $this->disableProblem($rule);
  8388. $this->problems[] = $problem;
  8389. continue;
  8390. }
  8391. $problem = new Problem($this->pool);
  8392. $problem->addRule($rule);
  8393. $problem->addRule($conflict);
  8394. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  8395. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  8396. continue;
  8397. }
  8398. $assertRuleLiterals = $assertRule->literals;
  8399. $assertRuleLiteral = $assertRuleLiterals[0];
  8400. if (abs($literal) !== abs($assertRuleLiteral)) {
  8401. continue;
  8402. }
  8403. $problem->addRule($assertRule);
  8404. $this->disableProblem($assertRule);
  8405. }
  8406. $this->problems[] = $problem;
  8407. $this->decisions->resetToOffset($decisionStart);
  8408. $ruleIndex = -1;
  8409. }
  8410. }
  8411. protected function setupInstalledMap()
  8412. {
  8413. $this->installedMap = array();
  8414. foreach ($this->installed->getPackages() as $package) {
  8415. $this->installedMap[$package->id] = $package;
  8416. }
  8417. }
  8418. protected function checkForRootRequireProblems($ignorePlatformReqs)
  8419. {
  8420. foreach ($this->jobs as $job) {
  8421. switch ($job['cmd']) {
  8422. case 'update':
  8423. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8424. foreach ($packages as $package) {
  8425. if (isset($this->installedMap[$package->id])) {
  8426. $this->updateMap[$package->id] = true;
  8427. }
  8428. }
  8429. break;
  8430. case 'update-all':
  8431. foreach ($this->installedMap as $package) {
  8432. $this->updateMap[$package->id] = true;
  8433. }
  8434. break;
  8435. case 'install':
  8436. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8437. break;
  8438. }
  8439. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  8440. $problem = new Problem($this->pool);
  8441. $problem->addRule(new Rule(array(), null, null, $job));
  8442. $this->problems[] = $problem;
  8443. }
  8444. break;
  8445. }
  8446. }
  8447. }
  8448. public function solve(Request $request, $ignorePlatformReqs = false)
  8449. {
  8450. $this->jobs = $request->getJobs();
  8451. $this->setupInstalledMap();
  8452. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  8453. $this->checkForRootRequireProblems($ignorePlatformReqs);
  8454. $this->decisions = new Decisions($this->pool);
  8455. $this->watchGraph = new RuleWatchGraph;
  8456. foreach ($this->rules as $rule) {
  8457. $this->watchGraph->insert(new RuleWatchNode($rule));
  8458. }
  8459. $this->makeAssertionRuleDecisions();
  8460. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  8461. $before = microtime(true);
  8462. $this->runSat(true);
  8463. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  8464. foreach ($this->installedMap as $packageId => $void) {
  8465. if ($this->decisions->undecided($packageId)) {
  8466. $this->decisions->decide(-$packageId, 1, null);
  8467. }
  8468. }
  8469. if ($this->problems) {
  8470. throw new SolverProblemsException($this->problems, $this->installedMap);
  8471. }
  8472. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  8473. return $transaction->getOperations();
  8474. }
  8475. protected function propagate($level)
  8476. {
  8477. while ($this->decisions->validOffset($this->propagateIndex)) {
  8478. $decision = $this->decisions->atOffset($this->propagateIndex);
  8479. $conflict = $this->watchGraph->propagateLiteral(
  8480. $decision[Decisions::DECISION_LITERAL],
  8481. $level,
  8482. $this->decisions
  8483. );
  8484. $this->propagateIndex++;
  8485. if ($conflict) {
  8486. return $conflict;
  8487. }
  8488. }
  8489. return null;
  8490. }
  8491. private function revert($level)
  8492. {
  8493. while (!$this->decisions->isEmpty()) {
  8494. $literal = $this->decisions->lastLiteral();
  8495. if ($this->decisions->undecided($literal)) {
  8496. break;
  8497. }
  8498. $decisionLevel = $this->decisions->decisionLevel($literal);
  8499. if ($decisionLevel <= $level) {
  8500. break;
  8501. }
  8502. $this->decisions->revertLast();
  8503. $this->propagateIndex = count($this->decisions);
  8504. }
  8505. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  8506. array_pop($this->branches);
  8507. }
  8508. }
  8509. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  8510. {
  8511. $level++;
  8512. $this->decisions->decide($literal, $level, $rule);
  8513. while (true) {
  8514. $rule = $this->propagate($level);
  8515. if (!$rule) {
  8516. break;
  8517. }
  8518. if ($level == 1) {
  8519. return $this->analyzeUnsolvable($rule, $disableRules);
  8520. }
  8521. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  8522. if ($newLevel <= 0 || $newLevel >= $level) {
  8523. throw new SolverBugException(
  8524. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  8525. );
  8526. } elseif (!$newRule) {
  8527. throw new SolverBugException(
  8528. "No rule was learned from analyzing $rule at level $level."
  8529. );
  8530. }
  8531. $level = $newLevel;
  8532. $this->revert($level);
  8533. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  8534. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  8535. $ruleNode = new RuleWatchNode($newRule);
  8536. $ruleNode->watch2OnHighest($this->decisions);
  8537. $this->watchGraph->insert($ruleNode);
  8538. $this->decisions->decide($learnLiteral, $level, $newRule);
  8539. }
  8540. return $level;
  8541. }
  8542. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  8543. {
  8544. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  8545. $selectedLiteral = array_shift($literals);
  8546. if (count($literals)) {
  8547. $this->branches[] = array($literals, $level);
  8548. }
  8549. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  8550. }
  8551. protected function analyze($level, Rule $rule)
  8552. {
  8553. $analyzedRule = $rule;
  8554. $ruleLevel = 1;
  8555. $num = 0;
  8556. $l1num = 0;
  8557. $seen = array();
  8558. $learnedLiterals = array(null);
  8559. $decisionId = count($this->decisions);
  8560. $this->learnedPool[] = array();
  8561. while (true) {
  8562. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  8563. foreach ($rule->literals as $literal) {
  8564. if ($this->decisions->satisfy($literal)) {
  8565. continue;
  8566. }
  8567. if (isset($seen[abs($literal)])) {
  8568. continue;
  8569. }
  8570. $seen[abs($literal)] = true;
  8571. $l = $this->decisions->decisionLevel($literal);
  8572. if (1 === $l) {
  8573. $l1num++;
  8574. } elseif ($level === $l) {
  8575. $num++;
  8576. } else {
  8577. $learnedLiterals[] = $literal;
  8578. if ($l > $ruleLevel) {
  8579. $ruleLevel = $l;
  8580. }
  8581. }
  8582. }
  8583. $l1retry = true;
  8584. while ($l1retry) {
  8585. $l1retry = false;
  8586. if (!$num && !--$l1num) {
  8587. break 2;
  8588. }
  8589. while (true) {
  8590. if ($decisionId <= 0) {
  8591. throw new SolverBugException(
  8592. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  8593. );
  8594. }
  8595. $decisionId--;
  8596. $decision = $this->decisions->atOffset($decisionId);
  8597. $literal = $decision[Decisions::DECISION_LITERAL];
  8598. if (isset($seen[abs($literal)])) {
  8599. break;
  8600. }
  8601. }
  8602. unset($seen[abs($literal)]);
  8603. if ($num && 0 === --$num) {
  8604. $learnedLiterals[0] = -abs($literal);
  8605. if (!$l1num) {
  8606. break 2;
  8607. }
  8608. foreach ($learnedLiterals as $i => $learnedLiteral) {
  8609. if ($i !== 0) {
  8610. unset($seen[abs($learnedLiteral)]);
  8611. }
  8612. }
  8613. $l1num++;
  8614. $l1retry = true;
  8615. }
  8616. }
  8617. $decision = $this->decisions->atOffset($decisionId);
  8618. $rule = $decision[Decisions::DECISION_REASON];
  8619. }
  8620. $why = count($this->learnedPool) - 1;
  8621. if (!$learnedLiterals[0]) {
  8622. throw new SolverBugException(
  8623. "Did not find a learnable literal in analyzed rule $analyzedRule."
  8624. );
  8625. }
  8626. $newRule = new Rule($learnedLiterals, Rule::RULE_LEARNED, $why);
  8627. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  8628. }
  8629. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  8630. {
  8631. $why = spl_object_hash($conflictRule);
  8632. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  8633. $learnedWhy = $this->learnedWhy[$why];
  8634. $problemRules = $this->learnedPool[$learnedWhy];
  8635. foreach ($problemRules as $problemRule) {
  8636. $this->analyzeUnsolvableRule($problem, $problemRule);
  8637. }
  8638. return;
  8639. }
  8640. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  8641. return;
  8642. }
  8643. $problem->nextSection();
  8644. $problem->addRule($conflictRule);
  8645. }
  8646. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  8647. {
  8648. $problem = new Problem($this->pool);
  8649. $problem->addRule($conflictRule);
  8650. $this->analyzeUnsolvableRule($problem, $conflictRule);
  8651. $this->problems[] = $problem;
  8652. $seen = array();
  8653. $literals = $conflictRule->literals;
  8654. foreach ($literals as $literal) {
  8655. if ($this->decisions->satisfy($literal)) {
  8656. continue;
  8657. }
  8658. $seen[abs($literal)] = true;
  8659. }
  8660. foreach ($this->decisions as $decision) {
  8661. $literal = $decision[Decisions::DECISION_LITERAL];
  8662. if (!isset($seen[abs($literal)])) {
  8663. continue;
  8664. }
  8665. $why = $decision[Decisions::DECISION_REASON];
  8666. $problem->addRule($why);
  8667. $this->analyzeUnsolvableRule($problem, $why);
  8668. $literals = $why->literals;
  8669. foreach ($literals as $literal) {
  8670. if ($this->decisions->satisfy($literal)) {
  8671. continue;
  8672. }
  8673. $seen[abs($literal)] = true;
  8674. }
  8675. }
  8676. if ($disableRules) {
  8677. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  8678. $this->disableProblem($reason['rule']);
  8679. }
  8680. $this->resetSolver();
  8681. return 1;
  8682. }
  8683. return 0;
  8684. }
  8685. private function disableProblem(Rule $why)
  8686. {
  8687. $job = $why->getJob();
  8688. if (!$job) {
  8689. $why->disable();
  8690. return;
  8691. }
  8692. foreach ($this->rules as $rule) {
  8693. if ($job === $rule->getJob()) {
  8694. $rule->disable();
  8695. }
  8696. }
  8697. }
  8698. private function resetSolver()
  8699. {
  8700. $this->decisions->reset();
  8701. $this->propagateIndex = 0;
  8702. $this->branches = array();
  8703. $this->enableDisableLearnedRules();
  8704. $this->makeAssertionRuleDecisions();
  8705. }
  8706. private function enableDisableLearnedRules()
  8707. {
  8708. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  8709. $why = $this->learnedWhy[spl_object_hash($rule)];
  8710. $problemRules = $this->learnedPool[$why];
  8711. $foundDisabled = false;
  8712. foreach ($problemRules as $problemRule) {
  8713. if ($problemRule->isDisabled()) {
  8714. $foundDisabled = true;
  8715. break;
  8716. }
  8717. }
  8718. if ($foundDisabled && $rule->isEnabled()) {
  8719. $rule->disable();
  8720. } elseif (!$foundDisabled && $rule->isDisabled()) {
  8721. $rule->enable();
  8722. }
  8723. }
  8724. }
  8725. private function runSat($disableRules = true)
  8726. {
  8727. $this->propagateIndex = 0;
  8728. $decisionQueue = array();
  8729. $decisionSupplementQueue = array();
  8730. $disableRules = array();
  8731. $level = 1;
  8732. $systemLevel = $level + 1;
  8733. $installedPos = 0;
  8734. while (true) {
  8735. if (1 === $level) {
  8736. $conflictRule = $this->propagate($level);
  8737. if (null !== $conflictRule) {
  8738. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  8739. continue;
  8740. }
  8741. return;
  8742. }
  8743. }
  8744. if ($level < $systemLevel) {
  8745. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  8746. foreach ($iterator as $rule) {
  8747. if ($rule->isEnabled()) {
  8748. $decisionQueue = array();
  8749. $noneSatisfied = true;
  8750. foreach ($rule->literals as $literal) {
  8751. if ($this->decisions->satisfy($literal)) {
  8752. $noneSatisfied = false;
  8753. break;
  8754. }
  8755. if ($literal > 0 && $this->decisions->undecided($literal)) {
  8756. $decisionQueue[] = $literal;
  8757. }
  8758. }
  8759. if ($noneSatisfied && count($decisionQueue)) {
  8760. if (count($this->installed) != count($this->updateMap)) {
  8761. $prunedQueue = array();
  8762. foreach ($decisionQueue as $literal) {
  8763. if (isset($this->installedMap[abs($literal)])) {
  8764. $prunedQueue[] = $literal;
  8765. if (isset($this->updateMap[abs($literal)])) {
  8766. $prunedQueue = $decisionQueue;
  8767. break;
  8768. }
  8769. }
  8770. }
  8771. $decisionQueue = $prunedQueue;
  8772. }
  8773. }
  8774. if ($noneSatisfied && count($decisionQueue)) {
  8775. $oLevel = $level;
  8776. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  8777. if (0 === $level) {
  8778. return;
  8779. }
  8780. if ($level <= $oLevel) {
  8781. break;
  8782. }
  8783. }
  8784. }
  8785. }
  8786. $systemLevel = $level + 1;
  8787. $iterator->next();
  8788. if ($iterator->valid()) {
  8789. continue;
  8790. }
  8791. }
  8792. if ($level < $systemLevel) {
  8793. $systemLevel = $level;
  8794. }
  8795. $rulesCount = count($this->rules);
  8796. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  8797. if ($i == $rulesCount) {
  8798. $i = 0;
  8799. }
  8800. $rule = $this->rules->ruleById[$i];
  8801. $literals = $rule->literals;
  8802. if ($rule->isDisabled()) {
  8803. continue;
  8804. }
  8805. $decisionQueue = array();
  8806. foreach ($literals as $literal) {
  8807. if ($literal <= 0) {
  8808. if (!$this->decisions->decidedInstall(abs($literal))) {
  8809. continue 2;
  8810. }
  8811. } else {
  8812. if ($this->decisions->decidedInstall(abs($literal))) {
  8813. continue 2;
  8814. }
  8815. if ($this->decisions->undecided(abs($literal))) {
  8816. $decisionQueue[] = $literal;
  8817. }
  8818. }
  8819. }
  8820. if (count($decisionQueue) < 2) {
  8821. continue;
  8822. }
  8823. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  8824. if (0 === $level) {
  8825. return;
  8826. }
  8827. $rulesCount = count($this->rules);
  8828. $n = -1;
  8829. }
  8830. if ($level < $systemLevel) {
  8831. continue;
  8832. }
  8833. if (count($this->branches)) {
  8834. $lastLiteral = null;
  8835. $lastLevel = null;
  8836. $lastBranchIndex = 0;
  8837. $lastBranchOffset = 0;
  8838. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  8839. list($literals, $l) = $this->branches[$i];
  8840. foreach ($literals as $offset => $literal) {
  8841. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  8842. $lastLiteral = $literal;
  8843. $lastBranchIndex = $i;
  8844. $lastBranchOffset = $offset;
  8845. $lastLevel = $l;
  8846. }
  8847. }
  8848. }
  8849. if ($lastLiteral) {
  8850. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  8851. $level = $lastLevel;
  8852. $this->revert($level);
  8853. $why = $this->decisions->lastReason();
  8854. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  8855. if ($level == 0) {
  8856. return;
  8857. }
  8858. continue;
  8859. }
  8860. }
  8861. break;
  8862. }
  8863. }
  8864. }
  8865. <?php
  8866. namespace Composer\DependencyResolver;
  8867. class SolverBugException extends \RuntimeException
  8868. {
  8869. public function __construct($message)
  8870. {
  8871. parent::__construct(
  8872. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  8873. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
  8874. }
  8875. }
  8876. <?php
  8877. namespace Composer\DependencyResolver;
  8878. use Composer\Util\IniHelper;
  8879. class SolverProblemsException extends \RuntimeException
  8880. {
  8881. protected $problems;
  8882. protected $installedMap;
  8883. public function __construct(array $problems, array $installedMap)
  8884. {
  8885. $this->problems = $problems;
  8886. $this->installedMap = $installedMap;
  8887. parent::__construct($this->createMessage(), 2);
  8888. }
  8889. protected function createMessage()
  8890. {
  8891. $text = "\n";
  8892. $hasExtensionProblems = false;
  8893. foreach ($this->problems as $i => $problem) {
  8894. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  8895. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  8896. $hasExtensionProblems = true;
  8897. }
  8898. }
  8899. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  8900. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  8901. }
  8902. if ($hasExtensionProblems) {
  8903. $text .= $this->createExtensionHint();
  8904. }
  8905. return $text;
  8906. }
  8907. public function getProblems()
  8908. {
  8909. return $this->problems;
  8910. }
  8911. private function createExtensionHint()
  8912. {
  8913. $paths = IniHelper::getAll();
  8914. if (count($paths) === 1 && empty($paths[0])) {
  8915. return '';
  8916. }
  8917. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  8918. $text .= implode("\n - ", $paths);
  8919. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  8920. return $text;
  8921. }
  8922. private function hasExtensionProblems(array $reasonSets)
  8923. {
  8924. foreach ($reasonSets as $reasonSet) {
  8925. foreach ($reasonSet as $reason) {
  8926. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  8927. return true;
  8928. }
  8929. }
  8930. }
  8931. return false;
  8932. }
  8933. }
  8934. <?php
  8935. namespace Composer\DependencyResolver;
  8936. use Composer\Package\AliasPackage;
  8937. class Transaction
  8938. {
  8939. protected $policy;
  8940. protected $pool;
  8941. protected $installedMap;
  8942. protected $decisions;
  8943. protected $transaction;
  8944. public function __construct($policy, $pool, $installedMap, $decisions)
  8945. {
  8946. $this->policy = $policy;
  8947. $this->pool = $pool;
  8948. $this->installedMap = $installedMap;
  8949. $this->decisions = $decisions;
  8950. $this->transaction = array();
  8951. }
  8952. public function getOperations()
  8953. {
  8954. $installMeansUpdateMap = $this->findUpdates();
  8955. $updateMap = array();
  8956. $installMap = array();
  8957. $uninstallMap = array();
  8958. foreach ($this->decisions as $i => $decision) {
  8959. $literal = $decision[Decisions::DECISION_LITERAL];
  8960. $reason = $decision[Decisions::DECISION_REASON];
  8961. $package = $this->pool->literalToPackage($literal);
  8962. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  8963. continue;
  8964. }
  8965. if ($literal > 0) {
  8966. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  8967. $source = $installMeansUpdateMap[abs($literal)];
  8968. $updateMap[$package->id] = array(
  8969. 'package' => $package,
  8970. 'source' => $source,
  8971. 'reason' => $reason,
  8972. );
  8973. unset($installMeansUpdateMap[abs($literal)]);
  8974. $ignoreRemove[$source->id] = true;
  8975. } else {
  8976. $installMap[$package->id] = array(
  8977. 'package' => $package,
  8978. 'reason' => $reason,
  8979. );
  8980. }
  8981. }
  8982. }
  8983. foreach ($this->decisions as $i => $decision) {
  8984. $literal = $decision[Decisions::DECISION_LITERAL];
  8985. $reason = $decision[Decisions::DECISION_REASON];
  8986. $package = $this->pool->literalToPackage($literal);
  8987. if ($literal <= 0 &&
  8988. isset($this->installedMap[$package->id]) &&
  8989. !isset($ignoreRemove[$package->id])) {
  8990. $uninstallMap[$package->id] = array(
  8991. 'package' => $package,
  8992. 'reason' => $reason,
  8993. );
  8994. }
  8995. }
  8996. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  8997. return $this->transaction;
  8998. }
  8999. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9000. {
  9001. $queue = array_map(function ($operation) {
  9002. return $operation['package'];
  9003. },
  9004. $this->findRootPackages($installMap, $updateMap)
  9005. );
  9006. $visited = array();
  9007. while (!empty($queue)) {
  9008. $package = array_pop($queue);
  9009. $packageId = $package->id;
  9010. if (!isset($visited[$packageId])) {
  9011. array_push($queue, $package);
  9012. if ($package instanceof AliasPackage) {
  9013. array_push($queue, $package->getAliasOf());
  9014. } else {
  9015. foreach ($package->getRequires() as $link) {
  9016. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9017. foreach ($possibleRequires as $require) {
  9018. array_push($queue, $require);
  9019. }
  9020. }
  9021. }
  9022. $visited[$package->id] = true;
  9023. } else {
  9024. if (isset($installMap[$packageId])) {
  9025. $this->install(
  9026. $installMap[$packageId]['package'],
  9027. $installMap[$packageId]['reason']
  9028. );
  9029. unset($installMap[$packageId]);
  9030. }
  9031. if (isset($updateMap[$packageId])) {
  9032. $this->update(
  9033. $updateMap[$packageId]['source'],
  9034. $updateMap[$packageId]['package'],
  9035. $updateMap[$packageId]['reason']
  9036. );
  9037. unset($updateMap[$packageId]);
  9038. }
  9039. }
  9040. }
  9041. foreach ($uninstallMap as $uninstall) {
  9042. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9043. }
  9044. }
  9045. protected function findRootPackages($installMap, $updateMap)
  9046. {
  9047. $packages = $installMap + $updateMap;
  9048. $roots = $packages;
  9049. foreach ($packages as $packageId => $operation) {
  9050. $package = $operation['package'];
  9051. if (!isset($roots[$packageId])) {
  9052. continue;
  9053. }
  9054. foreach ($package->getRequires() as $link) {
  9055. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9056. foreach ($possibleRequires as $require) {
  9057. if ($require !== $package) {
  9058. unset($roots[$require->id]);
  9059. }
  9060. }
  9061. }
  9062. }
  9063. return $roots;
  9064. }
  9065. protected function findUpdates()
  9066. {
  9067. $installMeansUpdateMap = array();
  9068. foreach ($this->decisions as $i => $decision) {
  9069. $literal = $decision[Decisions::DECISION_LITERAL];
  9070. $package = $this->pool->literalToPackage($literal);
  9071. if ($package instanceof AliasPackage) {
  9072. continue;
  9073. }
  9074. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9075. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9076. $literals = array($package->id);
  9077. foreach ($updates as $update) {
  9078. $literals[] = $update->id;
  9079. }
  9080. foreach ($literals as $updateLiteral) {
  9081. if ($updateLiteral !== $literal) {
  9082. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9083. }
  9084. }
  9085. }
  9086. }
  9087. return $installMeansUpdateMap;
  9088. }
  9089. protected function install($package, $reason)
  9090. {
  9091. if ($package instanceof AliasPackage) {
  9092. return $this->markAliasInstalled($package, $reason);
  9093. }
  9094. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9095. }
  9096. protected function update($from, $to, $reason)
  9097. {
  9098. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9099. }
  9100. protected function uninstall($package, $reason)
  9101. {
  9102. if ($package instanceof AliasPackage) {
  9103. return $this->markAliasUninstalled($package, $reason);
  9104. }
  9105. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9106. }
  9107. protected function markAliasInstalled($package, $reason)
  9108. {
  9109. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9110. }
  9111. protected function markAliasUninstalled($package, $reason)
  9112. {
  9113. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9114. }
  9115. }
  9116. <?php
  9117. namespace Composer\Downloader;
  9118. use Composer\Package\PackageInterface;
  9119. use Symfony\Component\Finder\Finder;
  9120. use Composer\IO\IOInterface;
  9121. abstract class ArchiveDownloader extends FileDownloader
  9122. {
  9123. public function download(PackageInterface $package, $path, $output = true)
  9124. {
  9125. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9126. $retries = 3;
  9127. while ($retries--) {
  9128. $fileName = parent::download($package, $path, $output);
  9129. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9130. try {
  9131. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9132. try {
  9133. $this->extract($fileName, $temporaryDir);
  9134. } catch (\Exception $e) {
  9135. parent::clearLastCacheWrite($package);
  9136. throw $e;
  9137. }
  9138. $this->filesystem->unlink($fileName);
  9139. $contentDir = $this->getFolderContent($temporaryDir);
  9140. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9141. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9142. }
  9143. foreach ($contentDir as $file) {
  9144. $file = (string) $file;
  9145. $this->filesystem->rename($file, $path . '/' . basename($file));
  9146. }
  9147. $this->filesystem->removeDirectory($temporaryDir);
  9148. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9149. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9150. }
  9151. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9152. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9153. }
  9154. } catch (\Exception $e) {
  9155. $this->filesystem->removeDirectory($path);
  9156. $this->filesystem->removeDirectory($temporaryDir);
  9157. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9158. $this->io->writeError('');
  9159. if ($this->io->isDebug()) {
  9160. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9161. } else {
  9162. $this->io->writeError(' Invalid zip file, retrying...');
  9163. }
  9164. usleep(500000);
  9165. continue;
  9166. }
  9167. throw $e;
  9168. }
  9169. break;
  9170. }
  9171. if ($output) {
  9172. $this->io->writeError('');
  9173. }
  9174. }
  9175. protected function getFileName(PackageInterface $package, $path)
  9176. {
  9177. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9178. }
  9179. protected function processUrl(PackageInterface $package, $url)
  9180. {
  9181. if ($package->getDistReference() && strpos($url, 'github.com')) {
  9182. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  9183. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9184. } elseif ($package->getDistReference() && preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  9185. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9186. } elseif ($package->getDistReference() && preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  9187. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9188. }
  9189. } elseif ($package->getDistReference() && strpos($url, 'bitbucket.org')) {
  9190. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  9191. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $package->getDistReference() . '.' . $match[4];
  9192. }
  9193. }
  9194. return parent::processUrl($package, $url);
  9195. }
  9196. abstract protected function extract($file, $path);
  9197. private function getFolderContent($dir)
  9198. {
  9199. $finder = Finder::create()
  9200. ->ignoreVCS(false)
  9201. ->ignoreDotFiles(false)
  9202. ->depth(0)
  9203. ->in($dir);
  9204. return iterator_to_array($finder);
  9205. }
  9206. }
  9207. <?php
  9208. namespace Composer\Downloader;
  9209. use Composer\Package\PackageInterface;
  9210. interface ChangeReportInterface
  9211. {
  9212. public function getLocalChanges(PackageInterface $package, $path);
  9213. }
  9214. <?php
  9215. namespace Composer\Downloader;
  9216. use Composer\Package\PackageInterface;
  9217. use Composer\IO\IOInterface;
  9218. use Composer\Util\Filesystem;
  9219. class DownloadManager
  9220. {
  9221. private $io;
  9222. private $preferDist = false;
  9223. private $preferSource = false;
  9224. private $packagePreferences = array();
  9225. private $filesystem;
  9226. private $downloaders = array();
  9227. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  9228. {
  9229. $this->io = $io;
  9230. $this->preferSource = $preferSource;
  9231. $this->filesystem = $filesystem ?: new Filesystem();
  9232. }
  9233. public function setPreferSource($preferSource)
  9234. {
  9235. $this->preferSource = $preferSource;
  9236. return $this;
  9237. }
  9238. public function setPreferDist($preferDist)
  9239. {
  9240. $this->preferDist = $preferDist;
  9241. return $this;
  9242. }
  9243. public function setPreferences(array $preferences)
  9244. {
  9245. $this->packagePreferences = $preferences;
  9246. return $this;
  9247. }
  9248. public function setOutputProgress($outputProgress)
  9249. {
  9250. foreach ($this->downloaders as $downloader) {
  9251. $downloader->setOutputProgress($outputProgress);
  9252. }
  9253. return $this;
  9254. }
  9255. public function setDownloader($type, DownloaderInterface $downloader)
  9256. {
  9257. $type = strtolower($type);
  9258. $this->downloaders[$type] = $downloader;
  9259. return $this;
  9260. }
  9261. public function getDownloader($type)
  9262. {
  9263. $type = strtolower($type);
  9264. if (!isset($this->downloaders[$type])) {
  9265. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  9266. }
  9267. return $this->downloaders[$type];
  9268. }
  9269. public function getDownloaderForInstalledPackage(PackageInterface $package)
  9270. {
  9271. $installationSource = $package->getInstallationSource();
  9272. if ('metapackage' === $package->getType()) {
  9273. return;
  9274. }
  9275. if ('dist' === $installationSource) {
  9276. $downloader = $this->getDownloader($package->getDistType());
  9277. } elseif ('source' === $installationSource) {
  9278. $downloader = $this->getDownloader($package->getSourceType());
  9279. } else {
  9280. throw new \InvalidArgumentException(
  9281. 'Package '.$package.' seems not been installed properly'
  9282. );
  9283. }
  9284. if ($installationSource !== $downloader->getInstallationSource()) {
  9285. throw new \LogicException(sprintf(
  9286. 'Downloader "%s" is a %s type downloader and can not be used to download %s',
  9287. get_class($downloader), $downloader->getInstallationSource(), $installationSource
  9288. ));
  9289. }
  9290. return $downloader;
  9291. }
  9292. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  9293. {
  9294. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  9295. $sourceType = $package->getSourceType();
  9296. $distType = $package->getDistType();
  9297. $sources = array();
  9298. if ($sourceType) {
  9299. $sources[] = 'source';
  9300. }
  9301. if ($distType) {
  9302. $sources[] = 'dist';
  9303. }
  9304. if (empty($sources)) {
  9305. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  9306. }
  9307. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  9308. $sources = array_reverse($sources);
  9309. }
  9310. $this->filesystem->ensureDirectoryExists($targetDir);
  9311. foreach ($sources as $i => $source) {
  9312. if (isset($e)) {
  9313. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  9314. }
  9315. $package->setInstallationSource($source);
  9316. try {
  9317. $downloader = $this->getDownloaderForInstalledPackage($package);
  9318. if ($downloader) {
  9319. $downloader->download($package, $targetDir);
  9320. }
  9321. break;
  9322. } catch (\RuntimeException $e) {
  9323. if ($i === count($sources) - 1) {
  9324. throw $e;
  9325. }
  9326. $this->io->writeError(
  9327. ' <warning>Failed to download '.
  9328. $package->getPrettyName().
  9329. ' from ' . $source . ': '.
  9330. $e->getMessage().'</warning>'
  9331. );
  9332. }
  9333. }
  9334. }
  9335. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  9336. {
  9337. $downloader = $this->getDownloaderForInstalledPackage($initial);
  9338. if (!$downloader) {
  9339. return;
  9340. }
  9341. $installationSource = $initial->getInstallationSource();
  9342. if ('dist' === $installationSource) {
  9343. $initialType = $initial->getDistType();
  9344. $targetType = $target->getDistType();
  9345. } else {
  9346. $initialType = $initial->getSourceType();
  9347. $targetType = $target->getSourceType();
  9348. }
  9349. if ($target->isDev() && 'dist' === $installationSource) {
  9350. $downloader->remove($initial, $targetDir);
  9351. $this->download($target, $targetDir);
  9352. return;
  9353. }
  9354. if ($initialType === $targetType) {
  9355. $target->setInstallationSource($installationSource);
  9356. try {
  9357. $downloader->update($initial, $target, $targetDir);
  9358. return;
  9359. } catch (\RuntimeException $e) {
  9360. if (!$this->io->isInteractive()) {
  9361. throw $e;
  9362. }
  9363. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  9364. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  9365. throw $e;
  9366. }
  9367. }
  9368. }
  9369. $downloader->remove($initial, $targetDir);
  9370. $this->download($target, $targetDir, 'source' === $installationSource);
  9371. }
  9372. public function remove(PackageInterface $package, $targetDir)
  9373. {
  9374. $downloader = $this->getDownloaderForInstalledPackage($package);
  9375. if ($downloader) {
  9376. $downloader->remove($package, $targetDir);
  9377. }
  9378. }
  9379. protected function resolvePackageInstallPreference(PackageInterface $package)
  9380. {
  9381. foreach ($this->packagePreferences as $pattern => $preference) {
  9382. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  9383. if (preg_match($pattern, $package->getName())) {
  9384. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  9385. return 'dist';
  9386. }
  9387. return 'source';
  9388. }
  9389. }
  9390. return $package->isDev() ? 'source' : 'dist';
  9391. }
  9392. }
  9393. <?php
  9394. namespace Composer\Downloader;
  9395. use Composer\Package\PackageInterface;
  9396. interface DownloaderInterface
  9397. {
  9398. public function getInstallationSource();
  9399. public function download(PackageInterface $package, $path);
  9400. public function update(PackageInterface $initial, PackageInterface $target, $path);
  9401. public function remove(PackageInterface $package, $path);
  9402. public function setOutputProgress($outputProgress);
  9403. }
  9404. <?php
  9405. namespace Composer\Downloader;
  9406. use Composer\Package\PackageInterface;
  9407. interface DvcsDownloaderInterface
  9408. {
  9409. public function getUnpushedChanges(PackageInterface $package, $path);
  9410. }
  9411. <?php
  9412. namespace Composer\Downloader;
  9413. use Composer\Config;
  9414. use Composer\Cache;
  9415. use Composer\Factory;
  9416. use Composer\IO\IOInterface;
  9417. use Composer\Package\PackageInterface;
  9418. use Composer\Plugin\PluginEvents;
  9419. use Composer\Plugin\PreFileDownloadEvent;
  9420. use Composer\EventDispatcher\EventDispatcher;
  9421. use Composer\Util\Filesystem;
  9422. use Composer\Util\RemoteFilesystem;
  9423. class FileDownloader implements DownloaderInterface
  9424. {
  9425. protected $io;
  9426. protected $config;
  9427. protected $rfs;
  9428. protected $filesystem;
  9429. protected $cache;
  9430. protected $outputProgress = true;
  9431. private $lastCacheWrites = array();
  9432. private $eventDispatcher;
  9433. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  9434. {
  9435. $this->io = $io;
  9436. $this->config = $config;
  9437. $this->eventDispatcher = $eventDispatcher;
  9438. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  9439. $this->filesystem = $filesystem ?: new Filesystem();
  9440. $this->cache = $cache;
  9441. if ($this->cache && $this->cache->gcIsNecessary()) {
  9442. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  9443. }
  9444. }
  9445. public function getInstallationSource()
  9446. {
  9447. return 'dist';
  9448. }
  9449. public function download(PackageInterface $package, $path, $output = true)
  9450. {
  9451. if (!$package->getDistUrl()) {
  9452. throw new \InvalidArgumentException('The given package is missing url information');
  9453. }
  9454. if ($output) {
  9455. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)", false);
  9456. }
  9457. $urls = $package->getDistUrls();
  9458. while ($url = array_shift($urls)) {
  9459. try {
  9460. return $this->doDownload($package, $path, $url);
  9461. } catch (\Exception $e) {
  9462. if ($this->io->isDebug()) {
  9463. $this->io->writeError('');
  9464. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  9465. } elseif (count($urls)) {
  9466. $this->io->writeError('');
  9467. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  9468. }
  9469. if (!count($urls)) {
  9470. throw $e;
  9471. }
  9472. }
  9473. }
  9474. if ($output) {
  9475. $this->io->writeError('');
  9476. }
  9477. }
  9478. protected function doDownload(PackageInterface $package, $path, $url)
  9479. {
  9480. $this->filesystem->emptyDirectory($path);
  9481. $fileName = $this->getFileName($package, $path);
  9482. $processedUrl = $this->processUrl($package, $url);
  9483. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  9484. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  9485. if ($this->eventDispatcher) {
  9486. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  9487. }
  9488. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  9489. try {
  9490. $checksum = $package->getDistSha1Checksum();
  9491. $cacheKey = $this->getCacheKey($package, $processedUrl);
  9492. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  9493. if (!$this->outputProgress) {
  9494. $this->io->writeError(' Downloading', false);
  9495. }
  9496. $retries = 3;
  9497. while ($retries--) {
  9498. try {
  9499. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  9500. break;
  9501. } catch (TransportException $e) {
  9502. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  9503. throw $e;
  9504. }
  9505. $this->io->writeError('');
  9506. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  9507. usleep(500000);
  9508. }
  9509. }
  9510. if ($this->cache) {
  9511. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  9512. $this->cache->copyFrom($cacheKey, $fileName);
  9513. }
  9514. } else {
  9515. $this->io->writeError(' Loading from cache', false);
  9516. }
  9517. if (!file_exists($fileName)) {
  9518. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  9519. .' directory is writable and you have internet connectivity');
  9520. }
  9521. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  9522. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  9523. }
  9524. } catch (\Exception $e) {
  9525. $this->filesystem->removeDirectory($path);
  9526. $this->clearLastCacheWrite($package);
  9527. throw $e;
  9528. }
  9529. return $fileName;
  9530. }
  9531. public function setOutputProgress($outputProgress)
  9532. {
  9533. $this->outputProgress = $outputProgress;
  9534. return $this;
  9535. }
  9536. protected function clearLastCacheWrite(PackageInterface $package)
  9537. {
  9538. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  9539. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  9540. unset($this->lastCacheWrites[$package->getName()]);
  9541. }
  9542. }
  9543. public function update(PackageInterface $initial, PackageInterface $target, $path)
  9544. {
  9545. $name = $target->getName();
  9546. $from = $initial->getPrettyVersion();
  9547. $to = $target->getPrettyVersion();
  9548. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)", false);
  9549. $this->remove($initial, $path, false);
  9550. $this->download($target, $path, false);
  9551. $this->io->writeError('');
  9552. }
  9553. public function remove(PackageInterface $package, $path, $output = true)
  9554. {
  9555. if ($output) {
  9556. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  9557. }
  9558. if (!$this->filesystem->removeDirectory($path)) {
  9559. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  9560. }
  9561. }
  9562. protected function getFileName(PackageInterface $package, $path)
  9563. {
  9564. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  9565. }
  9566. protected function processUrl(PackageInterface $package, $url)
  9567. {
  9568. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  9569. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  9570. }
  9571. return $url;
  9572. }
  9573. private function getCacheKey(PackageInterface $package, $processedUrl)
  9574. {
  9575. $cacheKey = sha1($processedUrl);
  9576. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  9577. }
  9578. }
  9579. <?php
  9580. namespace Composer\Downloader;
  9581. class FilesystemException extends \Exception
  9582. {
  9583. public function __construct($message = '', $code = 0, \Exception $previous = null)
  9584. {
  9585. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  9586. }
  9587. }
  9588. <?php
  9589. namespace Composer\Downloader;
  9590. use Composer\Package\PackageInterface;
  9591. use Composer\Util\ProcessExecutor;
  9592. class FossilDownloader extends VcsDownloader
  9593. {
  9594. public function doDownload(PackageInterface $package, $path, $url)
  9595. {
  9596. $this->config->prohibitUrlByConfig($url, $this->io);
  9597. $url = ProcessExecutor::escape($url);
  9598. $ref = ProcessExecutor::escape($package->getSourceReference());
  9599. $repoFile = $path . '.fossil';
  9600. $this->io->writeError(" Cloning ".$package->getSourceReference());
  9601. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  9602. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  9603. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9604. }
  9605. $command = sprintf('fossil open %s', ProcessExecutor::escape($repoFile));
  9606. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9607. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9608. }
  9609. $command = sprintf('fossil update %s', $ref);
  9610. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9611. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9612. }
  9613. }
  9614. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9615. {
  9616. $this->config->prohibitUrlByConfig($url, $this->io);
  9617. $url = ProcessExecutor::escape($url);
  9618. $ref = ProcessExecutor::escape($target->getSourceReference());
  9619. $this->io->writeError(" Updating to ".$target->getSourceReference());
  9620. if (!$this->hasMetadataRepository($path)) {
  9621. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9622. }
  9623. $command = sprintf('fossil pull && fossil up %s', $ref);
  9624. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9625. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9626. }
  9627. }
  9628. public function getLocalChanges(PackageInterface $package, $path)
  9629. {
  9630. if (!$this->hasMetadataRepository($path)) {
  9631. return null;
  9632. }
  9633. $this->process->execute('fossil changes', $output, realpath($path));
  9634. return trim($output) ?: null;
  9635. }
  9636. protected function getCommitLogs($fromReference, $toReference, $path)
  9637. {
  9638. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', $toReference);
  9639. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  9640. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9641. }
  9642. $log = '';
  9643. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  9644. foreach ($this->process->splitLines($output) as $line) {
  9645. if (preg_match($match, $line))
  9646. {
  9647. break;
  9648. }
  9649. $log .= $line;
  9650. }
  9651. return $log;
  9652. }
  9653. protected function hasMetadataRepository($path)
  9654. {
  9655. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  9656. }
  9657. }
  9658. <?php
  9659. namespace Composer\Downloader;
  9660. use Composer\Package\PackageInterface;
  9661. use Composer\Util\Git as GitUtil;
  9662. use Composer\Util\Platform;
  9663. use Composer\Util\ProcessExecutor;
  9664. use Composer\IO\IOInterface;
  9665. use Composer\Util\Filesystem;
  9666. use Composer\Config;
  9667. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  9668. {
  9669. private $hasStashedChanges = false;
  9670. private $hasDiscardedChanges = false;
  9671. private $gitUtil;
  9672. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  9673. {
  9674. parent::__construct($io, $config, $process, $fs);
  9675. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  9676. }
  9677. public function doDownload(PackageInterface $package, $path, $url)
  9678. {
  9679. GitUtil::cleanEnv();
  9680. $path = $this->normalizePath($path);
  9681. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  9682. $cacheOptions = '';
  9683. $ref = $package->getSourceReference();
  9684. $flag = Platform::isWindows() ? '/D ' : '';
  9685. $gitVersion = $this->gitUtil->getVersion();
  9686. $msg = " Cloning ".$this->getShortHash($ref);
  9687. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  9688. $this->io->writeError('', true, IOInterface::DEBUG);
  9689. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  9690. try {
  9691. $this->gitUtil->syncMirror($url, $cachePath);
  9692. if (is_dir($cachePath)) {
  9693. $cacheOptions = sprintf('--dissociate --reference %s ', ProcessExecutor::escape($cachePath));
  9694. $msg = " Cloning ".$this->getShortHash($ref).' from cache';
  9695. }
  9696. } catch (\RuntimeException $e) {}
  9697. }
  9698. $command = 'git clone --no-checkout %s %s '.$cacheOptions.'&& cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
  9699. $this->io->writeError($msg);
  9700. $commandCallable = function ($url) use ($ref, $path, $command) {
  9701. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($path), ProcessExecutor::escape($ref));
  9702. };
  9703. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  9704. if ($url !== $package->getSourceUrl()) {
  9705. $this->updateOriginUrl($path, $package->getSourceUrl());
  9706. } else {
  9707. $this->setPushUrl($path, $url);
  9708. }
  9709. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  9710. if ($package->getDistReference() === $package->getSourceReference()) {
  9711. $package->setDistReference($newRef);
  9712. }
  9713. $package->setSourceReference($newRef);
  9714. }
  9715. }
  9716. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9717. {
  9718. GitUtil::cleanEnv();
  9719. if (!$this->hasMetadataRepository($path)) {
  9720. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9721. }
  9722. $updateOriginUrl = false;
  9723. if (
  9724. 0 === $this->process->execute('git remote -v', $output, $path)
  9725. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  9726. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  9727. ) {
  9728. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  9729. $updateOriginUrl = true;
  9730. }
  9731. }
  9732. $ref = $target->getSourceReference();
  9733. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  9734. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s^{commit} || (git fetch composer && git fetch --tags composer)';
  9735. $commandCallable = function ($url) use ($command, $ref) {
  9736. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  9737. };
  9738. $this->gitUtil->runCommand($commandCallable, $url, $path);
  9739. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  9740. if ($target->getDistReference() === $target->getSourceReference()) {
  9741. $target->setDistReference($newRef);
  9742. }
  9743. $target->setSourceReference($newRef);
  9744. }
  9745. if ($updateOriginUrl) {
  9746. $this->updateOriginUrl($path, $target->getSourceUrl());
  9747. }
  9748. }
  9749. public function getLocalChanges(PackageInterface $package, $path)
  9750. {
  9751. GitUtil::cleanEnv();
  9752. if (!$this->hasMetadataRepository($path)) {
  9753. return;
  9754. }
  9755. $command = 'git status --porcelain --untracked-files=no';
  9756. if (0 !== $this->process->execute($command, $output, $path)) {
  9757. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9758. }
  9759. return trim($output) ?: null;
  9760. }
  9761. public function getUnpushedChanges(PackageInterface $package, $path)
  9762. {
  9763. GitUtil::cleanEnv();
  9764. $path = $this->normalizePath($path);
  9765. if (!$this->hasMetadataRepository($path)) {
  9766. return;
  9767. }
  9768. $command = 'git show-ref --head -d';
  9769. if (0 !== $this->process->execute($command, $output, $path)) {
  9770. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9771. }
  9772. $refs = trim($output);
  9773. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  9774. return;
  9775. }
  9776. $headRef = $match[1];
  9777. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  9778. return;
  9779. }
  9780. $branch = $matches[1][0];
  9781. $unpushedChanges = null;
  9782. for ($i = 0; $i <= 1; $i++) {
  9783. foreach ($matches[1] as $candidate) {
  9784. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  9785. $branch = $candidate;
  9786. $remoteBranch = $match[1];
  9787. break;
  9788. }
  9789. }
  9790. if (!isset($remoteBranch)) {
  9791. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  9792. } else {
  9793. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  9794. if (0 !== $this->process->execute($command, $output, $path)) {
  9795. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9796. }
  9797. $unpushedChanges = trim($output) ?: null;
  9798. }
  9799. if ($unpushedChanges && $i === 0) {
  9800. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  9801. }
  9802. if (!$unpushedChanges) {
  9803. break;
  9804. }
  9805. }
  9806. return $unpushedChanges;
  9807. }
  9808. protected function cleanChanges(PackageInterface $package, $path, $update)
  9809. {
  9810. GitUtil::cleanEnv();
  9811. $path = $this->normalizePath($path);
  9812. $unpushed = $this->getUnpushedChanges($package, $path);
  9813. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  9814. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  9815. }
  9816. if (!$changes = $this->getLocalChanges($package, $path)) {
  9817. return;
  9818. }
  9819. if (!$this->io->isInteractive()) {
  9820. $discardChanges = $this->config->get('discard-changes');
  9821. if (true === $discardChanges) {
  9822. return $this->discardChanges($path);
  9823. }
  9824. if ('stash' === $discardChanges) {
  9825. if (!$update) {
  9826. return parent::cleanChanges($package, $path, $update);
  9827. }
  9828. return $this->stashChanges($path);
  9829. }
  9830. return parent::cleanChanges($package, $path, $update);
  9831. }
  9832. $changes = array_map(function ($elem) {
  9833. return ' '.$elem;
  9834. }, preg_split('{\s*\r?\n\s*}', $changes));
  9835. $this->io->writeError(' <error>The package has modified files:</error>');
  9836. $this->io->writeError(array_slice($changes, 0, 10));
  9837. if (count($changes) > 10) {
  9838. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  9839. }
  9840. while (true) {
  9841. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  9842. case 'y':
  9843. $this->discardChanges($path);
  9844. break 2;
  9845. case 's':
  9846. if (!$update) {
  9847. goto help;
  9848. }
  9849. $this->stashChanges($path);
  9850. break 2;
  9851. case 'n':
  9852. throw new \RuntimeException('Update aborted');
  9853. case 'v':
  9854. $this->io->writeError($changes);
  9855. break;
  9856. case 'd':
  9857. $this->viewDiff($path);
  9858. break;
  9859. case '?':
  9860. default:
  9861. help:
  9862. $this->io->writeError(array(
  9863. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  9864. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  9865. ' v - view modified files',
  9866. ' d - view local modifications (diff)',
  9867. ));
  9868. if ($update) {
  9869. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  9870. }
  9871. $this->io->writeError(' ? - print help');
  9872. break;
  9873. }
  9874. }
  9875. }
  9876. protected function reapplyChanges($path)
  9877. {
  9878. $path = $this->normalizePath($path);
  9879. if ($this->hasStashedChanges) {
  9880. $this->hasStashedChanges = false;
  9881. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  9882. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  9883. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  9884. }
  9885. }
  9886. $this->hasDiscardedChanges = false;
  9887. }
  9888. protected function updateToCommit($path, $reference, $branch, $date)
  9889. {
  9890. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  9891. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  9892. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  9893. $branches = null;
  9894. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  9895. $branches = $output;
  9896. }
  9897. $gitRef = $reference;
  9898. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  9899. && $branches
  9900. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  9901. ) {
  9902. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  9903. if (0 === $this->process->execute($command, $output, $path)) {
  9904. return;
  9905. }
  9906. }
  9907. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  9908. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  9909. $branch = 'v' . $branch;
  9910. }
  9911. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  9912. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  9913. if (0 === $this->process->execute($command, $output, $path)
  9914. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  9915. ) {
  9916. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  9917. if (0 === $this->process->execute($command, $output, $path)) {
  9918. return;
  9919. }
  9920. }
  9921. }
  9922. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  9923. if (0 === $this->process->execute($command, $output, $path)) {
  9924. return;
  9925. }
  9926. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  9927. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  9928. }
  9929. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  9930. }
  9931. protected function updateOriginUrl($path, $url)
  9932. {
  9933. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  9934. $this->setPushUrl($path, $url);
  9935. }
  9936. protected function setPushUrl($path, $url)
  9937. {
  9938. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  9939. $protocols = $this->config->get('github-protocols');
  9940. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  9941. if (!in_array('ssh', $protocols, true)) {
  9942. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  9943. }
  9944. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  9945. $this->process->execute($cmd, $ignoredOutput, $path);
  9946. }
  9947. }
  9948. protected function getCommitLogs($fromReference, $toReference, $path)
  9949. {
  9950. $path = $this->normalizePath($path);
  9951. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', $fromReference, $toReference);
  9952. if (0 !== $this->process->execute($command, $output, $path)) {
  9953. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9954. }
  9955. return $output;
  9956. }
  9957. protected function discardChanges($path)
  9958. {
  9959. $path = $this->normalizePath($path);
  9960. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  9961. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  9962. }
  9963. $this->hasDiscardedChanges = true;
  9964. }
  9965. protected function stashChanges($path)
  9966. {
  9967. $path = $this->normalizePath($path);
  9968. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  9969. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  9970. }
  9971. $this->hasStashedChanges = true;
  9972. }
  9973. protected function viewDiff($path)
  9974. {
  9975. $path = $this->normalizePath($path);
  9976. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  9977. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  9978. }
  9979. $this->io->writeError($output);
  9980. }
  9981. protected function normalizePath($path)
  9982. {
  9983. if (Platform::isWindows() && strlen($path) > 0) {
  9984. $basePath = $path;
  9985. $removed = array();
  9986. while (!is_dir($basePath) && $basePath !== '\\') {
  9987. array_unshift($removed, basename($basePath));
  9988. $basePath = dirname($basePath);
  9989. }
  9990. if ($basePath === '\\') {
  9991. return $path;
  9992. }
  9993. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  9994. }
  9995. return $path;
  9996. }
  9997. protected function hasMetadataRepository($path)
  9998. {
  9999. $path = $this->normalizePath($path);
  10000. return is_dir($path.'/.git');
  10001. }
  10002. protected function getShortHash($reference)
  10003. {
  10004. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10005. return substr($reference, 0, 10);
  10006. }
  10007. return $reference;
  10008. }
  10009. }
  10010. <?php
  10011. namespace Composer\Downloader;
  10012. use Composer\Config;
  10013. use Composer\Cache;
  10014. use Composer\EventDispatcher\EventDispatcher;
  10015. use Composer\Package\PackageInterface;
  10016. use Composer\Util\Platform;
  10017. use Composer\Util\ProcessExecutor;
  10018. use Composer\Util\RemoteFilesystem;
  10019. use Composer\IO\IOInterface;
  10020. class GzipDownloader extends ArchiveDownloader
  10021. {
  10022. protected $process;
  10023. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10024. {
  10025. $this->process = $process ?: new ProcessExecutor($io);
  10026. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10027. }
  10028. protected function extract($file, $path)
  10029. {
  10030. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10031. if (!Platform::isWindows()) {
  10032. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10033. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10034. return;
  10035. }
  10036. if (extension_loaded('zlib')) {
  10037. $this->extractUsingExt($file, $targetFilepath);
  10038. return;
  10039. }
  10040. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10041. throw new \RuntimeException($processError);
  10042. }
  10043. $this->extractUsingExt($file, $targetFilepath);
  10044. }
  10045. protected function getFileName(PackageInterface $package, $path)
  10046. {
  10047. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10048. }
  10049. private function extractUsingExt($file, $targetFilepath)
  10050. {
  10051. $archiveFile = gzopen($file, 'rb');
  10052. $targetFile = fopen($targetFilepath, 'wb');
  10053. while ($string = gzread($archiveFile, 4096)) {
  10054. fwrite($targetFile, $string, Platform::strlen($string));
  10055. }
  10056. gzclose($archiveFile);
  10057. fclose($targetFile);
  10058. }
  10059. }
  10060. <?php
  10061. namespace Composer\Downloader;
  10062. use Composer\Package\PackageInterface;
  10063. use Composer\Util\ProcessExecutor;
  10064. class HgDownloader extends VcsDownloader
  10065. {
  10066. public function doDownload(PackageInterface $package, $path, $url)
  10067. {
  10068. $this->config->prohibitUrlByConfig($url, $this->io);
  10069. $url = ProcessExecutor::escape($url);
  10070. $ref = ProcessExecutor::escape($package->getSourceReference());
  10071. $this->io->writeError(" Cloning ".$package->getSourceReference());
  10072. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  10073. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10074. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10075. }
  10076. $command = sprintf('hg up %s', $ref);
  10077. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10078. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10079. }
  10080. }
  10081. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10082. {
  10083. $this->config->prohibitUrlByConfig($url, $this->io);
  10084. $url = ProcessExecutor::escape($url);
  10085. $ref = ProcessExecutor::escape($target->getSourceReference());
  10086. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10087. if (!$this->hasMetadataRepository($path)) {
  10088. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10089. }
  10090. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  10091. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10092. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10093. }
  10094. }
  10095. public function getLocalChanges(PackageInterface $package, $path)
  10096. {
  10097. if (!is_dir($path.'/.hg')) {
  10098. return null;
  10099. }
  10100. $this->process->execute('hg st', $output, realpath($path));
  10101. return trim($output) ?: null;
  10102. }
  10103. protected function getCommitLogs($fromReference, $toReference, $path)
  10104. {
  10105. $command = sprintf('hg log -r %s:%s --style compact', $fromReference, $toReference);
  10106. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10107. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10108. }
  10109. return $output;
  10110. }
  10111. protected function hasMetadataRepository($path)
  10112. {
  10113. return is_dir($path . '/.hg');
  10114. }
  10115. }
  10116. <?php
  10117. namespace Composer\Downloader;
  10118. use Composer\Package\Dumper\ArrayDumper;
  10119. use Composer\Package\PackageInterface;
  10120. use Composer\Package\Version\VersionGuesser;
  10121. use Composer\Package\Version\VersionParser;
  10122. use Composer\Util\Platform;
  10123. use Composer\Util\ProcessExecutor;
  10124. use Symfony\Component\Filesystem\Exception\IOException;
  10125. use Symfony\Component\Filesystem\Filesystem;
  10126. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10127. {
  10128. const STRATEGY_SYMLINK = 10;
  10129. const STRATEGY_MIRROR = 20;
  10130. public function download(PackageInterface $package, $path, $output = true)
  10131. {
  10132. $url = $package->getDistUrl();
  10133. $realUrl = realpath($url);
  10134. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10135. throw new \RuntimeException(sprintf(
  10136. 'Source path "%s" is not found for package %s', $url, $package->getName()
  10137. ));
  10138. }
  10139. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10140. throw new \RuntimeException(sprintf(
  10141. 'Package %s cannot install to "%s" inside its source at "%s"',
  10142. $package->getName(), realpath($path), $realUrl
  10143. ));
  10144. }
  10145. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10146. $currentStrategy = self::STRATEGY_SYMLINK;
  10147. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10148. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  10149. if ($mirrorPathRepos) {
  10150. $currentStrategy = self::STRATEGY_MIRROR;
  10151. }
  10152. if (true === $transportOptions['symlink']) {
  10153. $currentStrategy = self::STRATEGY_SYMLINK;
  10154. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10155. } elseif (false === $transportOptions['symlink']) {
  10156. $currentStrategy = self::STRATEGY_MIRROR;
  10157. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10158. }
  10159. $fileSystem = new Filesystem();
  10160. $this->filesystem->removeDirectory($path);
  10161. if ($output) {
  10162. $this->io->writeError(sprintf(
  10163. ' - Installing <info>%s</info> (<comment>%s</comment>)',
  10164. $package->getName(),
  10165. $package->getFullPrettyVersion()
  10166. ), false);
  10167. }
  10168. $isFallback = false;
  10169. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  10170. try {
  10171. if (Platform::isWindows()) {
  10172. $this->filesystem->junction($realUrl, $path);
  10173. $this->io->writeError(sprintf(' Junctioned from %s', $url), false);
  10174. } else {
  10175. $absolutePath = $path;
  10176. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  10177. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  10178. }
  10179. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  10180. $path = rtrim($path, "/");
  10181. $fileSystem->symlink($shortestPath, $path);
  10182. $this->io->writeError(sprintf(' Symlinked from %s', $url), false);
  10183. }
  10184. } catch (IOException $e) {
  10185. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  10186. $this->io->writeError('');
  10187. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  10188. $currentStrategy = self::STRATEGY_MIRROR;
  10189. $isFallback = true;
  10190. } else {
  10191. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  10192. }
  10193. }
  10194. }
  10195. if (self::STRATEGY_MIRROR == $currentStrategy) {
  10196. $fileSystem->mirror($realUrl, $path);
  10197. $this->io->writeError(sprintf('%s Mirrored from %s', $isFallback ? ' ' : '', $url), false);
  10198. }
  10199. $this->io->writeError('');
  10200. }
  10201. public function remove(PackageInterface $package, $path, $output = true)
  10202. {
  10203. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  10204. if ($output) {
  10205. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10206. }
  10207. if (!$this->filesystem->removeJunction($path)) {
  10208. $this->io->writeError(" <warn>Could not remove junction at " . $path . " - is another process locking it?</warn>");
  10209. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  10210. }
  10211. } else {
  10212. parent::remove($package, $path);
  10213. }
  10214. }
  10215. public function getVcsReference(PackageInterface $package, $path)
  10216. {
  10217. $parser = new VersionParser;
  10218. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  10219. $dumper = new ArrayDumper;
  10220. $packageConfig = $dumper->dump($package);
  10221. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10222. return $packageVersion['commit'];
  10223. }
  10224. }
  10225. }
  10226. <?php
  10227. namespace Composer\Downloader;
  10228. use Composer\Util\Filesystem;
  10229. class PearPackageExtractor
  10230. {
  10231. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  10232. private $filesystem;
  10233. private $file;
  10234. public function __construct($file)
  10235. {
  10236. if (!is_file($file)) {
  10237. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  10238. }
  10239. $this->filesystem = new Filesystem();
  10240. $this->file = $file;
  10241. }
  10242. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  10243. {
  10244. $extractionPath = $target.'/tarball';
  10245. try {
  10246. $archive = new \PharData($this->file);
  10247. $archive->extractTo($extractionPath, null, true);
  10248. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  10249. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  10250. }
  10251. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  10252. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  10253. $this->filesystem->removeDirectory($extractionPath);
  10254. } catch (\Exception $exception) {
  10255. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  10256. }
  10257. }
  10258. private function copyFiles($files, $source, $target, $roles, $vars)
  10259. {
  10260. foreach ($files as $file) {
  10261. $from = $this->combine($source, $file['from']);
  10262. $to = $this->combine($target, $roles[$file['role']]);
  10263. $to = $this->combine($to, $file['to']);
  10264. $tasks = $file['tasks'];
  10265. $this->copyFile($from, $to, $tasks, $vars);
  10266. }
  10267. }
  10268. private function copyFile($from, $to, $tasks, $vars)
  10269. {
  10270. if (!is_file($from)) {
  10271. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  10272. }
  10273. $this->filesystem->ensureDirectoryExists(dirname($to));
  10274. if (0 == count($tasks)) {
  10275. $copied = copy($from, $to);
  10276. } else {
  10277. $content = file_get_contents($from);
  10278. $replacements = array();
  10279. foreach ($tasks as $task) {
  10280. $pattern = $task['from'];
  10281. $varName = $task['to'];
  10282. if (isset($vars[$varName])) {
  10283. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  10284. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  10285. } else {
  10286. $replacements[$pattern] = $vars[$varName];
  10287. }
  10288. }
  10289. }
  10290. $content = strtr($content, $replacements);
  10291. $copied = file_put_contents($to, $content);
  10292. }
  10293. if (false === $copied) {
  10294. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  10295. }
  10296. }
  10297. private function buildCopyActions($source, array $roles, $vars)
  10298. {
  10299. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  10300. if (false === $package) {
  10301. throw new \RuntimeException('Package definition file is not valid.');
  10302. }
  10303. $packageSchemaVersion = $package['version'];
  10304. if ('1.0' == $packageSchemaVersion) {
  10305. $children = $package->release->filelist->children();
  10306. $packageName = (string) $package->name;
  10307. $packageVersion = (string) $package->release->version;
  10308. $sourceDir = $packageName . '-' . $packageVersion;
  10309. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  10310. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  10311. $children = $package->contents->children();
  10312. $packageName = (string) $package->name;
  10313. $packageVersion = (string) $package->version->release;
  10314. $sourceDir = $packageName . '-' . $packageVersion;
  10315. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  10316. $namespaces = $package->getNamespaces();
  10317. $package->registerXPathNamespace('ns', $namespaces['']);
  10318. $releaseNodes = $package->xpath('ns:phprelease');
  10319. $this->applyRelease($result, $releaseNodes, $vars);
  10320. } else {
  10321. throw new \RuntimeException('Unsupported schema version of package definition file.');
  10322. }
  10323. return $result;
  10324. }
  10325. private function applyRelease(&$actions, $releaseNodes, $vars)
  10326. {
  10327. foreach ($releaseNodes as $releaseNode) {
  10328. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  10329. if ($requiredOs && $vars['os'] != $requiredOs) {
  10330. continue;
  10331. }
  10332. if ($releaseNode->filelist) {
  10333. foreach ($releaseNode->filelist->children() as $action) {
  10334. if ('install' == $action->getName()) {
  10335. $name = (string) $action['name'];
  10336. $as = (string) $action['as'];
  10337. if (isset($actions[$name])) {
  10338. $actions[$name]['to'] = $as;
  10339. }
  10340. } elseif ('ignore' == $action->getName()) {
  10341. $name = (string) $action['name'];
  10342. unset($actions[$name]);
  10343. } else {
  10344. }
  10345. }
  10346. }
  10347. break;
  10348. }
  10349. }
  10350. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  10351. {
  10352. $result = array();
  10353. foreach ($children as $child) {
  10354. if ($child->getName() == 'dir') {
  10355. $dirSource = $this->combine($source, (string) $child['name']);
  10356. $dirTarget = $child['baseinstalldir'] ?: $target;
  10357. $dirRole = $child['role'] ?: $role;
  10358. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10359. $result = array_merge($result, $dirFiles);
  10360. } elseif ($child->getName() == 'file') {
  10361. $fileRole = (string) $child['role'] ?: $role;
  10362. if (isset($targetRoles[$fileRole])) {
  10363. $fileName = (string) ($child['name'] ?: $child[0]);
  10364. $fileSource = $this->combine($source, $fileName);
  10365. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  10366. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10367. $fileTarget = $packageName . '/' . $fileTarget;
  10368. }
  10369. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  10370. }
  10371. }
  10372. }
  10373. return $result;
  10374. }
  10375. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  10376. {
  10377. $result = array();
  10378. foreach ($children as $child) {
  10379. if ('dir' == $child->getName()) {
  10380. $dirSource = $this->combine($source, $child['name']);
  10381. $dirTarget = $child['baseinstalldir'] ?: $target;
  10382. $dirRole = $child['role'] ?: $role;
  10383. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10384. $result = array_merge($result, $dirFiles);
  10385. } elseif ('file' == $child->getName()) {
  10386. $fileRole = (string) $child['role'] ?: $role;
  10387. if (isset($targetRoles[$fileRole])) {
  10388. $fileSource = $this->combine($source, (string) $child['name']);
  10389. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  10390. $fileTasks = array();
  10391. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  10392. if ('replace' == $taskNode->getName()) {
  10393. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  10394. }
  10395. }
  10396. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10397. $fileTarget = $packageName . '/' . $fileTarget;
  10398. }
  10399. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  10400. }
  10401. }
  10402. }
  10403. return $result;
  10404. }
  10405. private function combine($left, $right)
  10406. {
  10407. return rtrim($left, '/') . '/' . ltrim($right, '/');
  10408. }
  10409. }
  10410. <?php
  10411. namespace Composer\Downloader;
  10412. use Composer\Package\PackageInterface;
  10413. use Composer\Repository\VcsRepository;
  10414. use Composer\Util\Perforce;
  10415. class PerforceDownloader extends VcsDownloader
  10416. {
  10417. protected $perforce;
  10418. public function doDownload(PackageInterface $package, $path, $url)
  10419. {
  10420. $ref = $package->getSourceReference();
  10421. $label = $this->getLabelFromSourceReference($ref);
  10422. $this->io->writeError(' Cloning ' . $ref);
  10423. $this->initPerforce($package, $path, $url);
  10424. $this->perforce->setStream($ref);
  10425. $this->perforce->p4Login();
  10426. $this->perforce->writeP4ClientSpec();
  10427. $this->perforce->connectClient();
  10428. $this->perforce->syncCodeBase($label);
  10429. $this->perforce->cleanupClientSpec();
  10430. }
  10431. private function getLabelFromSourceReference($ref)
  10432. {
  10433. $pos = strpos($ref, '@');
  10434. if (false !== $pos) {
  10435. return substr($ref, $pos + 1);
  10436. }
  10437. return null;
  10438. }
  10439. public function initPerforce(PackageInterface $package, $path, $url)
  10440. {
  10441. if (!empty($this->perforce)) {
  10442. $this->perforce->initializePath($path);
  10443. return;
  10444. }
  10445. $repository = $package->getRepository();
  10446. $repoConfig = null;
  10447. if ($repository instanceof VcsRepository) {
  10448. $repoConfig = $this->getRepoConfig($repository);
  10449. }
  10450. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  10451. }
  10452. private function getRepoConfig(VcsRepository $repository)
  10453. {
  10454. return $repository->getRepoConfig();
  10455. }
  10456. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10457. {
  10458. $this->doDownload($target, $path, $url);
  10459. }
  10460. public function getLocalChanges(PackageInterface $package, $path)
  10461. {
  10462. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  10463. return;
  10464. }
  10465. protected function getCommitLogs($fromReference, $toReference, $path)
  10466. {
  10467. $commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference);
  10468. return $commitLogs;
  10469. }
  10470. public function setPerforce($perforce)
  10471. {
  10472. $this->perforce = $perforce;
  10473. }
  10474. protected function hasMetadataRepository($path)
  10475. {
  10476. return true;
  10477. }
  10478. }
  10479. <?php
  10480. namespace Composer\Downloader;
  10481. class PharDownloader extends ArchiveDownloader
  10482. {
  10483. protected function extract($file, $path)
  10484. {
  10485. $archive = new \Phar($file);
  10486. $archive->extractTo($path, null, true);
  10487. }
  10488. }
  10489. <?php
  10490. namespace Composer\Downloader;
  10491. use Composer\Config;
  10492. use Composer\Cache;
  10493. use Composer\EventDispatcher\EventDispatcher;
  10494. use Composer\Util\IniHelper;
  10495. use Composer\Util\Platform;
  10496. use Composer\Util\ProcessExecutor;
  10497. use Composer\Util\RemoteFilesystem;
  10498. use Composer\IO\IOInterface;
  10499. use RarArchive;
  10500. class RarDownloader extends ArchiveDownloader
  10501. {
  10502. protected $process;
  10503. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10504. {
  10505. $this->process = $process ?: new ProcessExecutor($io);
  10506. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10507. }
  10508. protected function extract($file, $path)
  10509. {
  10510. $processError = null;
  10511. if (!Platform::isWindows()) {
  10512. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  10513. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10514. return;
  10515. }
  10516. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10517. }
  10518. if (!class_exists('RarArchive')) {
  10519. $iniMessage = IniHelper::getMessage();
  10520. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  10521. . $iniMessage . "\n" . $processError;
  10522. if (!Platform::isWindows()) {
  10523. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  10524. }
  10525. throw new \RuntimeException($error);
  10526. }
  10527. $rarArchive = RarArchive::open($file);
  10528. if (false === $rarArchive) {
  10529. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  10530. }
  10531. $entries = $rarArchive->getEntries();
  10532. if (false === $entries) {
  10533. throw new \RuntimeException('Could not retrieve RAR archive entries');
  10534. }
  10535. foreach ($entries as $entry) {
  10536. if (false === $entry->extract($path)) {
  10537. throw new \RuntimeException('Could not extract entry');
  10538. }
  10539. }
  10540. $rarArchive->close();
  10541. }
  10542. }
  10543. <?php
  10544. namespace Composer\Downloader;
  10545. use Composer\Package\PackageInterface;
  10546. use Composer\Util\Svn as SvnUtil;
  10547. use Composer\Repository\VcsRepository;
  10548. class SvnDownloader extends VcsDownloader
  10549. {
  10550. protected $cacheCredentials = true;
  10551. public function doDownload(PackageInterface $package, $path, $url)
  10552. {
  10553. SvnUtil::cleanEnv();
  10554. $ref = $package->getSourceReference();
  10555. $repo = $package->getRepository();
  10556. if ($repo instanceof VcsRepository) {
  10557. $repoConfig = $repo->getRepoConfig();
  10558. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  10559. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  10560. }
  10561. }
  10562. $this->io->writeError(" Checking out ".$package->getSourceReference());
  10563. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  10564. }
  10565. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10566. {
  10567. SvnUtil::cleanEnv();
  10568. $ref = $target->getSourceReference();
  10569. if (!$this->hasMetadataRepository($path)) {
  10570. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10571. }
  10572. $flags = "";
  10573. if (0 === $this->process->execute('svn --version', $output)) {
  10574. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
  10575. $flags .= ' --ignore-ancestry';
  10576. }
  10577. }
  10578. $this->io->writeError(" Checking out " . $ref);
  10579. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  10580. }
  10581. public function getLocalChanges(PackageInterface $package, $path)
  10582. {
  10583. if (!$this->hasMetadataRepository($path)) {
  10584. return null;
  10585. }
  10586. $this->process->execute('svn status --ignore-externals', $output, $path);
  10587. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  10588. }
  10589. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  10590. {
  10591. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  10592. $util->setCacheCredentials($this->cacheCredentials);
  10593. try {
  10594. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  10595. } catch (\RuntimeException $e) {
  10596. throw new \RuntimeException(
  10597. 'Package could not be downloaded, '.$e->getMessage()
  10598. );
  10599. }
  10600. }
  10601. protected function cleanChanges(PackageInterface $package, $path, $update)
  10602. {
  10603. if (!$changes = $this->getLocalChanges($package, $path)) {
  10604. return;
  10605. }
  10606. if (!$this->io->isInteractive()) {
  10607. if (true === $this->config->get('discard-changes')) {
  10608. return $this->discardChanges($path);
  10609. }
  10610. return parent::cleanChanges($package, $path, $update);
  10611. }
  10612. $changes = array_map(function ($elem) {
  10613. return ' '.$elem;
  10614. }, preg_split('{\s*\r?\n\s*}', $changes));
  10615. $this->io->writeError(' <error>The package has modified files:</error>');
  10616. $this->io->writeError(array_slice($changes, 0, 10));
  10617. if (count($changes) > 10) {
  10618. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  10619. }
  10620. while (true) {
  10621. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  10622. case 'y':
  10623. $this->discardChanges($path);
  10624. break 2;
  10625. case 'n':
  10626. throw new \RuntimeException('Update aborted');
  10627. case 'v':
  10628. $this->io->writeError($changes);
  10629. break;
  10630. case '?':
  10631. default:
  10632. $this->io->writeError(array(
  10633. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10634. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10635. ' v - view modified files',
  10636. ' ? - print help',
  10637. ));
  10638. break;
  10639. }
  10640. }
  10641. }
  10642. protected function getCommitLogs($fromReference, $toReference, $path)
  10643. {
  10644. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  10645. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  10646. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  10647. $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
  10648. if (0 !== $this->process->execute($command, $output, $path)) {
  10649. throw new \RuntimeException(
  10650. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  10651. );
  10652. }
  10653. } else {
  10654. $output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  10655. }
  10656. return $output;
  10657. }
  10658. protected function discardChanges($path)
  10659. {
  10660. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  10661. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10662. }
  10663. }
  10664. protected function hasMetadataRepository($path)
  10665. {
  10666. return is_dir($path.'/.svn');
  10667. }
  10668. }
  10669. <?php
  10670. namespace Composer\Downloader;
  10671. class TarDownloader extends ArchiveDownloader
  10672. {
  10673. protected function extract($file, $path)
  10674. {
  10675. $archive = new \PharData($file);
  10676. $archive->extractTo($path, null, true);
  10677. }
  10678. }
  10679. <?php
  10680. namespace Composer\Downloader;
  10681. class TransportException extends \RuntimeException
  10682. {
  10683. protected $headers;
  10684. protected $response;
  10685. protected $statusCode;
  10686. public function setHeaders($headers)
  10687. {
  10688. $this->headers = $headers;
  10689. }
  10690. public function getHeaders()
  10691. {
  10692. return $this->headers;
  10693. }
  10694. public function setResponse($response)
  10695. {
  10696. $this->response = $response;
  10697. }
  10698. public function getResponse()
  10699. {
  10700. return $this->response;
  10701. }
  10702. public function setStatusCode($statusCode)
  10703. {
  10704. $this->statusCode = $statusCode;
  10705. }
  10706. public function getStatusCode()
  10707. {
  10708. return $this->statusCode;
  10709. }
  10710. }
  10711. <?php
  10712. namespace Composer\Downloader;
  10713. use Composer\Package\PackageInterface;
  10714. interface VcsCapableDownloaderInterface
  10715. {
  10716. public function getVcsReference(PackageInterface $package, $path);
  10717. }
  10718. <?php
  10719. namespace Composer\Downloader;
  10720. use Composer\Config;
  10721. use Composer\Package\Dumper\ArrayDumper;
  10722. use Composer\Package\PackageInterface;
  10723. use Composer\Package\Version\VersionGuesser;
  10724. use Composer\Package\Version\VersionParser;
  10725. use Composer\Util\ProcessExecutor;
  10726. use Composer\IO\IOInterface;
  10727. use Composer\Util\Filesystem;
  10728. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  10729. {
  10730. protected $io;
  10731. protected $config;
  10732. protected $process;
  10733. protected $filesystem;
  10734. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10735. {
  10736. $this->io = $io;
  10737. $this->config = $config;
  10738. $this->process = $process ?: new ProcessExecutor($io);
  10739. $this->filesystem = $fs ?: new Filesystem($this->process);
  10740. }
  10741. public function getInstallationSource()
  10742. {
  10743. return 'source';
  10744. }
  10745. public function download(PackageInterface $package, $path)
  10746. {
  10747. if (!$package->getSourceReference()) {
  10748. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  10749. }
  10750. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)", false);
  10751. $this->filesystem->emptyDirectory($path);
  10752. $urls = $package->getSourceUrls();
  10753. while ($url = array_shift($urls)) {
  10754. try {
  10755. if (Filesystem::isLocalPath($url)) {
  10756. $needle = 'file://';
  10757. $isFileProtocol = false;
  10758. if (0 === strpos($url, $needle)) {
  10759. $url = substr($url, strlen($needle));
  10760. $isFileProtocol = true;
  10761. }
  10762. if (false !== strpos($url, '%')) {
  10763. $url = rawurldecode($url);
  10764. }
  10765. $url = realpath($url);
  10766. if ($isFileProtocol) {
  10767. $url = $needle . $url;
  10768. }
  10769. }
  10770. $this->doDownload($package, $path, $url);
  10771. break;
  10772. } catch (\Exception $e) {
  10773. if ($e instanceof \PHPUnit_Framework_Exception) {
  10774. throw $e;
  10775. }
  10776. if ($this->io->isDebug()) {
  10777. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  10778. } elseif (count($urls)) {
  10779. $this->io->writeError(' Failed, trying the next URL');
  10780. }
  10781. if (!count($urls)) {
  10782. throw $e;
  10783. }
  10784. }
  10785. }
  10786. }
  10787. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10788. {
  10789. if (!$target->getSourceReference()) {
  10790. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  10791. }
  10792. $name = $target->getName();
  10793. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  10794. if ($target->getSourceType() === 'svn') {
  10795. $from = $initial->getSourceReference();
  10796. $to = $target->getSourceReference();
  10797. } else {
  10798. $from = substr($initial->getSourceReference(), 0, 7);
  10799. $to = substr($target->getSourceReference(), 0, 7);
  10800. }
  10801. $name .= ' '.$initial->getPrettyVersion();
  10802. } else {
  10803. $from = $initial->getFullPrettyVersion();
  10804. $to = $target->getFullPrettyVersion();
  10805. }
  10806. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)", false);
  10807. $this->cleanChanges($initial, $path, true);
  10808. $urls = $target->getSourceUrls();
  10809. $exception = null;
  10810. while ($url = array_shift($urls)) {
  10811. try {
  10812. if (Filesystem::isLocalPath($url)) {
  10813. $url = realpath($url);
  10814. }
  10815. $this->doUpdate($initial, $target, $path, $url);
  10816. $exception = null;
  10817. break;
  10818. } catch (\Exception $exception) {
  10819. if ($exception instanceof \PHPUnit_Framework_Exception) {
  10820. throw $exception;
  10821. }
  10822. if ($this->io->isDebug()) {
  10823. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  10824. } elseif (count($urls)) {
  10825. $this->io->writeError(' Failed, trying the next URL');
  10826. }
  10827. }
  10828. }
  10829. $this->reapplyChanges($path);
  10830. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  10831. $message = 'Pulling in changes:';
  10832. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  10833. if (!trim($logs)) {
  10834. $message = 'Rolling back changes:';
  10835. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  10836. }
  10837. if (trim($logs)) {
  10838. $logs = implode("\n", array_map(function ($line) {
  10839. return ' ' . $line;
  10840. }, explode("\n", $logs)));
  10841. $logs = str_replace('<', '\<', $logs);
  10842. $this->io->writeError(' '.$message);
  10843. $this->io->writeError($logs);
  10844. }
  10845. }
  10846. if (!$urls && $exception) {
  10847. throw $exception;
  10848. }
  10849. }
  10850. public function remove(PackageInterface $package, $path)
  10851. {
  10852. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  10853. $this->cleanChanges($package, $path, false);
  10854. if (!$this->filesystem->removeDirectory($path)) {
  10855. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10856. }
  10857. }
  10858. public function setOutputProgress($outputProgress)
  10859. {
  10860. return $this;
  10861. }
  10862. public function getVcsReference(PackageInterface $package, $path)
  10863. {
  10864. $parser = new VersionParser;
  10865. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  10866. $dumper = new ArrayDumper;
  10867. $packageConfig = $dumper->dump($package);
  10868. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10869. return $packageVersion['commit'];
  10870. }
  10871. }
  10872. protected function cleanChanges(PackageInterface $package, $path, $update)
  10873. {
  10874. if (null !== $this->getLocalChanges($package, $path)) {
  10875. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  10876. }
  10877. }
  10878. protected function reapplyChanges($path)
  10879. {
  10880. }
  10881. abstract protected function doDownload(PackageInterface $package, $path, $url);
  10882. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  10883. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  10884. abstract protected function hasMetadataRepository($path);
  10885. }
  10886. <?php
  10887. namespace Composer\Downloader;
  10888. use Composer\Config;
  10889. use Composer\Cache;
  10890. use Composer\EventDispatcher\EventDispatcher;
  10891. use Composer\Package\PackageInterface;
  10892. use Composer\Util\ProcessExecutor;
  10893. use Composer\Util\RemoteFilesystem;
  10894. use Composer\IO\IOInterface;
  10895. class XzDownloader extends ArchiveDownloader
  10896. {
  10897. protected $process;
  10898. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10899. {
  10900. $this->process = $process ?: new ProcessExecutor($io);
  10901. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10902. }
  10903. protected function extract($file, $path)
  10904. {
  10905. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  10906. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10907. return;
  10908. }
  10909. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10910. throw new \RuntimeException($processError);
  10911. }
  10912. protected function getFileName(PackageInterface $package, $path)
  10913. {
  10914. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10915. }
  10916. }
  10917. <?php
  10918. namespace Composer\Downloader;
  10919. use Composer\Config;
  10920. use Composer\Cache;
  10921. use Composer\EventDispatcher\EventDispatcher;
  10922. use Composer\Package\PackageInterface;
  10923. use Composer\Util\IniHelper;
  10924. use Composer\Util\Platform;
  10925. use Composer\Util\ProcessExecutor;
  10926. use Composer\Util\RemoteFilesystem;
  10927. use Composer\IO\IOInterface;
  10928. use Symfony\Component\Process\ExecutableFinder;
  10929. use ZipArchive;
  10930. class ZipDownloader extends ArchiveDownloader
  10931. {
  10932. protected $process;
  10933. protected static $hasSystemUnzip;
  10934. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10935. {
  10936. $this->process = $process ?: new ProcessExecutor($io);
  10937. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10938. }
  10939. public function download(PackageInterface $package, $path, $output = true)
  10940. {
  10941. if (null === self::$hasSystemUnzip) {
  10942. $finder = new ExecutableFinder;
  10943. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  10944. }
  10945. if (!class_exists('ZipArchive') && !self::$hasSystemUnzip) {
  10946. $iniMessage = IniHelper::getMessage();
  10947. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  10948. throw new \RuntimeException($error);
  10949. }
  10950. return parent::download($package, $path, $output);
  10951. }
  10952. protected function extract($file, $path)
  10953. {
  10954. $processError = null;
  10955. if (self::$hasSystemUnzip && !(class_exists('ZipArchive') && Platform::isWindows())) {
  10956. $command = 'unzip -qq '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  10957. if (!Platform::isWindows()) {
  10958. $command .= ' && chmod -R u+w ' . ProcessExecutor::escape($path);
  10959. }
  10960. try {
  10961. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10962. return;
  10963. }
  10964. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10965. } catch (\Exception $e) {
  10966. $processError = 'Failed to execute ' . $command . "\n\n" . $e->getMessage();
  10967. }
  10968. if (!class_exists('ZipArchive')) {
  10969. throw new \RuntimeException($processError);
  10970. }
  10971. }
  10972. $zipArchive = new ZipArchive();
  10973. if (true !== ($retval = $zipArchive->open($file))) {
  10974. throw new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n".$processError), $retval);
  10975. }
  10976. if (true !== $zipArchive->extractTo($path)) {
  10977. throw new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n".$processError));
  10978. }
  10979. $zipArchive->close();
  10980. }
  10981. protected function getErrorMessage($retval, $file)
  10982. {
  10983. switch ($retval) {
  10984. case ZipArchive::ER_EXISTS:
  10985. return sprintf("File '%s' already exists.", $file);
  10986. case ZipArchive::ER_INCONS:
  10987. return sprintf("Zip archive '%s' is inconsistent.", $file);
  10988. case ZipArchive::ER_INVAL:
  10989. return sprintf("Invalid argument (%s)", $file);
  10990. case ZipArchive::ER_MEMORY:
  10991. return sprintf("Malloc failure (%s)", $file);
  10992. case ZipArchive::ER_NOENT:
  10993. return sprintf("No such zip file: '%s'", $file);
  10994. case ZipArchive::ER_NOZIP:
  10995. return sprintf("'%s' is not a zip archive.", $file);
  10996. case ZipArchive::ER_OPEN:
  10997. return sprintf("Can't open zip file: %s", $file);
  10998. case ZipArchive::ER_READ:
  10999. return sprintf("Zip read error (%s)", $file);
  11000. case ZipArchive::ER_SEEK:
  11001. return sprintf("Zip seek error (%s)", $file);
  11002. default:
  11003. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11004. }
  11005. }
  11006. }
  11007. <?php
  11008. namespace Composer\EventDispatcher;
  11009. class Event
  11010. {
  11011. protected $name;
  11012. protected $args;
  11013. protected $flags;
  11014. private $propagationStopped = false;
  11015. public function __construct($name, array $args = array(), array $flags = array())
  11016. {
  11017. $this->name = $name;
  11018. $this->args = $args;
  11019. $this->flags = $flags;
  11020. }
  11021. public function getName()
  11022. {
  11023. return $this->name;
  11024. }
  11025. public function getArguments()
  11026. {
  11027. return $this->args;
  11028. }
  11029. public function getFlags()
  11030. {
  11031. return $this->flags;
  11032. }
  11033. public function isPropagationStopped()
  11034. {
  11035. return $this->propagationStopped;
  11036. }
  11037. public function stopPropagation()
  11038. {
  11039. $this->propagationStopped = true;
  11040. }
  11041. }
  11042. <?php
  11043. namespace Composer\EventDispatcher;
  11044. use Composer\DependencyResolver\PolicyInterface;
  11045. use Composer\DependencyResolver\Pool;
  11046. use Composer\DependencyResolver\Request;
  11047. use Composer\Installer\InstallerEvent;
  11048. use Composer\IO\IOInterface;
  11049. use Composer\Composer;
  11050. use Composer\DependencyResolver\Operation\OperationInterface;
  11051. use Composer\Repository\CompositeRepository;
  11052. use Composer\Script;
  11053. use Composer\Installer\PackageEvent;
  11054. use Composer\Installer\BinaryInstaller;
  11055. use Composer\Util\ProcessExecutor;
  11056. use Composer\Script\Event as ScriptEvent;
  11057. use Symfony\Component\Process\PhpExecutableFinder;
  11058. class EventDispatcher
  11059. {
  11060. protected $composer;
  11061. protected $io;
  11062. protected $loader;
  11063. protected $process;
  11064. protected $listeners;
  11065. private $eventStack;
  11066. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  11067. {
  11068. $this->composer = $composer;
  11069. $this->io = $io;
  11070. $this->process = $process ?: new ProcessExecutor($io);
  11071. $this->eventStack = array();
  11072. }
  11073. public function dispatch($eventName, Event $event = null)
  11074. {
  11075. if (null === $event) {
  11076. $event = new Event($eventName);
  11077. }
  11078. return $this->doDispatch($event);
  11079. }
  11080. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  11081. {
  11082. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  11083. }
  11084. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  11085. {
  11086. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  11087. }
  11088. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  11089. {
  11090. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  11091. }
  11092. protected function doDispatch(Event $event)
  11093. {
  11094. $pathStr = 'PATH';
  11095. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  11096. $pathStr = 'Path';
  11097. }
  11098. $binDir = $this->composer->getConfig()->get('bin-dir');
  11099. if (is_dir($binDir)) {
  11100. $binDir = realpath($binDir);
  11101. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  11102. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  11103. putenv($pathStr.'='.$_SERVER[$pathStr]);
  11104. }
  11105. }
  11106. $listeners = $this->getListeners($event);
  11107. $this->pushEvent($event);
  11108. $return = 0;
  11109. foreach ($listeners as $callable) {
  11110. if (!is_string($callable) && is_callable($callable)) {
  11111. $event = $this->checkListenerExpectedEvent($callable, $event);
  11112. $return = false === call_user_func($callable, $event) ? 1 : 0;
  11113. } elseif ($this->isComposerScript($callable)) {
  11114. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  11115. $scriptName = substr($callable, 1);
  11116. $args = $event->getArguments();
  11117. $flags = $event->getFlags();
  11118. if (substr($callable, 0, 10) === '@composer ') {
  11119. $finder = new PhpExecutableFinder();
  11120. $phpPath = $finder->find();
  11121. if (!$phpPath) {
  11122. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  11123. }
  11124. $exec = $phpPath . ' ' . realpath($_SERVER['argv'][0]) . substr($callable, 9);
  11125. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11126. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()));
  11127. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11128. }
  11129. } else {
  11130. if (!$this->getListeners(new Event($scriptName))) {
  11131. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable));
  11132. }
  11133. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  11134. }
  11135. } elseif ($this->isPhpScript($callable)) {
  11136. $className = substr($callable, 0, strpos($callable, '::'));
  11137. $methodName = substr($callable, strpos($callable, '::') + 2);
  11138. if (!class_exists($className)) {
  11139. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>');
  11140. continue;
  11141. }
  11142. if (!is_callable($callable)) {
  11143. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>');
  11144. continue;
  11145. }
  11146. try {
  11147. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  11148. } catch (\Exception $e) {
  11149. $message = "Script %s handling the %s event terminated with an exception";
  11150. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>');
  11151. throw $e;
  11152. }
  11153. } else {
  11154. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  11155. $exec = $callable . ($args === '' ? '' : ' '.$args);
  11156. if ($this->io->isVerbose()) {
  11157. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  11158. } else {
  11159. $this->io->writeError(sprintf('> %s', $exec));
  11160. }
  11161. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  11162. if ($possibleLocalBinaries) {
  11163. foreach ($possibleLocalBinaries as $localExec) {
  11164. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  11165. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  11166. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  11167. break;
  11168. }
  11169. }
  11170. }
  11171. if (substr($exec, 0, 5) === '@php ') {
  11172. $finder = new PhpExecutableFinder();
  11173. $phpPath = $finder->find();
  11174. if (!$phpPath) {
  11175. throw new \RuntimeException('Failed to locate PHP binary to execute "'.$exec.'"');
  11176. }
  11177. $exec = $phpPath . ' ' . substr($exec, 5);
  11178. }
  11179. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11180. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()));
  11181. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11182. }
  11183. }
  11184. if ($event->isPropagationStopped()) {
  11185. break;
  11186. }
  11187. }
  11188. $this->popEvent();
  11189. return $return;
  11190. }
  11191. protected function executeEventPhpScript($className, $methodName, Event $event)
  11192. {
  11193. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  11194. if ($this->io->isVerbose()) {
  11195. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  11196. } else {
  11197. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  11198. }
  11199. return $className::$methodName($event);
  11200. }
  11201. protected function checkListenerExpectedEvent($target, Event $event)
  11202. {
  11203. if (in_array($event->getName(), array(
  11204. 'init',
  11205. 'command',
  11206. 'pre-file-download',
  11207. ), true)) {
  11208. return $event;
  11209. }
  11210. try {
  11211. $reflected = new \ReflectionParameter($target, 0);
  11212. } catch (\Exception $e) {
  11213. return $event;
  11214. }
  11215. $typehint = $reflected->getClass();
  11216. if (!$typehint instanceof \ReflectionClass) {
  11217. return $event;
  11218. }
  11219. $expected = $typehint->getName();
  11220. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  11221. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11222. $event = new \Composer\Script\CommandEvent(
  11223. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  11224. );
  11225. }
  11226. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  11227. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11228. $event = new \Composer\Script\PackageEvent(
  11229. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11230. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  11231. $event->getOperations(), $event->getOperation()
  11232. );
  11233. }
  11234. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  11235. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11236. $event = new \Composer\Script\Event(
  11237. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11238. $event->getArguments(), $event->getFlags()
  11239. );
  11240. }
  11241. return $event;
  11242. }
  11243. private function serializeCallback($cb)
  11244. {
  11245. if (is_array($cb) && count($cb) === 2) {
  11246. if (is_object($cb[0])) {
  11247. $cb[0] = get_class($cb[0]);
  11248. }
  11249. if (is_string($cb[0]) && is_string($cb[1])) {
  11250. $cb = implode('::', $cb);
  11251. }
  11252. }
  11253. if (is_string($cb)) {
  11254. return $cb;
  11255. }
  11256. return var_export($cb, true);
  11257. }
  11258. public function addListener($eventName, $listener, $priority = 0)
  11259. {
  11260. $this->listeners[$eventName][$priority][] = $listener;
  11261. }
  11262. public function addSubscriber(EventSubscriberInterface $subscriber)
  11263. {
  11264. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  11265. if (is_string($params)) {
  11266. $this->addListener($eventName, array($subscriber, $params));
  11267. } elseif (is_string($params[0])) {
  11268. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  11269. } else {
  11270. foreach ($params as $listener) {
  11271. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  11272. }
  11273. }
  11274. }
  11275. }
  11276. protected function getListeners(Event $event)
  11277. {
  11278. $scriptListeners = $this->getScriptListeners($event);
  11279. if (!isset($this->listeners[$event->getName()][0])) {
  11280. $this->listeners[$event->getName()][0] = array();
  11281. }
  11282. krsort($this->listeners[$event->getName()]);
  11283. $listeners = $this->listeners;
  11284. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  11285. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  11286. }
  11287. public function hasEventListeners(Event $event)
  11288. {
  11289. $listeners = $this->getListeners($event);
  11290. return count($listeners) > 0;
  11291. }
  11292. protected function getScriptListeners(Event $event)
  11293. {
  11294. $package = $this->composer->getPackage();
  11295. $scripts = $package->getScripts();
  11296. if (empty($scripts[$event->getName()])) {
  11297. return array();
  11298. }
  11299. if ($this->loader) {
  11300. $this->loader->unregister();
  11301. }
  11302. $generator = $this->composer->getAutoloadGenerator();
  11303. if ($event instanceof ScriptEvent) {
  11304. $generator->setDevMode($event->isDevMode());
  11305. }
  11306. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  11307. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  11308. $map = $generator->parseAutoloads($packageMap, $package);
  11309. $this->loader = $generator->createLoader($map);
  11310. $this->loader->register();
  11311. return $scripts[$event->getName()];
  11312. }
  11313. protected function isPhpScript($callable)
  11314. {
  11315. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  11316. }
  11317. protected function isComposerScript($callable)
  11318. {
  11319. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  11320. }
  11321. protected function pushEvent(Event $event)
  11322. {
  11323. $eventName = $event->getName();
  11324. if (in_array($eventName, $this->eventStack)) {
  11325. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  11326. }
  11327. return array_push($this->eventStack, $eventName);
  11328. }
  11329. protected function popEvent()
  11330. {
  11331. return array_pop($this->eventStack);
  11332. }
  11333. }
  11334. <?php
  11335. namespace Composer\EventDispatcher;
  11336. interface EventSubscriberInterface
  11337. {
  11338. public static function getSubscribedEvents();
  11339. }
  11340. <?php
  11341. namespace Composer\EventDispatcher;
  11342. class ScriptExecutionException extends \RuntimeException
  11343. {
  11344. }
  11345. <?php
  11346. namespace Composer\Exception;
  11347. class NoSslException extends \RuntimeException
  11348. {
  11349. }
  11350. <?php
  11351. namespace Composer;
  11352. use Composer\Config\JsonConfigSource;
  11353. use Composer\Json\JsonFile;
  11354. use Composer\IO\IOInterface;
  11355. use Composer\Package\Archiver;
  11356. use Composer\Package\Version\VersionGuesser;
  11357. use Composer\Repository\RepositoryManager;
  11358. use Composer\Repository\RepositoryFactory;
  11359. use Composer\Repository\WritableRepositoryInterface;
  11360. use Composer\Util\Filesystem;
  11361. use Composer\Util\Platform;
  11362. use Composer\Util\ProcessExecutor;
  11363. use Composer\Util\RemoteFilesystem;
  11364. use Composer\Util\Silencer;
  11365. use Composer\Plugin\PluginEvents;
  11366. use Composer\EventDispatcher\Event;
  11367. use Seld\JsonLint\DuplicateKeyException;
  11368. use Symfony\Component\Console\Formatter\OutputFormatter;
  11369. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  11370. use Symfony\Component\Console\Output\ConsoleOutput;
  11371. use Composer\EventDispatcher\EventDispatcher;
  11372. use Composer\Autoload\AutoloadGenerator;
  11373. use Composer\Package\Version\VersionParser;
  11374. use Composer\Downloader\TransportException;
  11375. use Seld\JsonLint\JsonParser;
  11376. class Factory
  11377. {
  11378. protected static function getHomeDir()
  11379. {
  11380. $home = getenv('COMPOSER_HOME');
  11381. if ($home) {
  11382. return $home;
  11383. }
  11384. if (Platform::isWindows()) {
  11385. if (!getenv('APPDATA')) {
  11386. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  11387. }
  11388. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  11389. }
  11390. $userDir = self::getUserDir();
  11391. if (is_dir($userDir . '/.composer')) {
  11392. return $userDir . '/.composer';
  11393. }
  11394. if (self::useXdg()) {
  11395. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  11396. return $xdgConfig . '/composer';
  11397. }
  11398. return $userDir . '/.composer';
  11399. }
  11400. protected static function getCacheDir($home)
  11401. {
  11402. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  11403. if ($cacheDir) {
  11404. return $cacheDir;
  11405. }
  11406. $homeEnv = getenv('COMPOSER_HOME');
  11407. if ($homeEnv) {
  11408. return $homeEnv . '/cache';
  11409. }
  11410. if (Platform::isWindows()) {
  11411. if ($cacheDir = getenv('LOCALAPPDATA')) {
  11412. $cacheDir .= '/Composer';
  11413. } else {
  11414. $cacheDir = $home . '/cache';
  11415. }
  11416. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  11417. }
  11418. $userDir = self::getUserDir();
  11419. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  11420. return $home . '/cache';
  11421. }
  11422. if (self::useXdg()) {
  11423. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  11424. return $xdgCache . '/composer';
  11425. }
  11426. return $home . '/cache';
  11427. }
  11428. protected static function getDataDir($home)
  11429. {
  11430. $homeEnv = getenv('COMPOSER_HOME');
  11431. if ($homeEnv) {
  11432. return $homeEnv;
  11433. }
  11434. if (Platform::isWindows()) {
  11435. return strtr($home, '\\', '/');
  11436. }
  11437. $userDir = self::getUserDir();
  11438. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  11439. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  11440. return $xdgData . '/composer';
  11441. }
  11442. return $home;
  11443. }
  11444. public static function createConfig(IOInterface $io = null, $cwd = null)
  11445. {
  11446. $cwd = $cwd ?: getcwd();
  11447. $config = new Config(true, $cwd);
  11448. $home = self::getHomeDir();
  11449. $config->merge(array('config' => array(
  11450. 'home' => $home,
  11451. 'cache-dir' => self::getCacheDir($home),
  11452. 'data-dir' => self::getDataDir($home),
  11453. )));
  11454. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  11455. foreach ($dirs as $dir) {
  11456. if (!file_exists($dir . '/.htaccess')) {
  11457. if (!is_dir($dir)) {
  11458. Silencer::call('mkdir', $dir, 0777, true);
  11459. }
  11460. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  11461. }
  11462. }
  11463. $file = new JsonFile($config->get('home').'/config.json');
  11464. if ($file->exists()) {
  11465. if ($io && $io->isDebug()) {
  11466. $io->writeError('Loading config file ' . $file->getPath());
  11467. }
  11468. $config->merge($file->read());
  11469. }
  11470. $config->setConfigSource(new JsonConfigSource($file));
  11471. $file = new JsonFile($config->get('home').'/auth.json');
  11472. if ($file->exists()) {
  11473. if ($io && $io->isDebug()) {
  11474. $io->writeError('Loading config file ' . $file->getPath());
  11475. }
  11476. $config->merge(array('config' => $file->read()));
  11477. }
  11478. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  11479. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  11480. $authData = json_decode($composerAuthEnv, true);
  11481. if (is_null($authData)) {
  11482. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  11483. }
  11484. if ($io && $io->isDebug()) {
  11485. $io->writeError('Loading auth config from COMPOSER_AUTH');
  11486. }
  11487. $config->merge(array('config' => $authData));
  11488. }
  11489. return $config;
  11490. }
  11491. public static function getComposerFile()
  11492. {
  11493. return trim(getenv('COMPOSER')) ?: './composer.json';
  11494. }
  11495. public static function createAdditionalStyles()
  11496. {
  11497. return array(
  11498. 'highlight' => new OutputFormatterStyle('red'),
  11499. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  11500. );
  11501. }
  11502. public static function createOutput()
  11503. {
  11504. $styles = self::createAdditionalStyles();
  11505. $formatter = new OutputFormatter(null, $styles);
  11506. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  11507. }
  11508. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  11509. {
  11510. return RepositoryFactory::defaultRepos($io, $config, $rm);
  11511. }
  11512. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  11513. {
  11514. $cwd = $cwd ?: getcwd();
  11515. if (null === $localConfig) {
  11516. $localConfig = static::getComposerFile();
  11517. }
  11518. if (is_string($localConfig)) {
  11519. $composerFile = $localConfig;
  11520. $file = new JsonFile($localConfig, null, $io);
  11521. if (!$file->exists()) {
  11522. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  11523. $message = 'Composer could not find a composer.json file in '.$cwd;
  11524. } else {
  11525. $message = 'Composer could not find the config file: '.$localConfig;
  11526. }
  11527. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  11528. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  11529. }
  11530. $file->validateSchema(JsonFile::LAX_SCHEMA);
  11531. $jsonParser = new JsonParser;
  11532. try {
  11533. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  11534. } catch (DuplicateKeyException $e) {
  11535. $details = $e->getDetails();
  11536. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  11537. }
  11538. $localConfig = $file->read();
  11539. }
  11540. $config = static::createConfig($io, $cwd);
  11541. $config->merge($localConfig);
  11542. if (isset($composerFile)) {
  11543. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  11544. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  11545. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  11546. if ($localAuthFile->exists()) {
  11547. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  11548. $config->merge(array('config' => $localAuthFile->read()));
  11549. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  11550. }
  11551. }
  11552. $vendorDir = $config->get('vendor-dir');
  11553. $composer = new Composer();
  11554. $composer->setConfig($config);
  11555. if ($fullLoad) {
  11556. $io->loadConfiguration($config);
  11557. }
  11558. $rfs = self::createRemoteFilesystem($io, $config);
  11559. $dispatcher = new EventDispatcher($composer, $io);
  11560. $composer->setEventDispatcher($dispatcher);
  11561. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  11562. $composer->setRepositoryManager($rm);
  11563. $this->addLocalRepository($io, $rm, $vendorDir);
  11564. if (!$fullLoad && !isset($localConfig['version'])) {
  11565. $localConfig['version'] = '1.0.0';
  11566. }
  11567. $parser = new VersionParser;
  11568. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  11569. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  11570. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  11571. $composer->setPackage($package);
  11572. $im = $this->createInstallationManager();
  11573. $composer->setInstallationManager($im);
  11574. if ($fullLoad) {
  11575. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  11576. $composer->setDownloadManager($dm);
  11577. $generator = new AutoloadGenerator($dispatcher, $io);
  11578. $composer->setAutoloadGenerator($generator);
  11579. }
  11580. $this->createDefaultInstallers($im, $composer, $io);
  11581. if ($fullLoad) {
  11582. $globalComposer = null;
  11583. if (realpath($config->get('home')) !== $cwd) {
  11584. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  11585. }
  11586. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  11587. $composer->setPluginManager($pm);
  11588. $pm->loadInstalledPlugins();
  11589. }
  11590. if ($fullLoad && isset($composerFile)) {
  11591. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  11592. ? substr($composerFile, 0, -4).'lock'
  11593. : $composerFile . '.lock';
  11594. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  11595. $composer->setLocker($locker);
  11596. }
  11597. if ($fullLoad) {
  11598. $initEvent = new Event(PluginEvents::INIT);
  11599. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  11600. if ($rm->getLocalRepository()) {
  11601. $this->purgePackages($rm->getLocalRepository(), $im);
  11602. }
  11603. }
  11604. return $composer;
  11605. }
  11606. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  11607. {
  11608. $factory = new static();
  11609. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  11610. }
  11611. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  11612. {
  11613. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  11614. }
  11615. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  11616. {
  11617. $composer = null;
  11618. try {
  11619. $composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  11620. } catch (\Exception $e) {
  11621. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  11622. }
  11623. return $composer;
  11624. }
  11625. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  11626. {
  11627. $cache = null;
  11628. if ($config->get('cache-files-ttl') > 0) {
  11629. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  11630. }
  11631. $dm = new Downloader\DownloadManager($io);
  11632. switch ($preferred = $config->get('preferred-install')) {
  11633. case 'dist':
  11634. $dm->setPreferDist(true);
  11635. break;
  11636. case 'source':
  11637. $dm->setPreferSource(true);
  11638. break;
  11639. case 'auto':
  11640. default:
  11641. break;
  11642. }
  11643. if (is_array($preferred)) {
  11644. $dm->setPreferences($preferred);
  11645. }
  11646. $executor = new ProcessExecutor($io);
  11647. $fs = new Filesystem($executor);
  11648. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  11649. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  11650. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  11651. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  11652. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  11653. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11654. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11655. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11656. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11657. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11658. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11659. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11660. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11661. return $dm;
  11662. }
  11663. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  11664. {
  11665. if (null === $dm) {
  11666. $io = new IO\NullIO();
  11667. $io->loadConfiguration($config);
  11668. $dm = $this->createDownloadManager($io, $config);
  11669. }
  11670. $am = new Archiver\ArchiveManager($dm);
  11671. $am->addArchiver(new Archiver\ZipArchiver);
  11672. $am->addArchiver(new Archiver\PharArchiver);
  11673. return $am;
  11674. }
  11675. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  11676. {
  11677. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  11678. }
  11679. protected function createInstallationManager()
  11680. {
  11681. return new Installer\InstallationManager();
  11682. }
  11683. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  11684. {
  11685. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  11686. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  11687. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  11688. $im->addInstaller(new Installer\MetapackageInstaller($io));
  11689. }
  11690. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  11691. {
  11692. foreach ($repo->getPackages() as $package) {
  11693. if (!$im->isPackageInstalled($repo, $package)) {
  11694. $repo->removePackage($package);
  11695. }
  11696. }
  11697. }
  11698. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  11699. {
  11700. $factory = new static();
  11701. return $factory->createComposer($io, $config, $disablePlugins);
  11702. }
  11703. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  11704. {
  11705. static $warned = false;
  11706. $disableTls = false;
  11707. if ($config && $config->get('disable-tls') === true) {
  11708. if (!$warned) {
  11709. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  11710. }
  11711. $warned = true;
  11712. $disableTls = true;
  11713. } elseif (!extension_loaded('openssl')) {
  11714. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  11715. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  11716. }
  11717. $remoteFilesystemOptions = array();
  11718. if ($disableTls === false) {
  11719. if ($config && $config->get('cafile')) {
  11720. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  11721. }
  11722. if ($config && $config->get('capath')) {
  11723. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  11724. }
  11725. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  11726. }
  11727. try {
  11728. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  11729. } catch (TransportException $e) {
  11730. if (false !== strpos($e->getMessage(), 'cafile')) {
  11731. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  11732. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  11733. if (PHP_VERSION_ID < 50600) {
  11734. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  11735. }
  11736. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  11737. }
  11738. throw $e;
  11739. }
  11740. return $remoteFilesystem;
  11741. }
  11742. private static function useXdg()
  11743. {
  11744. foreach (array_keys($_SERVER) as $key) {
  11745. if (substr($key, 0, 4) === 'XDG_') {
  11746. return true;
  11747. }
  11748. }
  11749. return false;
  11750. }
  11751. private static function getUserDir()
  11752. {
  11753. $home = getenv('HOME');
  11754. if (!$home) {
  11755. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  11756. }
  11757. return rtrim(strtr($home, '\\', '/'), '/');
  11758. }
  11759. }
  11760. <?php
  11761. namespace Composer\IO;
  11762. use Composer\Config;
  11763. use Composer\Util\ProcessExecutor;
  11764. use Psr\Log\LoggerInterface;
  11765. use Psr\Log\LogLevel;
  11766. abstract class BaseIO implements IOInterface, LoggerInterface
  11767. {
  11768. protected $authentications = array();
  11769. public function getAuthentications()
  11770. {
  11771. return $this->authentications;
  11772. }
  11773. public function hasAuthentication($repositoryName)
  11774. {
  11775. return isset($this->authentications[$repositoryName]);
  11776. }
  11777. public function getAuthentication($repositoryName)
  11778. {
  11779. if (isset($this->authentications[$repositoryName])) {
  11780. return $this->authentications[$repositoryName];
  11781. }
  11782. return array('username' => null, 'password' => null);
  11783. }
  11784. public function setAuthentication($repositoryName, $username, $password = null)
  11785. {
  11786. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  11787. }
  11788. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  11789. {
  11790. if ($this->hasAuthentication($repositoryName)) {
  11791. $auth = $this->getAuthentication($repositoryName);
  11792. if ($auth['username'] === $username && $auth['password'] === $password) {
  11793. return;
  11794. }
  11795. $this->writeError(
  11796. sprintf(
  11797. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  11798. $repositoryName
  11799. )
  11800. );
  11801. }
  11802. $this->setAuthentication($repositoryName, $username, $password);
  11803. }
  11804. public function loadConfiguration(Config $config)
  11805. {
  11806. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  11807. $githubOauth = $config->get('github-oauth') ?: array();
  11808. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  11809. $gitlabToken = $config->get('gitlab-token') ?: array();
  11810. $httpBasic = $config->get('http-basic') ?: array();
  11811. foreach ($bitbucketOauth as $domain => $cred) {
  11812. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  11813. }
  11814. foreach ($githubOauth as $domain => $token) {
  11815. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  11816. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  11817. }
  11818. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  11819. }
  11820. foreach ($gitlabOauth as $domain => $token) {
  11821. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  11822. }
  11823. foreach ($gitlabToken as $domain => $token) {
  11824. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  11825. }
  11826. foreach ($httpBasic as $domain => $cred) {
  11827. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  11828. }
  11829. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  11830. }
  11831. public function emergency($message, array $context = array())
  11832. {
  11833. return $this->log(LogLevel::EMERGENCY, $message, $context);
  11834. }
  11835. public function alert($message, array $context = array())
  11836. {
  11837. return $this->log(LogLevel::ALERT, $message, $context);
  11838. }
  11839. public function critical($message, array $context = array())
  11840. {
  11841. return $this->log(LogLevel::CRITICAL, $message, $context);
  11842. }
  11843. public function error($message, array $context = array())
  11844. {
  11845. return $this->log(LogLevel::ERROR, $message, $context);
  11846. }
  11847. public function warning($message, array $context = array())
  11848. {
  11849. return $this->log(LogLevel::WARNING, $message, $context);
  11850. }
  11851. public function notice($message, array $context = array())
  11852. {
  11853. return $this->log(LogLevel::NOTICE, $message, $context);
  11854. }
  11855. public function info($message, array $context = array())
  11856. {
  11857. return $this->log(LogLevel::INFO, $message, $context);
  11858. }
  11859. public function debug($message, array $context = array())
  11860. {
  11861. return $this->log(LogLevel::DEBUG, $message, $context);
  11862. }
  11863. public function log($level, $message, array $context = array())
  11864. {
  11865. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  11866. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  11867. } elseif ($level === LogLevel::WARNING) {
  11868. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  11869. } elseif ($level === LogLevel::NOTICE) {
  11870. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  11871. } elseif ($level === LogLevel::INFO) {
  11872. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  11873. } else {
  11874. $this->writeError($message, true, self::DEBUG);
  11875. }
  11876. }
  11877. }
  11878. <?php
  11879. namespace Composer\IO;
  11880. use Symfony\Component\Console\Output\StreamOutput;
  11881. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  11882. use Symfony\Component\Console\Input\StringInput;
  11883. use Symfony\Component\Console\Helper\HelperSet;
  11884. class BufferIO extends ConsoleIO
  11885. {
  11886. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  11887. {
  11888. $input = new StringInput($input);
  11889. $input->setInteractive(false);
  11890. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  11891. parent::__construct($input, $output, new HelperSet(array()));
  11892. }
  11893. public function getOutput()
  11894. {
  11895. fseek($this->output->getStream(), 0);
  11896. $output = stream_get_contents($this->output->getStream());
  11897. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  11898. $pre = strip_tags($matches[1]);
  11899. if (strlen($pre) === strlen($matches[2])) {
  11900. return '';
  11901. }
  11902. return rtrim($matches[1])."\n";
  11903. }, $output);
  11904. return $output;
  11905. }
  11906. }
  11907. <?php
  11908. namespace Composer\IO;
  11909. use Symfony\Component\Console\Input\InputInterface;
  11910. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  11911. use Symfony\Component\Console\Output\OutputInterface;
  11912. use Symfony\Component\Console\Helper\HelperSet;
  11913. use Symfony\Component\Console\Question\ConfirmationQuestion;
  11914. use Symfony\Component\Console\Question\Question;
  11915. class ConsoleIO extends BaseIO
  11916. {
  11917. protected $input;
  11918. protected $output;
  11919. protected $helperSet;
  11920. protected $lastMessage;
  11921. protected $lastMessageErr;
  11922. private $startTime;
  11923. private $verbosityMap;
  11924. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  11925. {
  11926. $this->input = $input;
  11927. $this->output = $output;
  11928. $this->helperSet = $helperSet;
  11929. $this->verbosityMap = array(
  11930. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  11931. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  11932. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  11933. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  11934. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  11935. );
  11936. }
  11937. public function enableDebugging($startTime)
  11938. {
  11939. $this->startTime = $startTime;
  11940. }
  11941. public function isInteractive()
  11942. {
  11943. return $this->input->isInteractive();
  11944. }
  11945. public function isDecorated()
  11946. {
  11947. return $this->output->isDecorated();
  11948. }
  11949. public function isVerbose()
  11950. {
  11951. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  11952. }
  11953. public function isVeryVerbose()
  11954. {
  11955. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  11956. }
  11957. public function isDebug()
  11958. {
  11959. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  11960. }
  11961. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  11962. {
  11963. $this->doWrite($messages, $newline, false, $verbosity);
  11964. }
  11965. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  11966. {
  11967. $this->doWrite($messages, $newline, true, $verbosity);
  11968. }
  11969. private function doWrite($messages, $newline, $stderr, $verbosity)
  11970. {
  11971. $sfVerbosity = $this->verbosityMap[$verbosity];
  11972. if ($sfVerbosity > $this->output->getVerbosity()) {
  11973. return;
  11974. }
  11975. if (OutputInterface::VERBOSITY_QUIET === 0) {
  11976. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  11977. }
  11978. if (null !== $this->startTime) {
  11979. $memoryUsage = memory_get_usage() / 1024 / 1024;
  11980. $timeSpent = microtime(true) - $this->startTime;
  11981. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  11982. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  11983. }, (array) $messages);
  11984. }
  11985. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  11986. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  11987. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  11988. return;
  11989. }
  11990. $this->output->write($messages, $newline, $sfVerbosity);
  11991. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  11992. }
  11993. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  11994. {
  11995. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  11996. }
  11997. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  11998. {
  11999. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12000. }
  12001. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12002. {
  12003. $messages = implode($newline ? "\n" : '', (array) $messages);
  12004. if (!isset($size)) {
  12005. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12006. }
  12007. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12008. $this->doWrite($messages, false, $stderr, $verbosity);
  12009. $fill = $size - strlen(strip_tags($messages));
  12010. if ($fill > 0) {
  12011. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12012. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12013. }
  12014. if ($newline) {
  12015. $this->doWrite('', true, $stderr, $verbosity);
  12016. }
  12017. if ($stderr) {
  12018. $this->lastMessageErr = $messages;
  12019. } else {
  12020. $this->lastMessage = $messages;
  12021. }
  12022. }
  12023. public function ask($question, $default = null)
  12024. {
  12025. $helper = $this->helperSet->get('question');
  12026. $question = new Question($question, $default);
  12027. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12028. }
  12029. public function askConfirmation($question, $default = true)
  12030. {
  12031. $helper = $this->helperSet->get('question');
  12032. $question = new ConfirmationQuestion($question, $default);
  12033. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12034. }
  12035. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  12036. {
  12037. $helper = $this->helperSet->get('question');
  12038. $question = new Question($question, $default);
  12039. $question->setValidator($validator);
  12040. $question->setMaxAttempts($attempts);
  12041. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12042. }
  12043. public function askAndHideAnswer($question)
  12044. {
  12045. $this->writeError($question, false);
  12046. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  12047. }
  12048. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12049. {
  12050. if ($this->isInteractive()) {
  12051. return $this->helperSet->get('dialog')->select($this->getErrorOutput(), $question, $choices, $default, $attempts, $errorMessage, $multiselect);
  12052. }
  12053. return $default;
  12054. }
  12055. private function getErrorOutput()
  12056. {
  12057. if ($this->output instanceof ConsoleOutputInterface) {
  12058. return $this->output->getErrorOutput();
  12059. }
  12060. return $this->output;
  12061. }
  12062. }
  12063. <?php
  12064. namespace Composer\IO;
  12065. use Composer\Config;
  12066. interface IOInterface
  12067. {
  12068. const QUIET = 1;
  12069. const NORMAL = 2;
  12070. const VERBOSE = 4;
  12071. const VERY_VERBOSE = 8;
  12072. const DEBUG = 16;
  12073. public function isInteractive();
  12074. public function isVerbose();
  12075. public function isVeryVerbose();
  12076. public function isDebug();
  12077. public function isDecorated();
  12078. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  12079. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  12080. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12081. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12082. public function ask($question, $default = null);
  12083. public function askConfirmation($question, $default = true);
  12084. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  12085. public function askAndHideAnswer($question);
  12086. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  12087. public function getAuthentications();
  12088. public function hasAuthentication($repositoryName);
  12089. public function getAuthentication($repositoryName);
  12090. public function setAuthentication($repositoryName, $username, $password = null);
  12091. public function loadConfiguration(Config $config);
  12092. }
  12093. <?php
  12094. namespace Composer\IO;
  12095. class NullIO extends BaseIO
  12096. {
  12097. public function isInteractive()
  12098. {
  12099. return false;
  12100. }
  12101. public function isVerbose()
  12102. {
  12103. return false;
  12104. }
  12105. public function isVeryVerbose()
  12106. {
  12107. return false;
  12108. }
  12109. public function isDebug()
  12110. {
  12111. return false;
  12112. }
  12113. public function isDecorated()
  12114. {
  12115. return false;
  12116. }
  12117. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12118. {
  12119. }
  12120. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12121. {
  12122. }
  12123. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12124. {
  12125. }
  12126. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12127. {
  12128. }
  12129. public function ask($question, $default = null)
  12130. {
  12131. return $default;
  12132. }
  12133. public function askConfirmation($question, $default = true)
  12134. {
  12135. return $default;
  12136. }
  12137. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  12138. {
  12139. return $default;
  12140. }
  12141. public function askAndHideAnswer($question)
  12142. {
  12143. return null;
  12144. }
  12145. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12146. {
  12147. return $default;
  12148. }
  12149. }
  12150. <?php
  12151. namespace Composer;
  12152. use Composer\Autoload\AutoloadGenerator;
  12153. use Composer\DependencyResolver\DefaultPolicy;
  12154. use Composer\DependencyResolver\Operation\UpdateOperation;
  12155. use Composer\DependencyResolver\Operation\InstallOperation;
  12156. use Composer\DependencyResolver\Operation\UninstallOperation;
  12157. use Composer\DependencyResolver\Operation\OperationInterface;
  12158. use Composer\DependencyResolver\PolicyInterface;
  12159. use Composer\DependencyResolver\Pool;
  12160. use Composer\DependencyResolver\Request;
  12161. use Composer\DependencyResolver\Rule;
  12162. use Composer\DependencyResolver\Solver;
  12163. use Composer\DependencyResolver\SolverProblemsException;
  12164. use Composer\Downloader\DownloadManager;
  12165. use Composer\EventDispatcher\EventDispatcher;
  12166. use Composer\Installer\InstallationManager;
  12167. use Composer\Installer\InstallerEvents;
  12168. use Composer\Installer\NoopInstaller;
  12169. use Composer\Installer\SuggestedPackagesReporter;
  12170. use Composer\IO\IOInterface;
  12171. use Composer\Package\AliasPackage;
  12172. use Composer\Package\CompletePackage;
  12173. use Composer\Package\Link;
  12174. use Composer\Package\Loader\ArrayLoader;
  12175. use Composer\Package\Dumper\ArrayDumper;
  12176. use Composer\Semver\Constraint\Constraint;
  12177. use Composer\Package\Locker;
  12178. use Composer\Package\PackageInterface;
  12179. use Composer\Package\RootPackageInterface;
  12180. use Composer\Repository\CompositeRepository;
  12181. use Composer\Repository\InstalledArrayRepository;
  12182. use Composer\Repository\PlatformRepository;
  12183. use Composer\Repository\RepositoryInterface;
  12184. use Composer\Repository\RepositoryManager;
  12185. use Composer\Repository\WritableRepositoryInterface;
  12186. use Composer\Script\ScriptEvents;
  12187. class Installer
  12188. {
  12189. protected $io;
  12190. protected $config;
  12191. protected $package;
  12192. protected $downloadManager;
  12193. protected $repositoryManager;
  12194. protected $locker;
  12195. protected $installationManager;
  12196. protected $eventDispatcher;
  12197. protected $autoloadGenerator;
  12198. protected $preferSource = false;
  12199. protected $preferDist = false;
  12200. protected $optimizeAutoloader = false;
  12201. protected $classMapAuthoritative = false;
  12202. protected $apcuAutoloader = false;
  12203. protected $devMode = false;
  12204. protected $dryRun = false;
  12205. protected $verbose = false;
  12206. protected $update = false;
  12207. protected $dumpAutoloader = true;
  12208. protected $runScripts = true;
  12209. protected $ignorePlatformReqs = false;
  12210. protected $preferStable = false;
  12211. protected $preferLowest = false;
  12212. protected $skipSuggest = false;
  12213. protected $writeLock = true;
  12214. protected $executeOperations = true;
  12215. protected $updateWhitelist = null;
  12216. protected $whitelistDependencies = false;
  12217. protected $suggestedPackagesReporter;
  12218. protected $additionalInstalledRepository;
  12219. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  12220. {
  12221. $this->io = $io;
  12222. $this->config = $config;
  12223. $this->package = $package;
  12224. $this->downloadManager = $downloadManager;
  12225. $this->repositoryManager = $repositoryManager;
  12226. $this->locker = $locker;
  12227. $this->installationManager = $installationManager;
  12228. $this->eventDispatcher = $eventDispatcher;
  12229. $this->autoloadGenerator = $autoloadGenerator;
  12230. }
  12231. public function run()
  12232. {
  12233. gc_collect_cycles();
  12234. gc_disable();
  12235. if (!$this->update && !$this->locker->isLocked()) {
  12236. $this->update = true;
  12237. }
  12238. if ($this->dryRun) {
  12239. $this->verbose = true;
  12240. $this->runScripts = false;
  12241. $this->executeOperations = false;
  12242. $this->writeLock = false;
  12243. $this->dumpAutoloader = false;
  12244. $this->installationManager->addInstaller(new NoopInstaller);
  12245. $this->mockLocalRepositories($this->repositoryManager);
  12246. }
  12247. if ($this->runScripts) {
  12248. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  12249. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12250. }
  12251. $this->downloadManager->setPreferSource($this->preferSource);
  12252. $this->downloadManager->setPreferDist($this->preferDist);
  12253. $localRepo = $this->repositoryManager->getLocalRepository();
  12254. if ($this->update) {
  12255. $platformOverrides = $this->config->get('platform') ?: array();
  12256. } else {
  12257. $platformOverrides = $this->locker->getPlatformOverrides();
  12258. }
  12259. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  12260. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12261. $aliases = $this->getRootAliases();
  12262. $this->aliasPlatformPackages($platformRepo, $aliases);
  12263. if (!$this->suggestedPackagesReporter) {
  12264. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  12265. }
  12266. try {
  12267. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  12268. if ($res !== 0) {
  12269. return $res;
  12270. }
  12271. } catch (\Exception $e) {
  12272. if ($this->executeOperations) {
  12273. $this->installationManager->notifyInstalls($this->io);
  12274. }
  12275. throw $e;
  12276. }
  12277. if ($this->executeOperations) {
  12278. $this->installationManager->notifyInstalls($this->io);
  12279. }
  12280. if ($this->devMode && !$this->skipSuggest) {
  12281. $this->suggestedPackagesReporter->output($installedRepo);
  12282. }
  12283. foreach ($localRepo->getPackages() as $package) {
  12284. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  12285. continue;
  12286. }
  12287. $replacement = (is_string($package->getReplacementPackage()))
  12288. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  12289. : 'No replacement was suggested';
  12290. $this->io->writeError(
  12291. sprintf(
  12292. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  12293. $package->getPrettyName(),
  12294. $replacement
  12295. )
  12296. );
  12297. }
  12298. if ($this->update && $this->writeLock) {
  12299. $localRepo->reload();
  12300. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  12301. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  12302. $updatedLock = $this->locker->setLockData(
  12303. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  12304. $devPackages,
  12305. $platformReqs,
  12306. $platformDevReqs,
  12307. $aliases,
  12308. $this->package->getMinimumStability(),
  12309. $this->package->getStabilityFlags(),
  12310. $this->preferStable || $this->package->getPreferStable(),
  12311. $this->preferLowest,
  12312. $this->config->get('platform') ?: array()
  12313. );
  12314. if ($updatedLock) {
  12315. $this->io->writeError('<info>Writing lock file</info>');
  12316. }
  12317. }
  12318. if ($this->dumpAutoloader) {
  12319. if ($this->optimizeAutoloader) {
  12320. $this->io->writeError('<info>Generating optimized autoload files</info>');
  12321. } else {
  12322. $this->io->writeError('<info>Generating autoload files</info>');
  12323. }
  12324. $this->autoloadGenerator->setDevMode($this->devMode);
  12325. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  12326. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  12327. $this->autoloadGenerator->setRunScripts($this->runScripts);
  12328. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  12329. }
  12330. if ($this->runScripts) {
  12331. $devMode = (int) $this->devMode;
  12332. putenv("COMPOSER_DEV_MODE=$devMode");
  12333. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  12334. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12335. }
  12336. if ($this->executeOperations) {
  12337. foreach ($localRepo->getPackages() as $package) {
  12338. $this->installationManager->ensureBinariesPresence($package);
  12339. }
  12340. $vendorDir = $this->config->get('vendor-dir');
  12341. if (is_dir($vendorDir)) {
  12342. @touch($vendorDir);
  12343. }
  12344. }
  12345. if (!defined('HHVM_VERSION')) {
  12346. gc_enable();
  12347. }
  12348. return 0;
  12349. }
  12350. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  12351. {
  12352. $lockedRepository = null;
  12353. $repositories = null;
  12354. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  12355. try {
  12356. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  12357. } catch (\RuntimeException $e) {
  12358. if ($this->package->getDevRequires()) {
  12359. throw $e;
  12360. }
  12361. $lockedRepository = $this->locker->getLockedRepository();
  12362. }
  12363. }
  12364. $this->whitelistUpdateDependencies(
  12365. $localRepo,
  12366. $this->package->getRequires(),
  12367. $this->package->getDevRequires()
  12368. );
  12369. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  12370. $policy = $this->createPolicy();
  12371. $pool = $this->createPool($this->update ? null : $lockedRepository);
  12372. $pool->addRepository($installedRepo, $aliases);
  12373. if ($this->update) {
  12374. $repositories = $this->repositoryManager->getRepositories();
  12375. foreach ($repositories as $repository) {
  12376. $pool->addRepository($repository, $aliases);
  12377. }
  12378. }
  12379. if ($lockedRepository) {
  12380. $pool->addRepository($lockedRepository, $aliases);
  12381. }
  12382. $request = $this->createRequest($this->package, $platformRepo);
  12383. if ($this->update) {
  12384. $removedUnstablePackages = array();
  12385. foreach ($localRepo->getPackages() as $package) {
  12386. if (
  12387. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  12388. && $this->installationManager->isPackageInstalled($localRepo, $package)
  12389. ) {
  12390. $removedUnstablePackages[$package->getName()] = true;
  12391. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  12392. }
  12393. }
  12394. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  12395. $request->updateAll();
  12396. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  12397. foreach ($links as $link) {
  12398. $request->install($link->getTarget(), $link->getConstraint());
  12399. }
  12400. if ($this->updateWhitelist) {
  12401. $currentPackages = $this->getCurrentPackages($installedRepo);
  12402. $candidates = array();
  12403. foreach ($links as $link) {
  12404. $candidates[$link->getTarget()] = true;
  12405. $rootRequires[$link->getTarget()] = $link;
  12406. }
  12407. foreach ($currentPackages as $package) {
  12408. $candidates[$package->getName()] = true;
  12409. }
  12410. foreach ($candidates as $candidate => $dummy) {
  12411. foreach ($currentPackages as $curPackage) {
  12412. if ($curPackage->getName() === $candidate) {
  12413. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  12414. $constraint = new Constraint('=', $curPackage->getVersion());
  12415. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  12416. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  12417. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  12418. $request->install($curPackage->getName(), $constraint);
  12419. }
  12420. break;
  12421. }
  12422. }
  12423. }
  12424. }
  12425. } else {
  12426. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  12427. if (!$this->locker->isFresh()) {
  12428. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  12429. }
  12430. foreach ($lockedRepository->getPackages() as $package) {
  12431. $version = $package->getVersion();
  12432. if (isset($aliases[$package->getName()][$version])) {
  12433. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  12434. }
  12435. $constraint = new Constraint('=', $version);
  12436. $constraint->setPrettyString($package->getPrettyVersion());
  12437. $request->install($package->getName(), $constraint);
  12438. }
  12439. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  12440. $request->install($link->getTarget(), $link->getConstraint());
  12441. }
  12442. }
  12443. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  12444. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  12445. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  12446. try {
  12447. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  12448. } catch (SolverProblemsException $e) {
  12449. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  12450. $this->io->writeError($e->getMessage());
  12451. return array(max(1, $e->getCode()), array());
  12452. }
  12453. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  12454. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  12455. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  12456. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  12457. if (!$operations) {
  12458. $this->io->writeError('Nothing to install or update');
  12459. }
  12460. $operations = $this->movePluginsToFront($operations);
  12461. $operations = $this->moveUninstallsToFront($operations);
  12462. if ($this->update) {
  12463. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  12464. if (!$this->devMode) {
  12465. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  12466. }
  12467. } else {
  12468. $devPackages = null;
  12469. }
  12470. if ($operations) {
  12471. $installs = $updates = $uninstalls = array();
  12472. foreach ($operations as $operation) {
  12473. if ($operation instanceof InstallOperation) {
  12474. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  12475. } elseif ($operation instanceof UpdateOperation) {
  12476. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  12477. } elseif ($operation instanceof UninstallOperation) {
  12478. $uninstalls[] = $operation->getPackage()->getPrettyName();
  12479. }
  12480. }
  12481. $this->io->writeError(
  12482. sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  12483. count($installs),
  12484. 1 === count($installs) ? '' : 's',
  12485. count($updates),
  12486. 1 === count($updates) ? '' : 's',
  12487. count($uninstalls),
  12488. 1 === count($uninstalls) ? '' : 's')
  12489. );
  12490. if ($installs) {
  12491. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  12492. }
  12493. if ($updates) {
  12494. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  12495. }
  12496. if ($uninstalls) {
  12497. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  12498. }
  12499. }
  12500. foreach ($operations as $operation) {
  12501. if ('install' === $operation->getJobType()) {
  12502. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  12503. }
  12504. if ($this->update) {
  12505. $package = null;
  12506. if ('update' === $operation->getJobType()) {
  12507. $package = $operation->getTargetPackage();
  12508. } elseif ('install' === $operation->getJobType()) {
  12509. $package = $operation->getPackage();
  12510. }
  12511. if ($package && $package->isDev()) {
  12512. $references = $this->package->getReferences();
  12513. if (isset($references[$package->getName()])) {
  12514. $this->updateInstallReferences($package, $references[$package->getName()]);
  12515. }
  12516. }
  12517. if ('update' === $operation->getJobType()
  12518. && $operation->getTargetPackage()->isDev()
  12519. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  12520. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  12521. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  12522. ) {
  12523. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  12524. $this->io->writeError('', true, IOInterface::DEBUG);
  12525. continue;
  12526. }
  12527. }
  12528. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  12529. if (defined($event) && $this->runScripts) {
  12530. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  12531. }
  12532. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  12533. $this->io->writeError(' - ' . $operation);
  12534. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  12535. $this->io->writeError(' - ' . $operation);
  12536. }
  12537. $this->installationManager->execute($localRepo, $operation);
  12538. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  12539. $reason = $operation->getReason();
  12540. if ($reason instanceof Rule) {
  12541. switch ($reason->getReason()) {
  12542. case Rule::RULE_JOB_INSTALL:
  12543. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  12544. $this->io->writeError('');
  12545. break;
  12546. case Rule::RULE_PACKAGE_REQUIRES:
  12547. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  12548. $this->io->writeError('');
  12549. break;
  12550. }
  12551. }
  12552. }
  12553. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  12554. if (defined($event) && $this->runScripts) {
  12555. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  12556. }
  12557. if ($this->executeOperations) {
  12558. $localRepo->write();
  12559. }
  12560. }
  12561. if ($this->executeOperations) {
  12562. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  12563. $localRepo->write();
  12564. }
  12565. return array(0, $devPackages);
  12566. }
  12567. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  12568. {
  12569. if (!$this->package->getDevRequires()) {
  12570. return array();
  12571. }
  12572. $tempLocalRepo = clone $localRepo;
  12573. foreach ($operations as $operation) {
  12574. switch ($operation->getJobType()) {
  12575. case 'install':
  12576. case 'markAliasInstalled':
  12577. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  12578. $tempLocalRepo->addPackage(clone $operation->getPackage());
  12579. }
  12580. break;
  12581. case 'uninstall':
  12582. case 'markAliasUninstalled':
  12583. $tempLocalRepo->removePackage($operation->getPackage());
  12584. break;
  12585. case 'update':
  12586. $tempLocalRepo->removePackage($operation->getInitialPackage());
  12587. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  12588. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  12589. }
  12590. break;
  12591. default:
  12592. throw new \LogicException('Unknown type: '.$operation->getJobType());
  12593. }
  12594. }
  12595. $localRepo = new InstalledArrayRepository(array());
  12596. $loader = new ArrayLoader(null, true);
  12597. $dumper = new ArrayDumper();
  12598. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  12599. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  12600. }
  12601. unset($tempLocalRepo, $loader, $dumper);
  12602. $policy = $this->createPolicy();
  12603. $pool = $this->createPool();
  12604. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12605. $pool->addRepository($installedRepo, $aliases);
  12606. $request = $this->createRequest($this->package, $platformRepo);
  12607. $request->updateAll();
  12608. foreach ($this->package->getRequires() as $link) {
  12609. $request->install($link->getTarget(), $link->getConstraint());
  12610. }
  12611. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  12612. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  12613. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  12614. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  12615. $devPackages = array();
  12616. foreach ($ops as $op) {
  12617. if ($op->getJobType() === 'uninstall') {
  12618. $devPackages[] = $op->getPackage();
  12619. }
  12620. }
  12621. return $devPackages;
  12622. }
  12623. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  12624. {
  12625. $finalOps = array();
  12626. $packagesToSkip = array();
  12627. foreach ($devPackages as $pkg) {
  12628. $packagesToSkip[$pkg->getName()] = true;
  12629. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  12630. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  12631. }
  12632. }
  12633. foreach ($operations as $op) {
  12634. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  12635. if (isset($packagesToSkip[$package->getName()])) {
  12636. continue;
  12637. }
  12638. $finalOps[] = $op;
  12639. }
  12640. return $finalOps;
  12641. }
  12642. private function movePluginsToFront(array $operations)
  12643. {
  12644. $installerOps = array();
  12645. foreach ($operations as $idx => $op) {
  12646. if ($op instanceof InstallOperation) {
  12647. $package = $op->getPackage();
  12648. } elseif ($op instanceof UpdateOperation) {
  12649. $package = $op->getTargetPackage();
  12650. } else {
  12651. continue;
  12652. }
  12653. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  12654. $requires = array_keys($package->getRequires());
  12655. foreach ($requires as $index => $req) {
  12656. if ($req === 'composer-plugin-api' || preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  12657. unset($requires[$index]);
  12658. }
  12659. }
  12660. if (!count($requires)) {
  12661. $installerOps[] = $op;
  12662. unset($operations[$idx]);
  12663. }
  12664. }
  12665. }
  12666. return array_merge($installerOps, $operations);
  12667. }
  12668. private function moveUninstallsToFront(array $operations)
  12669. {
  12670. $uninstOps = array();
  12671. foreach ($operations as $idx => $op) {
  12672. if ($op instanceof UninstallOperation) {
  12673. $uninstOps[] = $op;
  12674. unset($operations[$idx]);
  12675. }
  12676. }
  12677. return array_merge($uninstOps, $operations);
  12678. }
  12679. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  12680. {
  12681. $installedRootPackage = clone $this->package;
  12682. $installedRootPackage->setRequires(array());
  12683. $installedRootPackage->setDevRequires(array());
  12684. $repos = array(
  12685. $localRepo,
  12686. new InstalledArrayRepository(array($installedRootPackage)),
  12687. $platformRepo,
  12688. );
  12689. $installedRepo = new CompositeRepository($repos);
  12690. if ($this->additionalInstalledRepository) {
  12691. $installedRepo->addRepository($this->additionalInstalledRepository);
  12692. }
  12693. return $installedRepo;
  12694. }
  12695. private function createPool(RepositoryInterface $lockedRepository = null)
  12696. {
  12697. if ($this->update) {
  12698. $minimumStability = $this->package->getMinimumStability();
  12699. $stabilityFlags = $this->package->getStabilityFlags();
  12700. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  12701. } else {
  12702. $minimumStability = $this->locker->getMinimumStability();
  12703. $stabilityFlags = $this->locker->getStabilityFlags();
  12704. $requires = array();
  12705. foreach ($lockedRepository->getPackages() as $package) {
  12706. $constraint = new Constraint('=', $package->getVersion());
  12707. $constraint->setPrettyString($package->getPrettyVersion());
  12708. $requires[$package->getName()] = $constraint;
  12709. }
  12710. }
  12711. $rootConstraints = array();
  12712. foreach ($requires as $req => $constraint) {
  12713. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  12714. continue;
  12715. }
  12716. if ($constraint instanceof Link) {
  12717. $rootConstraints[$req] = $constraint->getConstraint();
  12718. } else {
  12719. $rootConstraints[$req] = $constraint;
  12720. }
  12721. }
  12722. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  12723. }
  12724. private function createPolicy()
  12725. {
  12726. $preferStable = null;
  12727. $preferLowest = null;
  12728. if (!$this->update) {
  12729. $preferStable = $this->locker->getPreferStable();
  12730. $preferLowest = $this->locker->getPreferLowest();
  12731. }
  12732. if (null === $preferStable) {
  12733. $preferStable = $this->preferStable || $this->package->getPreferStable();
  12734. }
  12735. if (null === $preferLowest) {
  12736. $preferLowest = $this->preferLowest;
  12737. }
  12738. return new DefaultPolicy($preferStable, $preferLowest);
  12739. }
  12740. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  12741. {
  12742. $request = new Request();
  12743. $constraint = new Constraint('=', $rootPackage->getVersion());
  12744. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  12745. $request->install($rootPackage->getName(), $constraint);
  12746. $fixedPackages = $platformRepo->getPackages();
  12747. if ($this->additionalInstalledRepository) {
  12748. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  12749. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  12750. }
  12751. $provided = $rootPackage->getProvides();
  12752. foreach ($fixedPackages as $package) {
  12753. $constraint = new Constraint('=', $package->getVersion());
  12754. $constraint->setPrettyString($package->getPrettyVersion());
  12755. if ($package->getRepository() !== $platformRepo
  12756. || !isset($provided[$package->getName()])
  12757. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  12758. ) {
  12759. $request->fix($package->getName(), $constraint);
  12760. }
  12761. }
  12762. return $request;
  12763. }
  12764. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  12765. {
  12766. if ($task === 'force-updates' && null === $operations) {
  12767. throw new \InvalidArgumentException('Missing operations argument');
  12768. }
  12769. if ($task === 'force-links') {
  12770. $operations = array();
  12771. }
  12772. if ($this->update && $this->updateWhitelist) {
  12773. $currentPackages = $this->getCurrentPackages($installedRepo);
  12774. }
  12775. foreach ($localRepo->getCanonicalPackages() as $package) {
  12776. if (!$package->isDev()) {
  12777. continue;
  12778. }
  12779. foreach ($operations as $operation) {
  12780. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  12781. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  12782. ) {
  12783. continue 2;
  12784. }
  12785. }
  12786. if ($this->update) {
  12787. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  12788. foreach ($currentPackages as $curPackage) {
  12789. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  12790. if ($task === 'force-links') {
  12791. $package->setRequires($curPackage->getRequires());
  12792. $package->setConflicts($curPackage->getConflicts());
  12793. $package->setProvides($curPackage->getProvides());
  12794. $package->setReplaces($curPackage->getReplaces());
  12795. } elseif ($task === 'force-updates') {
  12796. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  12797. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  12798. ) {
  12799. $operations[] = new UpdateOperation($package, $curPackage);
  12800. }
  12801. }
  12802. break;
  12803. }
  12804. }
  12805. continue;
  12806. }
  12807. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  12808. foreach ($matches as $index => $match) {
  12809. if (!in_array($match->getRepository(), $repositories, true)) {
  12810. unset($matches[$index]);
  12811. continue;
  12812. }
  12813. if ($match->getName() !== $package->getName()) {
  12814. unset($matches[$index]);
  12815. continue;
  12816. }
  12817. $matches[$index] = $match->getId();
  12818. }
  12819. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  12820. $newPackage = $pool->literalToPackage($matches[0]);
  12821. if ($task === 'force-links' && $newPackage) {
  12822. $package->setRequires($newPackage->getRequires());
  12823. $package->setConflicts($newPackage->getConflicts());
  12824. $package->setProvides($newPackage->getProvides());
  12825. $package->setReplaces($newPackage->getReplaces());
  12826. }
  12827. if ($task === 'force-updates' && $newPackage && (
  12828. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  12829. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  12830. )
  12831. )) {
  12832. $operations[] = new UpdateOperation($package, $newPackage);
  12833. continue;
  12834. }
  12835. }
  12836. if ($task === 'force-updates') {
  12837. $references = $this->package->getReferences();
  12838. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  12839. $operations[] = new UpdateOperation($package, clone $package);
  12840. }
  12841. }
  12842. } else {
  12843. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  12844. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  12845. if ($task === 'force-links') {
  12846. $package->setRequires($lockedPackage->getRequires());
  12847. $package->setConflicts($lockedPackage->getConflicts());
  12848. $package->setProvides($lockedPackage->getProvides());
  12849. $package->setReplaces($lockedPackage->getReplaces());
  12850. } elseif ($task === 'force-updates') {
  12851. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  12852. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  12853. ) {
  12854. $operations[] = new UpdateOperation($package, $lockedPackage);
  12855. }
  12856. }
  12857. break;
  12858. }
  12859. }
  12860. }
  12861. }
  12862. return $operations;
  12863. }
  12864. private function getCurrentPackages($installedRepo)
  12865. {
  12866. if ($this->locker->isLocked()) {
  12867. try {
  12868. return $this->locker->getLockedRepository(true)->getPackages();
  12869. } catch (\RuntimeException $e) {
  12870. return $this->locker->getLockedRepository()->getPackages();
  12871. }
  12872. }
  12873. return $installedRepo->getPackages();
  12874. }
  12875. private function getRootAliases()
  12876. {
  12877. if ($this->update) {
  12878. $aliases = $this->package->getAliases();
  12879. } else {
  12880. $aliases = $this->locker->getAliases();
  12881. }
  12882. $normalizedAliases = array();
  12883. foreach ($aliases as $alias) {
  12884. $normalizedAliases[$alias['package']][$alias['version']] = array(
  12885. 'alias' => $alias['alias'],
  12886. 'alias_normalized' => $alias['alias_normalized'],
  12887. );
  12888. }
  12889. return $normalizedAliases;
  12890. }
  12891. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  12892. {
  12893. if (!$this->update) {
  12894. return;
  12895. }
  12896. $rootRefs = $this->package->getReferences();
  12897. foreach ($localRepo->getCanonicalPackages() as $package) {
  12898. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  12899. foreach ($matches as $index => $match) {
  12900. if (!in_array($match->getRepository(), $repositories, true)) {
  12901. unset($matches[$index]);
  12902. continue;
  12903. }
  12904. if ($match->getName() !== $package->getName()) {
  12905. unset($matches[$index]);
  12906. continue;
  12907. }
  12908. $matches[$index] = $match->getId();
  12909. }
  12910. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  12911. $newPackage = $pool->literalToPackage($matches[0]);
  12912. $sourceUrl = $package->getSourceUrl();
  12913. $newSourceUrl = $newPackage->getSourceUrl();
  12914. $newReference = $newPackage->getSourceReference();
  12915. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  12916. $newReference = $rootRefs[$package->getName()];
  12917. }
  12918. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  12919. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  12920. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  12921. }
  12922. $package->setDistMirrors($newPackage->getDistMirrors());
  12923. $package->setSourceMirrors($newPackage->getSourceMirrors());
  12924. }
  12925. }
  12926. }
  12927. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  12928. {
  12929. $oldSourceRef = $package->getSourceReference();
  12930. if ($package->getSourceUrl() !== $sourceUrl) {
  12931. $package->setSourceType($sourceType);
  12932. $package->setSourceUrl($sourceUrl);
  12933. $package->setSourceReference($sourceReference);
  12934. }
  12935. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $distUrl)) {
  12936. $package->setDistUrl($distUrl);
  12937. $this->updateInstallReferences($package, $sourceReference);
  12938. }
  12939. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  12940. $this->updateInstallReferences($package, $oldSourceRef);
  12941. }
  12942. }
  12943. private function updateInstallReferences(PackageInterface $package, $reference)
  12944. {
  12945. if (!$reference) {
  12946. return;
  12947. }
  12948. $package->setSourceReference($reference);
  12949. $package->setDistReference($reference);
  12950. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
  12951. $package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  12952. }
  12953. }
  12954. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  12955. {
  12956. foreach ($aliases as $package => $versions) {
  12957. foreach ($versions as $version => $alias) {
  12958. $packages = $platformRepo->findPackages($package, $version);
  12959. foreach ($packages as $package) {
  12960. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  12961. $aliasPackage->setRootPackageAlias(true);
  12962. $platformRepo->addPackage($aliasPackage);
  12963. }
  12964. }
  12965. }
  12966. }
  12967. private function isUpdateable(PackageInterface $package)
  12968. {
  12969. if (!$this->updateWhitelist) {
  12970. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  12971. }
  12972. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  12973. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  12974. if (preg_match($patternRegexp, $package->getName())) {
  12975. return true;
  12976. }
  12977. }
  12978. return false;
  12979. }
  12980. private function packageNameToRegexp($whiteListedPattern)
  12981. {
  12982. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  12983. return "{^" . $cleanedWhiteListedPattern . "$}i";
  12984. }
  12985. private function extractPlatformRequirements($links)
  12986. {
  12987. $platformReqs = array();
  12988. foreach ($links as $link) {
  12989. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  12990. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  12991. }
  12992. }
  12993. return $platformReqs;
  12994. }
  12995. private function whitelistUpdateDependencies($localRepo, array $rootRequires, array $rootDevRequires)
  12996. {
  12997. if (!$this->updateWhitelist) {
  12998. return;
  12999. }
  13000. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  13001. $requiredPackageNames = array();
  13002. foreach ($rootRequires as $require) {
  13003. $requiredPackageNames[] = $require->getTarget();
  13004. }
  13005. $skipPackages = array();
  13006. foreach ($rootRequires as $require) {
  13007. $skipPackages[$require->getTarget()] = true;
  13008. }
  13009. $pool = new Pool;
  13010. $pool->addRepository($localRepo);
  13011. $seen = array();
  13012. $rootRequiredPackageNames = array_keys($rootRequires);
  13013. foreach ($this->updateWhitelist as $packageName => $void) {
  13014. $packageQueue = new \SplQueue;
  13015. $depPackages = $pool->whatProvides($packageName);
  13016. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  13017. if (!$nameMatchesRequiredPackage) {
  13018. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  13019. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  13020. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  13021. $nameMatchesRequiredPackage = true;
  13022. break;
  13023. }
  13024. }
  13025. }
  13026. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock'))) {
  13027. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  13028. }
  13029. foreach ($depPackages as $depPackage) {
  13030. $packageQueue->enqueue($depPackage);
  13031. }
  13032. while (!$packageQueue->isEmpty()) {
  13033. $package = $packageQueue->dequeue();
  13034. if (isset($seen[$package->getId()])) {
  13035. continue;
  13036. }
  13037. $seen[$package->getId()] = true;
  13038. $this->updateWhitelist[$package->getName()] = true;
  13039. if (!$this->whitelistDependencies) {
  13040. continue;
  13041. }
  13042. $requires = $package->getRequires();
  13043. foreach ($requires as $require) {
  13044. $requirePackages = $pool->whatProvides($require->getTarget());
  13045. foreach ($requirePackages as $requirePackage) {
  13046. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  13047. continue;
  13048. }
  13049. if (isset($skipPackages[$requirePackage->getName()])) {
  13050. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  13051. continue;
  13052. }
  13053. $packageQueue->enqueue($requirePackage);
  13054. }
  13055. }
  13056. }
  13057. }
  13058. }
  13059. private function mockLocalRepositories(RepositoryManager $rm)
  13060. {
  13061. $packages = array();
  13062. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  13063. $packages[(string) $package] = clone $package;
  13064. }
  13065. foreach ($packages as $key => $package) {
  13066. if ($package instanceof AliasPackage) {
  13067. $alias = (string) $package->getAliasOf();
  13068. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  13069. }
  13070. }
  13071. $rm->setLocalRepository(
  13072. new InstalledArrayRepository($packages)
  13073. );
  13074. }
  13075. public static function create(IOInterface $io, Composer $composer)
  13076. {
  13077. return new static(
  13078. $io,
  13079. $composer->getConfig(),
  13080. $composer->getPackage(),
  13081. $composer->getDownloadManager(),
  13082. $composer->getRepositoryManager(),
  13083. $composer->getLocker(),
  13084. $composer->getInstallationManager(),
  13085. $composer->getEventDispatcher(),
  13086. $composer->getAutoloadGenerator()
  13087. );
  13088. }
  13089. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  13090. {
  13091. $this->additionalInstalledRepository = $additionalInstalledRepository;
  13092. return $this;
  13093. }
  13094. public function setDryRun($dryRun = true)
  13095. {
  13096. $this->dryRun = (boolean) $dryRun;
  13097. return $this;
  13098. }
  13099. public function isDryRun()
  13100. {
  13101. return $this->dryRun;
  13102. }
  13103. public function setPreferSource($preferSource = true)
  13104. {
  13105. $this->preferSource = (boolean) $preferSource;
  13106. return $this;
  13107. }
  13108. public function setPreferDist($preferDist = true)
  13109. {
  13110. $this->preferDist = (boolean) $preferDist;
  13111. return $this;
  13112. }
  13113. public function setOptimizeAutoloader($optimizeAutoloader = false)
  13114. {
  13115. $this->optimizeAutoloader = (boolean) $optimizeAutoloader;
  13116. if (!$this->optimizeAutoloader) {
  13117. $this->setClassMapAuthoritative(false);
  13118. }
  13119. return $this;
  13120. }
  13121. public function setClassMapAuthoritative($classMapAuthoritative = false)
  13122. {
  13123. $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
  13124. if ($this->classMapAuthoritative) {
  13125. $this->setOptimizeAutoloader(true);
  13126. }
  13127. return $this;
  13128. }
  13129. public function setApcuAutoloader($apcuAutoloader = false)
  13130. {
  13131. $this->apcuAutoloader = (boolean) $apcuAutoloader;
  13132. return $this;
  13133. }
  13134. public function setUpdate($update = true)
  13135. {
  13136. $this->update = (boolean) $update;
  13137. return $this;
  13138. }
  13139. public function setDevMode($devMode = true)
  13140. {
  13141. $this->devMode = (boolean) $devMode;
  13142. return $this;
  13143. }
  13144. public function setDumpAutoloader($dumpAutoloader = true)
  13145. {
  13146. $this->dumpAutoloader = (boolean) $dumpAutoloader;
  13147. return $this;
  13148. }
  13149. public function setRunScripts($runScripts = true)
  13150. {
  13151. $this->runScripts = (boolean) $runScripts;
  13152. return $this;
  13153. }
  13154. public function setConfig(Config $config)
  13155. {
  13156. $this->config = $config;
  13157. return $this;
  13158. }
  13159. public function setVerbose($verbose = true)
  13160. {
  13161. $this->verbose = (boolean) $verbose;
  13162. return $this;
  13163. }
  13164. public function isVerbose()
  13165. {
  13166. return $this->verbose;
  13167. }
  13168. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  13169. {
  13170. $this->ignorePlatformReqs = (boolean) $ignorePlatformReqs;
  13171. return $this;
  13172. }
  13173. public function setUpdateWhitelist(array $packages)
  13174. {
  13175. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  13176. return $this;
  13177. }
  13178. public function setWhitelistDependencies($updateDependencies = true)
  13179. {
  13180. $this->whitelistDependencies = (boolean) $updateDependencies;
  13181. return $this;
  13182. }
  13183. public function setPreferStable($preferStable = true)
  13184. {
  13185. $this->preferStable = (boolean) $preferStable;
  13186. return $this;
  13187. }
  13188. public function setPreferLowest($preferLowest = true)
  13189. {
  13190. $this->preferLowest = (boolean) $preferLowest;
  13191. return $this;
  13192. }
  13193. public function setWriteLock($writeLock = true)
  13194. {
  13195. $this->writeLock = (boolean) $writeLock;
  13196. return $this;
  13197. }
  13198. public function setExecuteOperations($executeOperations = true)
  13199. {
  13200. $this->executeOperations = (boolean) $executeOperations;
  13201. return $this;
  13202. }
  13203. public function setSkipSuggest($skipSuggest = true)
  13204. {
  13205. $this->skipSuggest = (boolean) $skipSuggest;
  13206. return $this;
  13207. }
  13208. public function disablePlugins()
  13209. {
  13210. $this->installationManager->disablePlugins();
  13211. return $this;
  13212. }
  13213. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  13214. {
  13215. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  13216. return $this;
  13217. }
  13218. }
  13219. <?php
  13220. namespace Composer\Installer;
  13221. use Composer\IO\IOInterface;
  13222. use Composer\Package\PackageInterface;
  13223. use Composer\Util\Filesystem;
  13224. use Composer\Util\Platform;
  13225. use Composer\Util\ProcessExecutor;
  13226. use Composer\Util\Silencer;
  13227. class BinaryInstaller
  13228. {
  13229. protected $binDir;
  13230. protected $binCompat;
  13231. protected $io;
  13232. protected $filesystem;
  13233. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  13234. {
  13235. $this->binDir = $binDir;
  13236. $this->binCompat = $binCompat;
  13237. $this->io = $io;
  13238. $this->filesystem = $filesystem ?: new Filesystem();
  13239. }
  13240. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  13241. {
  13242. $binaries = $this->getBinaries($package);
  13243. if (!$binaries) {
  13244. return;
  13245. }
  13246. foreach ($binaries as $bin) {
  13247. $binPath = $installPath.'/'.$bin;
  13248. if (!file_exists($binPath)) {
  13249. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  13250. continue;
  13251. }
  13252. $binPath = realpath($binPath);
  13253. $this->initializeBinDir();
  13254. $link = $this->binDir.'/'.basename($bin);
  13255. if (file_exists($link)) {
  13256. if (is_link($link)) {
  13257. Silencer::call('chmod', $link, 0777 & ~umask());
  13258. }
  13259. if ($warnOnOverwrite) {
  13260. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  13261. }
  13262. continue;
  13263. }
  13264. if ($this->binCompat === "auto") {
  13265. if (Platform::isWindows()) {
  13266. $this->installFullBinaries($binPath, $link, $bin, $package);
  13267. } else {
  13268. $this->installSymlinkBinaries($binPath, $link);
  13269. }
  13270. } elseif ($this->binCompat === "full") {
  13271. $this->installFullBinaries($binPath, $link, $bin, $package);
  13272. }
  13273. Silencer::call('chmod', $link, 0777 & ~umask());
  13274. }
  13275. }
  13276. public function removeBinaries(PackageInterface $package)
  13277. {
  13278. $this->initializeBinDir();
  13279. $binaries = $this->getBinaries($package);
  13280. if (!$binaries) {
  13281. return;
  13282. }
  13283. foreach ($binaries as $bin) {
  13284. $link = $this->binDir.'/'.basename($bin);
  13285. if (is_link($link) || file_exists($link)) {
  13286. $this->filesystem->unlink($link);
  13287. }
  13288. if (file_exists($link.'.bat')) {
  13289. $this->filesystem->unlink($link.'.bat');
  13290. }
  13291. }
  13292. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  13293. Silencer::call('rmdir', $this->binDir);
  13294. }
  13295. }
  13296. public static function determineBinaryCaller($bin)
  13297. {
  13298. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  13299. return 'call';
  13300. }
  13301. $handle = fopen($bin, 'r');
  13302. $line = fgets($handle);
  13303. fclose($handle);
  13304. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13305. return trim($match[1]);
  13306. }
  13307. return 'php';
  13308. }
  13309. protected function getBinaries(PackageInterface $package)
  13310. {
  13311. return $package->getBinaries();
  13312. }
  13313. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  13314. {
  13315. if ('.bat' !== substr($binPath, -4)) {
  13316. $this->installUnixyProxyBinaries($binPath, $link);
  13317. @chmod($link, 0777 & ~umask());
  13318. $link .= '.bat';
  13319. if (file_exists($link)) {
  13320. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  13321. }
  13322. }
  13323. if (!file_exists($link)) {
  13324. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  13325. }
  13326. }
  13327. protected function installSymlinkBinaries($binPath, $link)
  13328. {
  13329. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  13330. $this->installUnixyProxyBinaries($binPath, $link);
  13331. }
  13332. }
  13333. protected function installUnixyProxyBinaries($binPath, $link)
  13334. {
  13335. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  13336. }
  13337. protected function initializeBinDir()
  13338. {
  13339. $this->filesystem->ensureDirectoryExists($this->binDir);
  13340. $this->binDir = realpath($this->binDir);
  13341. }
  13342. protected function generateWindowsProxyCode($bin, $link)
  13343. {
  13344. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13345. $caller = self::determineBinaryCaller($bin);
  13346. return "@ECHO OFF\r\n".
  13347. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  13348. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  13349. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  13350. }
  13351. protected function generateUnixyProxyCode($bin, $link)
  13352. {
  13353. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13354. $binDir = ProcessExecutor::escape(dirname($binPath));
  13355. $binFile = basename($binPath);
  13356. $proxyCode = <<<PROXY
  13357. #!/usr/bin/env sh
  13358. dir=$(d=\${0%[/\\\\]*}; cd "\$d"; cd $binDir && pwd)
  13359. # See if we are running in Cygwin by checking for cygpath program
  13360. if command -v 'cygpath' >/dev/null 2>&1; then
  13361. # Cygwin paths start with /cygdrive/ which will break windows PHP,
  13362. # so we need to translate the dir path to windows format. However
  13363. # we could be using cygwin PHP which does not require this, so we
  13364. # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
  13365. if [[ $(which php) == /cygdrive/* ]]; then
  13366. dir=$(cygpath -m "\$dir");
  13367. fi
  13368. fi
  13369. dir=$(echo \$dir | sed 's/ /\ /g')
  13370. "\${dir}/$binFile" "$@"
  13371. PROXY;
  13372. return $proxyCode;
  13373. }
  13374. }
  13375. <?php
  13376. namespace Composer\Installer;
  13377. use Composer\Package\PackageInterface;
  13378. interface BinaryPresenceInterface
  13379. {
  13380. public function ensureBinariesPresence(PackageInterface $package);
  13381. }
  13382. <?php
  13383. namespace Composer\Installer;
  13384. use Composer\IO\IOInterface;
  13385. use Composer\Package\PackageInterface;
  13386. use Composer\Package\AliasPackage;
  13387. use Composer\Repository\RepositoryInterface;
  13388. use Composer\Repository\InstalledRepositoryInterface;
  13389. use Composer\DependencyResolver\Operation\OperationInterface;
  13390. use Composer\DependencyResolver\Operation\InstallOperation;
  13391. use Composer\DependencyResolver\Operation\UpdateOperation;
  13392. use Composer\DependencyResolver\Operation\UninstallOperation;
  13393. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  13394. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13395. use Composer\Util\StreamContextFactory;
  13396. class InstallationManager
  13397. {
  13398. private $installers = array();
  13399. private $cache = array();
  13400. private $notifiablePackages = array();
  13401. public function reset()
  13402. {
  13403. $this->notifiablePackages = array();
  13404. }
  13405. public function addInstaller(InstallerInterface $installer)
  13406. {
  13407. array_unshift($this->installers, $installer);
  13408. $this->cache = array();
  13409. }
  13410. public function removeInstaller(InstallerInterface $installer)
  13411. {
  13412. if (false !== ($key = array_search($installer, $this->installers, true))) {
  13413. array_splice($this->installers, $key, 1);
  13414. $this->cache = array();
  13415. }
  13416. }
  13417. public function disablePlugins()
  13418. {
  13419. foreach ($this->installers as $i => $installer) {
  13420. if (!$installer instanceof PluginInstaller) {
  13421. continue;
  13422. }
  13423. unset($this->installers[$i]);
  13424. }
  13425. }
  13426. public function getInstaller($type)
  13427. {
  13428. $type = strtolower($type);
  13429. if (isset($this->cache[$type])) {
  13430. return $this->cache[$type];
  13431. }
  13432. foreach ($this->installers as $installer) {
  13433. if ($installer->supports($type)) {
  13434. return $this->cache[$type] = $installer;
  13435. }
  13436. }
  13437. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  13438. }
  13439. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13440. {
  13441. if ($package instanceof AliasPackage) {
  13442. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  13443. }
  13444. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  13445. }
  13446. public function ensureBinariesPresence(PackageInterface $package)
  13447. {
  13448. try {
  13449. $installer = $this->getInstaller($package->getType());
  13450. } catch (\InvalidArgumentException $e) {
  13451. return;
  13452. }
  13453. if ($installer instanceof BinaryPresenceInterface) {
  13454. $installer->ensureBinariesPresence($package);
  13455. }
  13456. }
  13457. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  13458. {
  13459. $method = $operation->getJobType();
  13460. $this->$method($repo, $operation);
  13461. }
  13462. public function install(RepositoryInterface $repo, InstallOperation $operation)
  13463. {
  13464. $package = $operation->getPackage();
  13465. $installer = $this->getInstaller($package->getType());
  13466. $installer->install($repo, $package);
  13467. $this->markForNotification($package);
  13468. }
  13469. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  13470. {
  13471. $initial = $operation->getInitialPackage();
  13472. $target = $operation->getTargetPackage();
  13473. $initialType = $initial->getType();
  13474. $targetType = $target->getType();
  13475. if ($initialType === $targetType) {
  13476. $installer = $this->getInstaller($initialType);
  13477. $installer->update($repo, $initial, $target);
  13478. $this->markForNotification($target);
  13479. } else {
  13480. $this->getInstaller($initialType)->uninstall($repo, $initial);
  13481. $this->getInstaller($targetType)->install($repo, $target);
  13482. }
  13483. }
  13484. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  13485. {
  13486. $package = $operation->getPackage();
  13487. $installer = $this->getInstaller($package->getType());
  13488. $installer->uninstall($repo, $package);
  13489. }
  13490. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  13491. {
  13492. $package = $operation->getPackage();
  13493. if (!$repo->hasPackage($package)) {
  13494. $repo->addPackage(clone $package);
  13495. }
  13496. }
  13497. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  13498. {
  13499. $package = $operation->getPackage();
  13500. $repo->removePackage($package);
  13501. }
  13502. public function getInstallPath(PackageInterface $package)
  13503. {
  13504. $installer = $this->getInstaller($package->getType());
  13505. return $installer->getInstallPath($package);
  13506. }
  13507. public function notifyInstalls(IOInterface $io)
  13508. {
  13509. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  13510. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  13511. if ($io->hasAuthentication($repositoryName)) {
  13512. $auth = $io->getAuthentication($repositoryName);
  13513. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  13514. $authHeader = 'Authorization: Basic '.$authStr;
  13515. }
  13516. if (strpos($repoUrl, '%package%')) {
  13517. foreach ($packages as $package) {
  13518. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  13519. $params = array(
  13520. 'version' => $package->getPrettyVersion(),
  13521. 'version_normalized' => $package->getVersion(),
  13522. );
  13523. $opts = array('http' =>
  13524. array(
  13525. 'method' => 'POST',
  13526. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  13527. 'content' => http_build_query($params, '', '&'),
  13528. 'timeout' => 3,
  13529. ),
  13530. );
  13531. if (isset($authHeader)) {
  13532. $opts['http']['header'][] = $authHeader;
  13533. }
  13534. $context = StreamContextFactory::getContext($url, $opts);
  13535. @file_get_contents($url, false, $context);
  13536. }
  13537. continue;
  13538. }
  13539. $postData = array('downloads' => array());
  13540. foreach ($packages as $package) {
  13541. $postData['downloads'][] = array(
  13542. 'name' => $package->getPrettyName(),
  13543. 'version' => $package->getVersion(),
  13544. );
  13545. }
  13546. $opts = array('http' =>
  13547. array(
  13548. 'method' => 'POST',
  13549. 'header' => array('Content-Type: application/json'),
  13550. 'content' => json_encode($postData),
  13551. 'timeout' => 6,
  13552. ),
  13553. );
  13554. if (isset($authHeader)) {
  13555. $opts['http']['header'][] = $authHeader;
  13556. }
  13557. $context = StreamContextFactory::getContext($repoUrl, $opts);
  13558. @file_get_contents($repoUrl, false, $context);
  13559. }
  13560. $this->reset();
  13561. }
  13562. private function markForNotification(PackageInterface $package)
  13563. {
  13564. if ($package->getNotificationUrl()) {
  13565. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  13566. }
  13567. }
  13568. }
  13569. <?php
  13570. namespace Composer\Installer;
  13571. use Composer\Composer;
  13572. use Composer\DependencyResolver\PolicyInterface;
  13573. use Composer\DependencyResolver\Operation\OperationInterface;
  13574. use Composer\DependencyResolver\Pool;
  13575. use Composer\DependencyResolver\Request;
  13576. use Composer\EventDispatcher\Event;
  13577. use Composer\IO\IOInterface;
  13578. use Composer\Repository\CompositeRepository;
  13579. class InstallerEvent extends Event
  13580. {
  13581. private $composer;
  13582. private $io;
  13583. private $devMode;
  13584. private $policy;
  13585. private $pool;
  13586. private $installedRepo;
  13587. private $request;
  13588. private $operations;
  13589. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  13590. {
  13591. parent::__construct($eventName);
  13592. $this->composer = $composer;
  13593. $this->io = $io;
  13594. $this->devMode = $devMode;
  13595. $this->policy = $policy;
  13596. $this->pool = $pool;
  13597. $this->installedRepo = $installedRepo;
  13598. $this->request = $request;
  13599. $this->operations = $operations;
  13600. }
  13601. public function getComposer()
  13602. {
  13603. return $this->composer;
  13604. }
  13605. public function getIO()
  13606. {
  13607. return $this->io;
  13608. }
  13609. public function isDevMode()
  13610. {
  13611. return $this->devMode;
  13612. }
  13613. public function getPolicy()
  13614. {
  13615. return $this->policy;
  13616. }
  13617. public function getPool()
  13618. {
  13619. return $this->pool;
  13620. }
  13621. public function getInstalledRepo()
  13622. {
  13623. return $this->installedRepo;
  13624. }
  13625. public function getRequest()
  13626. {
  13627. return $this->request;
  13628. }
  13629. public function getOperations()
  13630. {
  13631. return $this->operations;
  13632. }
  13633. }
  13634. <?php
  13635. namespace Composer\Installer;
  13636. class InstallerEvents
  13637. {
  13638. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  13639. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  13640. }
  13641. <?php
  13642. namespace Composer\Installer;
  13643. use Composer\Package\PackageInterface;
  13644. use Composer\Repository\InstalledRepositoryInterface;
  13645. use InvalidArgumentException;
  13646. interface InstallerInterface
  13647. {
  13648. public function supports($packageType);
  13649. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  13650. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  13651. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  13652. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  13653. public function getInstallPath(PackageInterface $package);
  13654. }
  13655. <?php
  13656. namespace Composer\Installer;
  13657. use Composer\Composer;
  13658. use Composer\IO\IOInterface;
  13659. use Composer\Repository\InstalledRepositoryInterface;
  13660. use Composer\Package\PackageInterface;
  13661. use Composer\Util\Filesystem;
  13662. use Composer\Util\Silencer;
  13663. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  13664. {
  13665. protected $composer;
  13666. protected $vendorDir;
  13667. protected $binDir;
  13668. protected $downloadManager;
  13669. protected $io;
  13670. protected $type;
  13671. protected $filesystem;
  13672. protected $binCompat;
  13673. protected $binaryInstaller;
  13674. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  13675. {
  13676. $this->composer = $composer;
  13677. $this->downloadManager = $composer->getDownloadManager();
  13678. $this->io = $io;
  13679. $this->type = $type;
  13680. $this->filesystem = $filesystem ?: new Filesystem();
  13681. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  13682. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  13683. }
  13684. public function supports($packageType)
  13685. {
  13686. return $packageType === $this->type || null === $this->type;
  13687. }
  13688. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13689. {
  13690. return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
  13691. }
  13692. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13693. {
  13694. $this->initializeVendorDir();
  13695. $downloadPath = $this->getInstallPath($package);
  13696. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  13697. $this->binaryInstaller->removeBinaries($package);
  13698. }
  13699. $this->installCode($package);
  13700. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  13701. if (!$repo->hasPackage($package)) {
  13702. $repo->addPackage(clone $package);
  13703. }
  13704. }
  13705. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13706. {
  13707. if (!$repo->hasPackage($initial)) {
  13708. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13709. }
  13710. $this->initializeVendorDir();
  13711. $this->binaryInstaller->removeBinaries($initial);
  13712. $this->updateCode($initial, $target);
  13713. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  13714. $repo->removePackage($initial);
  13715. if (!$repo->hasPackage($target)) {
  13716. $repo->addPackage(clone $target);
  13717. }
  13718. }
  13719. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13720. {
  13721. if (!$repo->hasPackage($package)) {
  13722. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13723. }
  13724. $this->removeCode($package);
  13725. $this->binaryInstaller->removeBinaries($package);
  13726. $repo->removePackage($package);
  13727. $downloadPath = $this->getPackageBasePath($package);
  13728. if (strpos($package->getName(), '/')) {
  13729. $packageVendorDir = dirname($downloadPath);
  13730. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  13731. Silencer::call('rmdir', $packageVendorDir);
  13732. }
  13733. }
  13734. }
  13735. public function getInstallPath(PackageInterface $package)
  13736. {
  13737. $this->initializeVendorDir();
  13738. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  13739. $targetDir = $package->getTargetDir();
  13740. return $basePath . ($targetDir ? '/'.$targetDir : '');
  13741. }
  13742. public function ensureBinariesPresence(PackageInterface $package)
  13743. {
  13744. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  13745. }
  13746. protected function getPackageBasePath(PackageInterface $package)
  13747. {
  13748. $installPath = $this->getInstallPath($package);
  13749. $targetDir = $package->getTargetDir();
  13750. if ($targetDir) {
  13751. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  13752. }
  13753. return $installPath;
  13754. }
  13755. protected function installCode(PackageInterface $package)
  13756. {
  13757. $downloadPath = $this->getInstallPath($package);
  13758. $this->downloadManager->download($package, $downloadPath);
  13759. }
  13760. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  13761. {
  13762. $initialDownloadPath = $this->getInstallPath($initial);
  13763. $targetDownloadPath = $this->getInstallPath($target);
  13764. if ($targetDownloadPath !== $initialDownloadPath) {
  13765. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  13766. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  13767. ) {
  13768. $this->removeCode($initial);
  13769. $this->installCode($target);
  13770. return;
  13771. }
  13772. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  13773. }
  13774. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  13775. }
  13776. protected function removeCode(PackageInterface $package)
  13777. {
  13778. $downloadPath = $this->getPackageBasePath($package);
  13779. $this->downloadManager->remove($package, $downloadPath);
  13780. }
  13781. protected function initializeVendorDir()
  13782. {
  13783. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  13784. $this->vendorDir = realpath($this->vendorDir);
  13785. }
  13786. }
  13787. <?php
  13788. namespace Composer\Installer;
  13789. use Composer\Repository\InstalledRepositoryInterface;
  13790. use Composer\Package\PackageInterface;
  13791. class MetapackageInstaller implements InstallerInterface
  13792. {
  13793. public function supports($packageType)
  13794. {
  13795. return $packageType === 'metapackage';
  13796. }
  13797. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13798. {
  13799. return $repo->hasPackage($package);
  13800. }
  13801. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13802. {
  13803. $repo->addPackage(clone $package);
  13804. }
  13805. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13806. {
  13807. if (!$repo->hasPackage($initial)) {
  13808. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13809. }
  13810. $repo->removePackage($initial);
  13811. $repo->addPackage(clone $target);
  13812. }
  13813. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13814. {
  13815. if (!$repo->hasPackage($package)) {
  13816. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13817. }
  13818. $repo->removePackage($package);
  13819. }
  13820. public function getInstallPath(PackageInterface $package)
  13821. {
  13822. return '';
  13823. }
  13824. }
  13825. <?php
  13826. namespace Composer\Installer;
  13827. use Composer\Repository\InstalledRepositoryInterface;
  13828. use Composer\Package\PackageInterface;
  13829. class NoopInstaller implements InstallerInterface
  13830. {
  13831. public function supports($packageType)
  13832. {
  13833. return true;
  13834. }
  13835. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13836. {
  13837. return $repo->hasPackage($package);
  13838. }
  13839. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13840. {
  13841. if (!$repo->hasPackage($package)) {
  13842. $repo->addPackage(clone $package);
  13843. }
  13844. }
  13845. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13846. {
  13847. if (!$repo->hasPackage($initial)) {
  13848. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13849. }
  13850. $repo->removePackage($initial);
  13851. if (!$repo->hasPackage($target)) {
  13852. $repo->addPackage(clone $target);
  13853. }
  13854. }
  13855. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13856. {
  13857. if (!$repo->hasPackage($package)) {
  13858. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13859. }
  13860. $repo->removePackage($package);
  13861. }
  13862. public function getInstallPath(PackageInterface $package)
  13863. {
  13864. $targetDir = $package->getTargetDir();
  13865. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  13866. }
  13867. }
  13868. <?php
  13869. namespace Composer\Installer;
  13870. use Composer\Composer;
  13871. use Composer\IO\IOInterface;
  13872. use Composer\DependencyResolver\Operation\OperationInterface;
  13873. use Composer\DependencyResolver\PolicyInterface;
  13874. use Composer\DependencyResolver\Pool;
  13875. use Composer\DependencyResolver\Request;
  13876. use Composer\Repository\CompositeRepository;
  13877. class PackageEvent extends InstallerEvent
  13878. {
  13879. private $operation;
  13880. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  13881. {
  13882. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  13883. $this->operation = $operation;
  13884. }
  13885. public function getOperation()
  13886. {
  13887. return $this->operation;
  13888. }
  13889. }
  13890. <?php
  13891. namespace Composer\Installer;
  13892. class PackageEvents
  13893. {
  13894. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  13895. const POST_PACKAGE_INSTALL = 'post-package-install';
  13896. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  13897. const POST_PACKAGE_UPDATE = 'post-package-update';
  13898. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  13899. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  13900. }
  13901. <?php
  13902. namespace Composer\Installer;
  13903. use Composer\IO\IOInterface;
  13904. use Composer\Package\PackageInterface;
  13905. use Composer\Util\Filesystem;
  13906. use Composer\Util\ProcessExecutor;
  13907. class PearBinaryInstaller extends BinaryInstaller
  13908. {
  13909. private $installer;
  13910. private $vendorDir;
  13911. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  13912. {
  13913. parent::__construct($io, $binDir, $binCompat, $filesystem);
  13914. $this->installer = $installer;
  13915. $this->vendorDir = $vendorDir;
  13916. }
  13917. protected function getBinaries(PackageInterface $package)
  13918. {
  13919. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  13920. $binaries = array();
  13921. if (file_exists($binariesPath)) {
  13922. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  13923. if (!$value->isDir()) {
  13924. $binaries[] = 'bin/'.$fileName;
  13925. }
  13926. }
  13927. }
  13928. return $binaries;
  13929. }
  13930. protected function initializeBinDir()
  13931. {
  13932. parent::initializeBinDir();
  13933. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  13934. @chmod($this->binDir.'/composer-php', 0777);
  13935. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  13936. @chmod($this->binDir.'/composer-php.bat', 0777);
  13937. }
  13938. protected function generateWindowsProxyCode($bin, $link)
  13939. {
  13940. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13941. if ('.bat' === substr($bin, -4)) {
  13942. $caller = 'call';
  13943. } else {
  13944. $handle = fopen($bin, 'r');
  13945. $line = fgets($handle);
  13946. fclose($handle);
  13947. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13948. $caller = trim($match[1]);
  13949. } else {
  13950. $caller = 'php';
  13951. }
  13952. if ($caller === 'php') {
  13953. return "@echo off\r\n".
  13954. "pushd .\r\n".
  13955. "cd %~dp0\r\n".
  13956. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  13957. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  13958. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  13959. "popd\r\n".
  13960. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  13961. }
  13962. }
  13963. return "@echo off\r\n".
  13964. "pushd .\r\n".
  13965. "cd %~dp0\r\n".
  13966. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  13967. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  13968. "popd\r\n".
  13969. $caller." \"%BIN_TARGET%\" %*\r\n";
  13970. }
  13971. private function generateWindowsPhpProxyCode()
  13972. {
  13973. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  13974. return
  13975. "@echo off\r\n" .
  13976. "setlocal enabledelayedexpansion\r\n" .
  13977. "set BIN_DIR=%~dp0\r\n" .
  13978. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  13979. "set DIRS=.\r\n" .
  13980. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  13981. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  13982. " set DIRS=!DIRS!;%%~fP\r\n" .
  13983. " )\r\n" .
  13984. ")\r\n" .
  13985. "php.exe -d include_path=!DIRS! %*\r\n";
  13986. }
  13987. private function generateUnixyPhpProxyCode()
  13988. {
  13989. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  13990. return
  13991. "#!/usr/bin/env sh\n".
  13992. "SRC_DIR=`pwd`\n".
  13993. "BIN_DIR=`dirname $0`\n".
  13994. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  13995. "DIRS=\"\"\n".
  13996. "for vendor in \$VENDOR_DIR/*; do\n".
  13997. " if [ -d \"\$vendor\" ]; then\n".
  13998. " for package in \$vendor/*; do\n".
  13999. " if [ -d \"\$package\" ]; then\n".
  14000. " DIRS=\"\${DIRS}:\${package}\"\n".
  14001. " fi\n".
  14002. " done\n".
  14003. " fi\n".
  14004. "done\n".
  14005. "php -d include_path=\".\$DIRS\" $@\n";
  14006. }
  14007. }
  14008. <?php
  14009. namespace Composer\Installer;
  14010. use Composer\IO\IOInterface;
  14011. use Composer\Composer;
  14012. use Composer\Downloader\PearPackageExtractor;
  14013. use Composer\Repository\InstalledRepositoryInterface;
  14014. use Composer\Package\PackageInterface;
  14015. use Composer\Util\Platform;
  14016. use Composer\Util\Filesystem;
  14017. class PearInstaller extends LibraryInstaller
  14018. {
  14019. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  14020. {
  14021. $filesystem = new Filesystem();
  14022. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  14023. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  14024. }
  14025. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14026. {
  14027. $this->uninstall($repo, $initial);
  14028. $this->install($repo, $target);
  14029. }
  14030. protected function installCode(PackageInterface $package)
  14031. {
  14032. parent::installCode($package);
  14033. $isWindows = Platform::isWindows();
  14034. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  14035. if (!$isWindows) {
  14036. $php_bin = '/usr/bin/env ' . $php_bin;
  14037. }
  14038. $installPath = $this->getInstallPath($package);
  14039. $vars = array(
  14040. 'os' => $isWindows ? 'windows' : 'linux',
  14041. 'php_bin' => $php_bin,
  14042. 'pear_php' => $installPath,
  14043. 'php_dir' => $installPath,
  14044. 'bin_dir' => $installPath . '/bin',
  14045. 'data_dir' => $installPath . '/data',
  14046. 'version' => $package->getPrettyVersion(),
  14047. );
  14048. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  14049. $pearExtractor = new PearPackageExtractor($packageArchive);
  14050. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  14051. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  14052. $this->filesystem->unlink($packageArchive);
  14053. }
  14054. }
  14055. <?php
  14056. namespace Composer\Installer;
  14057. use Composer\Composer;
  14058. use Composer\IO\IOInterface;
  14059. use Composer\Repository\InstalledRepositoryInterface;
  14060. use Composer\Package\PackageInterface;
  14061. class PluginInstaller extends LibraryInstaller
  14062. {
  14063. private $installationManager;
  14064. public function __construct(IOInterface $io, Composer $composer, $type = 'library')
  14065. {
  14066. parent::__construct($io, $composer, 'composer-plugin');
  14067. $this->installationManager = $composer->getInstallationManager();
  14068. }
  14069. public function supports($packageType)
  14070. {
  14071. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  14072. }
  14073. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14074. {
  14075. $extra = $package->getExtra();
  14076. if (empty($extra['class'])) {
  14077. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14078. }
  14079. parent::install($repo, $package);
  14080. try {
  14081. $this->composer->getPluginManager()->registerPackage($package, true);
  14082. } catch (\Exception $e) {
  14083. $this->io->writeError('Plugin installation failed, rolling back');
  14084. parent::uninstall($repo, $package);
  14085. throw $e;
  14086. }
  14087. }
  14088. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14089. {
  14090. $extra = $target->getExtra();
  14091. if (empty($extra['class'])) {
  14092. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14093. }
  14094. parent::update($repo, $initial, $target);
  14095. $this->composer->getPluginManager()->registerPackage($target, true);
  14096. }
  14097. }
  14098. <?php
  14099. namespace Composer\Installer;
  14100. use Composer\Package\PackageInterface;
  14101. use Composer\Downloader\DownloadManager;
  14102. use Composer\Repository\InstalledRepositoryInterface;
  14103. use Composer\Util\Filesystem;
  14104. class ProjectInstaller implements InstallerInterface
  14105. {
  14106. private $installPath;
  14107. private $downloadManager;
  14108. private $filesystem;
  14109. public function __construct($installPath, DownloadManager $dm)
  14110. {
  14111. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  14112. $this->downloadManager = $dm;
  14113. $this->filesystem = new Filesystem;
  14114. }
  14115. public function supports($packageType)
  14116. {
  14117. return true;
  14118. }
  14119. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14120. {
  14121. return false;
  14122. }
  14123. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14124. {
  14125. $installPath = $this->installPath;
  14126. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  14127. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  14128. }
  14129. if (!is_dir($installPath)) {
  14130. mkdir($installPath, 0777, true);
  14131. }
  14132. $this->downloadManager->download($package, $installPath);
  14133. }
  14134. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14135. {
  14136. throw new \InvalidArgumentException("not supported");
  14137. }
  14138. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14139. {
  14140. throw new \InvalidArgumentException("not supported");
  14141. }
  14142. public function getInstallPath(PackageInterface $package)
  14143. {
  14144. return $this->installPath;
  14145. }
  14146. }
  14147. <?php
  14148. namespace Composer\Installer;
  14149. use Composer\IO\IOInterface;
  14150. use Composer\Package\PackageInterface;
  14151. use Composer\Repository\RepositoryInterface;
  14152. class SuggestedPackagesReporter
  14153. {
  14154. protected $suggestedPackages = array();
  14155. private $io;
  14156. public function __construct(IOInterface $io)
  14157. {
  14158. $this->io = $io;
  14159. }
  14160. public function getPackages()
  14161. {
  14162. return $this->suggestedPackages;
  14163. }
  14164. public function addPackage($source, $target, $reason)
  14165. {
  14166. $this->suggestedPackages[] = array(
  14167. 'source' => $source,
  14168. 'target' => $target,
  14169. 'reason' => $reason,
  14170. );
  14171. return $this;
  14172. }
  14173. public function addSuggestionsFromPackage(PackageInterface $package)
  14174. {
  14175. $source = $package->getPrettyName();
  14176. foreach ($package->getSuggests() as $target => $reason) {
  14177. $this->addPackage(
  14178. $source,
  14179. $target,
  14180. $reason
  14181. );
  14182. }
  14183. return $this;
  14184. }
  14185. public function output(RepositoryInterface $installedRepo = null)
  14186. {
  14187. $suggestedPackages = $this->getPackages();
  14188. $installedPackages = array();
  14189. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  14190. foreach ($installedRepo->getPackages() as $package) {
  14191. $installedPackages = array_merge(
  14192. $installedPackages,
  14193. $package->getNames()
  14194. );
  14195. }
  14196. }
  14197. foreach ($suggestedPackages as $suggestion) {
  14198. if (in_array($suggestion['target'], $installedPackages)) {
  14199. continue;
  14200. }
  14201. $this->io->writeError(sprintf(
  14202. '%s suggests installing %s (%s)',
  14203. $suggestion['source'],
  14204. $suggestion['target'],
  14205. $suggestion['reason']
  14206. ));
  14207. }
  14208. return $this;
  14209. }
  14210. }
  14211. <?php
  14212. namespace Composer\Json;
  14213. use JsonSchema\Validator;
  14214. use Seld\JsonLint\JsonParser;
  14215. use Seld\JsonLint\ParsingException;
  14216. use Composer\Util\RemoteFilesystem;
  14217. use Composer\IO\IOInterface;
  14218. use Composer\Downloader\TransportException;
  14219. class JsonFile
  14220. {
  14221. const LAX_SCHEMA = 1;
  14222. const STRICT_SCHEMA = 2;
  14223. const JSON_UNESCAPED_SLASHES = 64;
  14224. const JSON_PRETTY_PRINT = 128;
  14225. const JSON_UNESCAPED_UNICODE = 256;
  14226. private $path;
  14227. private $rfs;
  14228. private $io;
  14229. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  14230. {
  14231. $this->path = $path;
  14232. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  14233. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  14234. }
  14235. $this->rfs = $rfs;
  14236. $this->io = $io;
  14237. }
  14238. public function getPath()
  14239. {
  14240. return $this->path;
  14241. }
  14242. public function exists()
  14243. {
  14244. return is_file($this->path);
  14245. }
  14246. public function read()
  14247. {
  14248. try {
  14249. if ($this->rfs) {
  14250. $json = $this->rfs->getContents($this->path, $this->path, false);
  14251. } else {
  14252. if ($this->io && $this->io->isDebug()) {
  14253. $this->io->writeError('Reading ' . $this->path);
  14254. }
  14255. $json = file_get_contents($this->path);
  14256. }
  14257. } catch (TransportException $e) {
  14258. throw new \RuntimeException($e->getMessage(), 0, $e);
  14259. } catch (\Exception $e) {
  14260. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  14261. }
  14262. return static::parseJson($json, $this->path);
  14263. }
  14264. public function write(array $hash, $options = 448)
  14265. {
  14266. $dir = dirname($this->path);
  14267. if (!is_dir($dir)) {
  14268. if (file_exists($dir)) {
  14269. throw new \UnexpectedValueException(
  14270. $dir.' exists and is not a directory.'
  14271. );
  14272. }
  14273. if (!@mkdir($dir, 0777, true)) {
  14274. throw new \UnexpectedValueException(
  14275. $dir.' does not exist and could not be created.'
  14276. );
  14277. }
  14278. }
  14279. $retries = 3;
  14280. while ($retries--) {
  14281. try {
  14282. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  14283. break;
  14284. } catch (\Exception $e) {
  14285. if ($retries) {
  14286. usleep(500000);
  14287. continue;
  14288. }
  14289. throw $e;
  14290. }
  14291. }
  14292. }
  14293. public function validateSchema($schema = self::STRICT_SCHEMA)
  14294. {
  14295. $content = file_get_contents($this->path);
  14296. $data = json_decode($content);
  14297. if (null === $data && 'null' !== $content) {
  14298. self::validateSyntax($content, $this->path);
  14299. }
  14300. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  14301. $schemaData = json_decode(file_get_contents($schemaFile));
  14302. if ($schema === self::LAX_SCHEMA) {
  14303. $schemaData->additionalProperties = true;
  14304. $schemaData->required = array();
  14305. }
  14306. $validator = new Validator();
  14307. $validator->check($data, $schemaData);
  14308. if (!$validator->isValid()) {
  14309. $errors = array();
  14310. foreach ((array) $validator->getErrors() as $error) {
  14311. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  14312. }
  14313. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  14314. }
  14315. return true;
  14316. }
  14317. public static function encode($data, $options = 448)
  14318. {
  14319. if (PHP_VERSION_ID >= 50400) {
  14320. $json = json_encode($data, $options);
  14321. if (false === $json) {
  14322. self::throwEncodeError(json_last_error());
  14323. }
  14324. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  14325. $json = preg_replace('/\[\s+\]/', '[]', $json);
  14326. $json = preg_replace('/\{\s+\}/', '{}', $json);
  14327. }
  14328. return $json;
  14329. }
  14330. $json = json_encode($data);
  14331. if (false === $json) {
  14332. self::throwEncodeError(json_last_error());
  14333. }
  14334. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  14335. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  14336. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  14337. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  14338. return $json;
  14339. }
  14340. $result = JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  14341. return $result;
  14342. }
  14343. private static function throwEncodeError($code)
  14344. {
  14345. switch ($code) {
  14346. case JSON_ERROR_DEPTH:
  14347. $msg = 'Maximum stack depth exceeded';
  14348. break;
  14349. case JSON_ERROR_STATE_MISMATCH:
  14350. $msg = 'Underflow or the modes mismatch';
  14351. break;
  14352. case JSON_ERROR_CTRL_CHAR:
  14353. $msg = 'Unexpected control character found';
  14354. break;
  14355. case JSON_ERROR_UTF8:
  14356. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  14357. break;
  14358. default:
  14359. $msg = 'Unknown error';
  14360. }
  14361. throw new \RuntimeException('JSON encoding failed: '.$msg);
  14362. }
  14363. public static function parseJson($json, $file = null)
  14364. {
  14365. if (null === $json) {
  14366. return;
  14367. }
  14368. $data = json_decode($json, true);
  14369. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  14370. self::validateSyntax($json, $file);
  14371. }
  14372. return $data;
  14373. }
  14374. protected static function validateSyntax($json, $file = null)
  14375. {
  14376. $parser = new JsonParser();
  14377. $result = $parser->lint($json);
  14378. if (null === $result) {
  14379. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  14380. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  14381. }
  14382. return true;
  14383. }
  14384. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  14385. }
  14386. }
  14387. <?php
  14388. namespace Composer\Json;
  14389. class JsonFormatter
  14390. {
  14391. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  14392. {
  14393. $result = '';
  14394. $pos = 0;
  14395. $strLen = strlen($json);
  14396. $indentStr = ' ';
  14397. $newLine = "\n";
  14398. $outOfQuotes = true;
  14399. $buffer = '';
  14400. $noescape = true;
  14401. for ($i = 0; $i < $strLen; $i++) {
  14402. $char = substr($json, $i, 1);
  14403. if ('"' === $char && $noescape) {
  14404. $outOfQuotes = !$outOfQuotes;
  14405. }
  14406. if (!$outOfQuotes) {
  14407. $buffer .= $char;
  14408. $noescape = '\\' === $char ? !$noescape : true;
  14409. continue;
  14410. } elseif ('' !== $buffer) {
  14411. if ($unescapeSlashes) {
  14412. $buffer = str_replace('\\/', '/', $buffer);
  14413. }
  14414. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  14415. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  14416. $l = strlen($match[1]);
  14417. if ($l % 2) {
  14418. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  14419. pack('H*', $match[2]),
  14420. 'UTF-8',
  14421. 'UCS-2BE'
  14422. );
  14423. }
  14424. return $match[0];
  14425. }, $buffer);
  14426. }
  14427. $result .= $buffer.$char;
  14428. $buffer = '';
  14429. continue;
  14430. }
  14431. if (':' === $char) {
  14432. $char .= ' ';
  14433. } elseif (('}' === $char || ']' === $char)) {
  14434. $pos--;
  14435. $prevChar = substr($json, $i - 1, 1);
  14436. if ('{' !== $prevChar && '[' !== $prevChar) {
  14437. $result .= $newLine;
  14438. for ($j = 0; $j < $pos; $j++) {
  14439. $result .= $indentStr;
  14440. }
  14441. } else {
  14442. $result = rtrim($result);
  14443. }
  14444. }
  14445. $result .= $char;
  14446. if (',' === $char || '{' === $char || '[' === $char) {
  14447. $result .= $newLine;
  14448. if ('{' === $char || '[' === $char) {
  14449. $pos++;
  14450. }
  14451. for ($j = 0; $j < $pos; $j++) {
  14452. $result .= $indentStr;
  14453. }
  14454. }
  14455. }
  14456. return $result;
  14457. }
  14458. }
  14459. <?php
  14460. namespace Composer\Json;
  14461. use Composer\Repository\PlatformRepository;
  14462. class JsonManipulator
  14463. {
  14464. private static $DEFINES = '(?(DEFINE)
  14465. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  14466. (?<boolean> true | false | null )
  14467. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  14468. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  14469. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  14470. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  14471. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  14472. )';
  14473. private $contents;
  14474. private $newline;
  14475. private $indent;
  14476. public function __construct($contents)
  14477. {
  14478. $contents = trim($contents);
  14479. if ($contents === '') {
  14480. $contents = '{}';
  14481. }
  14482. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  14483. throw new \InvalidArgumentException('The json file must be an object ({})');
  14484. }
  14485. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  14486. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  14487. $this->detectIndenting();
  14488. }
  14489. public function getContents()
  14490. {
  14491. return $this->contents . $this->newline;
  14492. }
  14493. public function addLink($type, $package, $constraint, $sortPackages = false)
  14494. {
  14495. $decoded = JsonFile::parseJson($this->contents);
  14496. if (!isset($decoded[$type])) {
  14497. return $this->addMainKey($type, array($package => $constraint));
  14498. }
  14499. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  14500. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  14501. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  14502. return false;
  14503. }
  14504. $links = $matches['value'];
  14505. if (isset($decoded[$type][$package])) {
  14506. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  14507. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($package, $constraint) {
  14508. return JsonFile::encode($package) . $m['separator'] . '"' . $constraint . '"';
  14509. }, $links);
  14510. } else {
  14511. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  14512. $links = preg_replace(
  14513. '{'.preg_quote($match[1]).'$}',
  14514. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  14515. $links
  14516. );
  14517. } else {
  14518. $links = '{' . $this->newline .
  14519. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  14520. $this->indent . '}';
  14521. }
  14522. }
  14523. if (true === $sortPackages) {
  14524. $requirements = json_decode($links, true);
  14525. $this->sortPackages($requirements);
  14526. $links = $this->format($requirements);
  14527. }
  14528. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  14529. return true;
  14530. }
  14531. private function sortPackages(array &$packages = array())
  14532. {
  14533. $prefix = function ($requirement) {
  14534. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  14535. return preg_replace(
  14536. array(
  14537. '/^php/',
  14538. '/^hhvm/',
  14539. '/^ext/',
  14540. '/^lib/',
  14541. '/^\D/',
  14542. ),
  14543. array(
  14544. '0-$0',
  14545. '1-$0',
  14546. '2-$0',
  14547. '3-$0',
  14548. '4-$0',
  14549. ),
  14550. $requirement
  14551. );
  14552. }
  14553. return '5-'.$requirement;
  14554. };
  14555. uksort($packages, function ($a, $b) use ($prefix) {
  14556. return strnatcmp($prefix($a), $prefix($b));
  14557. });
  14558. }
  14559. public function addRepository($name, $config)
  14560. {
  14561. return $this->addSubNode('repositories', $name, $config);
  14562. }
  14563. public function removeRepository($name)
  14564. {
  14565. return $this->removeSubNode('repositories', $name);
  14566. }
  14567. public function addConfigSetting($name, $value)
  14568. {
  14569. return $this->addSubNode('config', $name, $value);
  14570. }
  14571. public function removeConfigSetting($name)
  14572. {
  14573. return $this->removeSubNode('config', $name);
  14574. }
  14575. public function addProperty($name, $value)
  14576. {
  14577. if (substr($name, 0, 6) === 'extra.') {
  14578. return $this->addSubNode('extra', substr($name, 6), $value);
  14579. }
  14580. return $this->addMainKey($name, $value);
  14581. }
  14582. public function removeProperty($name)
  14583. {
  14584. if (substr($name, 0, 6) === 'extra.') {
  14585. return $this->removeSubNode('extra', substr($name, 6));
  14586. }
  14587. return $this->removeMainKey($name);
  14588. }
  14589. public function addSubNode($mainNode, $name, $value)
  14590. {
  14591. $decoded = JsonFile::parseJson($this->contents);
  14592. $subName = null;
  14593. if (in_array($mainNode, array('config', 'repositories', 'extra')) && false !== strpos($name, '.')) {
  14594. list($name, $subName) = explode('.', $name, 2);
  14595. }
  14596. if (!isset($decoded[$mainNode])) {
  14597. if ($subName !== null) {
  14598. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  14599. } else {
  14600. $this->addMainKey($mainNode, array($name => $value));
  14601. }
  14602. return true;
  14603. }
  14604. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  14605. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  14606. try {
  14607. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  14608. return false;
  14609. }
  14610. } catch (\RuntimeException $e) {
  14611. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  14612. return false;
  14613. }
  14614. throw $e;
  14615. }
  14616. $children = $match['content'];
  14617. if (!@json_decode($children)) {
  14618. return false;
  14619. }
  14620. $that = $this;
  14621. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  14622. if ($this->pregMatch($childRegex, $children, $matches)) {
  14623. $children = preg_replace_callback($childRegex, function ($matches) use ($name, $subName, $value, $that) {
  14624. if ($subName !== null) {
  14625. $curVal = json_decode($matches['content'], true);
  14626. if (!is_array($curVal)) {
  14627. $curVal = array();
  14628. }
  14629. $curVal[$subName] = $value;
  14630. $value = $curVal;
  14631. }
  14632. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  14633. }, $children);
  14634. } else {
  14635. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  14636. $whitespace = '';
  14637. if (!empty($match['trailingspace'])) {
  14638. $whitespace = $match['trailingspace'];
  14639. }
  14640. if (!empty($match['content'])) {
  14641. if ($subName !== null) {
  14642. $value = array($subName => $value);
  14643. }
  14644. $children = preg_replace(
  14645. '#'.$whitespace.'}$#',
  14646. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  14647. $children
  14648. );
  14649. } else {
  14650. if ($subName !== null) {
  14651. $value = array($subName => $value);
  14652. }
  14653. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  14654. }
  14655. }
  14656. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  14657. return $m['start'] . $children . $m['end'];
  14658. }, $this->contents);
  14659. return true;
  14660. }
  14661. public function removeSubNode($mainNode, $name)
  14662. {
  14663. $decoded = JsonFile::parseJson($this->contents);
  14664. if (empty($decoded[$mainNode])) {
  14665. return true;
  14666. }
  14667. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  14668. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  14669. try {
  14670. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  14671. return false;
  14672. }
  14673. } catch (\RuntimeException $e) {
  14674. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  14675. return false;
  14676. }
  14677. throw $e;
  14678. }
  14679. $children = $match['content'];
  14680. if (!@json_decode($children, true)) {
  14681. return false;
  14682. }
  14683. $subName = null;
  14684. if (in_array($mainNode, array('config', 'repositories', 'extra')) && false !== strpos($name, '.')) {
  14685. list($name, $subName) = explode('.', $name, 2);
  14686. }
  14687. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  14688. return true;
  14689. }
  14690. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  14691. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  14692. $bestMatch = '';
  14693. foreach ($matches[0] as $match) {
  14694. if (strlen($bestMatch) < strlen($match)) {
  14695. $bestMatch = $match;
  14696. }
  14697. }
  14698. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  14699. if (1 !== $count) {
  14700. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  14701. if (1 !== $count) {
  14702. return false;
  14703. }
  14704. }
  14705. }
  14706. } else {
  14707. $childrenClean = $children;
  14708. }
  14709. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  14710. if (empty($match['content'])) {
  14711. $newline = $this->newline;
  14712. $indent = $this->indent;
  14713. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  14714. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  14715. }, $this->contents);
  14716. if ($subName !== null) {
  14717. $curVal = json_decode($children, true);
  14718. unset($curVal[$name][$subName]);
  14719. $this->addSubNode($mainNode, $name, $curVal[$name]);
  14720. }
  14721. return true;
  14722. }
  14723. $that = $this;
  14724. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  14725. if ($subName !== null) {
  14726. $curVal = json_decode($matches['content'], true);
  14727. unset($curVal[$name][$subName]);
  14728. $childrenClean = $that->format($curVal, 0);
  14729. }
  14730. return $matches['start'] . $childrenClean . $matches['end'];
  14731. }, $this->contents);
  14732. return true;
  14733. }
  14734. public function addMainKey($key, $content)
  14735. {
  14736. $decoded = JsonFile::parseJson($this->contents);
  14737. $content = $this->format($content);
  14738. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  14739. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  14740. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  14741. if (!@json_decode('{'.$matches['key'].'}')) {
  14742. return false;
  14743. }
  14744. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  14745. return true;
  14746. }
  14747. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  14748. $this->contents = preg_replace(
  14749. '#'.$match[1].'\}$#',
  14750. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  14751. $this->contents
  14752. );
  14753. return true;
  14754. }
  14755. $this->contents = preg_replace(
  14756. '#\}$#',
  14757. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  14758. $this->contents
  14759. );
  14760. return true;
  14761. }
  14762. public function removeMainKey($key)
  14763. {
  14764. $decoded = JsonFile::parseJson($this->contents);
  14765. if (!isset($decoded[$key])) {
  14766. return true;
  14767. }
  14768. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  14769. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  14770. if ($this->pregMatch($regex, $this->contents, $matches)) {
  14771. if (!@json_decode('{'.$matches['removal'].'}')) {
  14772. return false;
  14773. }
  14774. $this->contents = $matches['start'] . $matches['end'];
  14775. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  14776. $this->contents = "{\n}";
  14777. }
  14778. return true;
  14779. }
  14780. return false;
  14781. }
  14782. public function format($data, $depth = 0)
  14783. {
  14784. if (is_array($data)) {
  14785. reset($data);
  14786. if (is_numeric(key($data))) {
  14787. foreach ($data as $key => $val) {
  14788. $data[$key] = $this->format($val, $depth + 1);
  14789. }
  14790. return '['.implode(', ', $data).']';
  14791. }
  14792. $out = '{' . $this->newline;
  14793. $elems = array();
  14794. foreach ($data as $key => $val) {
  14795. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  14796. }
  14797. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  14798. }
  14799. return JsonFile::encode($data);
  14800. }
  14801. protected function detectIndenting()
  14802. {
  14803. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  14804. $this->indent = $match[1];
  14805. } else {
  14806. $this->indent = ' ';
  14807. }
  14808. }
  14809. protected function pregMatch($re, $str, &$matches = array())
  14810. {
  14811. $count = preg_match($re, $str, $matches);
  14812. if ($count === false) {
  14813. switch (preg_last_error()) {
  14814. case PREG_NO_ERROR:
  14815. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  14816. case PREG_INTERNAL_ERROR:
  14817. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  14818. case PREG_BACKTRACK_LIMIT_ERROR:
  14819. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  14820. case PREG_RECURSION_LIMIT_ERROR:
  14821. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  14822. case PREG_BAD_UTF8_ERROR:
  14823. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  14824. case PREG_BAD_UTF8_OFFSET_ERROR:
  14825. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  14826. case 6:
  14827. if (PHP_VERSION_ID > 70000) {
  14828. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  14829. }
  14830. default:
  14831. throw new \RuntimeException('Failed to execute regex: Unknown error');
  14832. }
  14833. }
  14834. return $count;
  14835. }
  14836. }
  14837. <?php
  14838. namespace Composer\Json;
  14839. use Exception;
  14840. class JsonValidationException extends Exception
  14841. {
  14842. protected $errors;
  14843. public function __construct($message, $errors = array(), Exception $previous = null)
  14844. {
  14845. $this->errors = $errors;
  14846. parent::__construct($message, 0, $previous);
  14847. }
  14848. public function getErrors()
  14849. {
  14850. return $this->errors;
  14851. }
  14852. }
  14853. <?php
  14854. namespace Composer\Package;
  14855. use Composer\Semver\Constraint\Constraint;
  14856. use Composer\Package\Version\VersionParser;
  14857. class AliasPackage extends BasePackage implements CompletePackageInterface
  14858. {
  14859. protected $version;
  14860. protected $prettyVersion;
  14861. protected $dev;
  14862. protected $rootPackageAlias = false;
  14863. protected $stability;
  14864. protected $aliasOf;
  14865. protected $requires;
  14866. protected $devRequires;
  14867. protected $conflicts;
  14868. protected $provides;
  14869. protected $replaces;
  14870. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  14871. {
  14872. parent::__construct($aliasOf->getName());
  14873. $this->version = $version;
  14874. $this->prettyVersion = $prettyVersion;
  14875. $this->aliasOf = $aliasOf;
  14876. $this->stability = VersionParser::parseStability($version);
  14877. $this->dev = $this->stability === 'dev';
  14878. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  14879. $links = $aliasOf->{'get' . ucfirst($type)}();
  14880. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  14881. }
  14882. }
  14883. public function getAliasOf()
  14884. {
  14885. return $this->aliasOf;
  14886. }
  14887. public function getVersion()
  14888. {
  14889. return $this->version;
  14890. }
  14891. public function getStability()
  14892. {
  14893. return $this->stability;
  14894. }
  14895. public function getPrettyVersion()
  14896. {
  14897. return $this->prettyVersion;
  14898. }
  14899. public function isDev()
  14900. {
  14901. return $this->dev;
  14902. }
  14903. public function getRequires()
  14904. {
  14905. return $this->requires;
  14906. }
  14907. public function getConflicts()
  14908. {
  14909. return $this->conflicts;
  14910. }
  14911. public function getProvides()
  14912. {
  14913. return $this->provides;
  14914. }
  14915. public function getReplaces()
  14916. {
  14917. return $this->replaces;
  14918. }
  14919. public function getDevRequires()
  14920. {
  14921. return $this->devRequires;
  14922. }
  14923. public function setRootPackageAlias($value)
  14924. {
  14925. return $this->rootPackageAlias = $value;
  14926. }
  14927. public function isRootPackageAlias()
  14928. {
  14929. return $this->rootPackageAlias;
  14930. }
  14931. protected function replaceSelfVersionDependencies(array $links, $linkType)
  14932. {
  14933. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  14934. $newLinks = array();
  14935. foreach ($links as $link) {
  14936. if ('self.version' === $link->getPrettyConstraint()) {
  14937. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  14938. }
  14939. }
  14940. $links = array_merge($links, $newLinks);
  14941. } else {
  14942. foreach ($links as $index => $link) {
  14943. if ('self.version' === $link->getPrettyConstraint()) {
  14944. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  14945. }
  14946. }
  14947. }
  14948. return $links;
  14949. }
  14950. public function getType()
  14951. {
  14952. return $this->aliasOf->getType();
  14953. }
  14954. public function getTargetDir()
  14955. {
  14956. return $this->aliasOf->getTargetDir();
  14957. }
  14958. public function getExtra()
  14959. {
  14960. return $this->aliasOf->getExtra();
  14961. }
  14962. public function setInstallationSource($type)
  14963. {
  14964. $this->aliasOf->setInstallationSource($type);
  14965. }
  14966. public function getInstallationSource()
  14967. {
  14968. return $this->aliasOf->getInstallationSource();
  14969. }
  14970. public function getSourceType()
  14971. {
  14972. return $this->aliasOf->getSourceType();
  14973. }
  14974. public function getSourceUrl()
  14975. {
  14976. return $this->aliasOf->getSourceUrl();
  14977. }
  14978. public function getSourceUrls()
  14979. {
  14980. return $this->aliasOf->getSourceUrls();
  14981. }
  14982. public function getSourceReference()
  14983. {
  14984. return $this->aliasOf->getSourceReference();
  14985. }
  14986. public function setSourceReference($reference)
  14987. {
  14988. return $this->aliasOf->setSourceReference($reference);
  14989. }
  14990. public function setSourceMirrors($mirrors)
  14991. {
  14992. return $this->aliasOf->setSourceMirrors($mirrors);
  14993. }
  14994. public function getSourceMirrors()
  14995. {
  14996. return $this->aliasOf->getSourceMirrors();
  14997. }
  14998. public function getDistType()
  14999. {
  15000. return $this->aliasOf->getDistType();
  15001. }
  15002. public function getDistUrl()
  15003. {
  15004. return $this->aliasOf->getDistUrl();
  15005. }
  15006. public function getDistUrls()
  15007. {
  15008. return $this->aliasOf->getDistUrls();
  15009. }
  15010. public function getDistReference()
  15011. {
  15012. return $this->aliasOf->getDistReference();
  15013. }
  15014. public function setDistReference($reference)
  15015. {
  15016. return $this->aliasOf->setDistReference($reference);
  15017. }
  15018. public function getDistSha1Checksum()
  15019. {
  15020. return $this->aliasOf->getDistSha1Checksum();
  15021. }
  15022. public function setTransportOptions(array $options)
  15023. {
  15024. return $this->aliasOf->setTransportOptions($options);
  15025. }
  15026. public function getTransportOptions()
  15027. {
  15028. return $this->aliasOf->getTransportOptions();
  15029. }
  15030. public function setDistMirrors($mirrors)
  15031. {
  15032. return $this->aliasOf->setDistMirrors($mirrors);
  15033. }
  15034. public function getDistMirrors()
  15035. {
  15036. return $this->aliasOf->getDistMirrors();
  15037. }
  15038. public function getScripts()
  15039. {
  15040. return $this->aliasOf->getScripts();
  15041. }
  15042. public function getLicense()
  15043. {
  15044. return $this->aliasOf->getLicense();
  15045. }
  15046. public function getAutoload()
  15047. {
  15048. return $this->aliasOf->getAutoload();
  15049. }
  15050. public function getDevAutoload()
  15051. {
  15052. return $this->aliasOf->getDevAutoload();
  15053. }
  15054. public function getIncludePaths()
  15055. {
  15056. return $this->aliasOf->getIncludePaths();
  15057. }
  15058. public function getRepositories()
  15059. {
  15060. return $this->aliasOf->getRepositories();
  15061. }
  15062. public function getReleaseDate()
  15063. {
  15064. return $this->aliasOf->getReleaseDate();
  15065. }
  15066. public function getBinaries()
  15067. {
  15068. return $this->aliasOf->getBinaries();
  15069. }
  15070. public function getKeywords()
  15071. {
  15072. return $this->aliasOf->getKeywords();
  15073. }
  15074. public function getDescription()
  15075. {
  15076. return $this->aliasOf->getDescription();
  15077. }
  15078. public function getHomepage()
  15079. {
  15080. return $this->aliasOf->getHomepage();
  15081. }
  15082. public function getSuggests()
  15083. {
  15084. return $this->aliasOf->getSuggests();
  15085. }
  15086. public function getAuthors()
  15087. {
  15088. return $this->aliasOf->getAuthors();
  15089. }
  15090. public function getSupport()
  15091. {
  15092. return $this->aliasOf->getSupport();
  15093. }
  15094. public function getNotificationUrl()
  15095. {
  15096. return $this->aliasOf->getNotificationUrl();
  15097. }
  15098. public function getArchiveExcludes()
  15099. {
  15100. return $this->aliasOf->getArchiveExcludes();
  15101. }
  15102. public function isAbandoned()
  15103. {
  15104. return $this->aliasOf->isAbandoned();
  15105. }
  15106. public function getReplacementPackage()
  15107. {
  15108. return $this->aliasOf->getReplacementPackage();
  15109. }
  15110. public function __toString()
  15111. {
  15112. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  15113. }
  15114. }
  15115. <?php
  15116. namespace Composer\Package\Archiver;
  15117. use FilterIterator;
  15118. use PharData;
  15119. class ArchivableFilesFilter extends FilterIterator
  15120. {
  15121. private $dirs = array();
  15122. public function accept()
  15123. {
  15124. $file = $this->getInnerIterator()->current();
  15125. if ($file->isDir()) {
  15126. $this->dirs[] = (string)$file;
  15127. return false;
  15128. }
  15129. return true;
  15130. }
  15131. public function addEmptyDir(PharData $phar, $sources)
  15132. {
  15133. foreach ($this->dirs as $filepath) {
  15134. $localname = str_replace($sources . "/", '', $filepath);
  15135. $phar->addEmptyDir($localname);
  15136. }
  15137. }
  15138. }
  15139. <?php
  15140. namespace Composer\Package\Archiver;
  15141. use Composer\Util\Filesystem;
  15142. use FilesystemIterator;
  15143. use Symfony\Component\Finder\Finder;
  15144. use Symfony\Component\Finder\SplFileInfo;
  15145. class ArchivableFilesFinder extends \FilterIterator
  15146. {
  15147. protected $finder;
  15148. public function __construct($sources, array $excludes)
  15149. {
  15150. $fs = new Filesystem();
  15151. $sources = $fs->normalizePath($sources);
  15152. $filters = array(
  15153. new HgExcludeFilter($sources),
  15154. new GitExcludeFilter($sources),
  15155. new ComposerExcludeFilter($sources, $excludes),
  15156. );
  15157. $this->finder = new Finder();
  15158. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  15159. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  15160. return false;
  15161. }
  15162. $relativePath = preg_replace(
  15163. '#^'.preg_quote($sources, '#').'#',
  15164. '',
  15165. $fs->normalizePath($file->getRealPath())
  15166. );
  15167. $exclude = false;
  15168. foreach ($filters as $filter) {
  15169. $exclude = $filter->filter($relativePath, $exclude);
  15170. }
  15171. return !$exclude;
  15172. };
  15173. if (method_exists($filter, 'bindTo')) {
  15174. $filter = $filter->bindTo(null);
  15175. }
  15176. $this->finder
  15177. ->in($sources)
  15178. ->filter($filter)
  15179. ->ignoreVCS(true)
  15180. ->ignoreDotFiles(false);
  15181. parent::__construct($this->finder->getIterator());
  15182. }
  15183. public function accept()
  15184. {
  15185. $current = $this->getInnerIterator()->current();
  15186. if (!$current->isDir()) {
  15187. return true;
  15188. }
  15189. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  15190. return !$iterator->valid();
  15191. }
  15192. }
  15193. <?php
  15194. namespace Composer\Package\Archiver;
  15195. use Composer\Downloader\DownloadManager;
  15196. use Composer\Package\PackageInterface;
  15197. use Composer\Package\RootPackageInterface;
  15198. use Composer\Util\Filesystem;
  15199. use Composer\Json\JsonFile;
  15200. class ArchiveManager
  15201. {
  15202. protected $downloadManager;
  15203. protected $archivers = array();
  15204. protected $overwriteFiles = true;
  15205. public function __construct(DownloadManager $downloadManager)
  15206. {
  15207. $this->downloadManager = $downloadManager;
  15208. }
  15209. public function addArchiver(ArchiverInterface $archiver)
  15210. {
  15211. $this->archivers[] = $archiver;
  15212. }
  15213. public function setOverwriteFiles($overwriteFiles)
  15214. {
  15215. $this->overwriteFiles = $overwriteFiles;
  15216. return $this;
  15217. }
  15218. public function getPackageFilename(PackageInterface $package)
  15219. {
  15220. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  15221. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  15222. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  15223. } else {
  15224. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  15225. }
  15226. if ($package->getSourceReference()) {
  15227. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  15228. }
  15229. $name = implode('-', array_filter($nameParts, function ($p) {
  15230. return !empty($p);
  15231. }));
  15232. return str_replace('/', '-', $name);
  15233. }
  15234. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null)
  15235. {
  15236. if (empty($format)) {
  15237. throw new \InvalidArgumentException('Format must be specified');
  15238. }
  15239. $usableArchiver = null;
  15240. foreach ($this->archivers as $archiver) {
  15241. if ($archiver->supports($format, $package->getSourceType())) {
  15242. $usableArchiver = $archiver;
  15243. break;
  15244. }
  15245. }
  15246. if (null === $usableArchiver) {
  15247. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  15248. }
  15249. $filesystem = new Filesystem();
  15250. if (null === $fileName) {
  15251. $packageName = $this->getPackageFilename($package);
  15252. } else {
  15253. $packageName = $fileName;
  15254. }
  15255. $filesystem->ensureDirectoryExists($targetDir);
  15256. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  15257. $filesystem->ensureDirectoryExists(dirname($target));
  15258. if (!$this->overwriteFiles && file_exists($target)) {
  15259. return $target;
  15260. }
  15261. if ($package instanceof RootPackageInterface) {
  15262. $sourcePath = realpath('.');
  15263. } else {
  15264. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  15265. $filesystem->ensureDirectoryExists($sourcePath);
  15266. $this->downloadManager->download($package, $sourcePath);
  15267. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  15268. $jsonFile = new JsonFile($composerJsonPath);
  15269. $jsonData = $jsonFile->read();
  15270. if (!empty($jsonData['archive']['exclude'])) {
  15271. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  15272. }
  15273. }
  15274. }
  15275. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  15276. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  15277. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes());
  15278. $filesystem->rename($archivePath, $target);
  15279. if (!$package instanceof RootPackageInterface) {
  15280. $filesystem->removeDirectory($sourcePath);
  15281. }
  15282. $filesystem->remove($tempTarget);
  15283. return $target;
  15284. }
  15285. }
  15286. <?php
  15287. namespace Composer\Package\Archiver;
  15288. interface ArchiverInterface
  15289. {
  15290. public function archive($sources, $target, $format, array $excludes = array());
  15291. public function supports($format, $sourceType);
  15292. }
  15293. <?php
  15294. namespace Composer\Package\Archiver;
  15295. use Symfony\Component\Finder;
  15296. abstract class BaseExcludeFilter
  15297. {
  15298. protected $sourcePath;
  15299. protected $excludePatterns;
  15300. public function __construct($sourcePath)
  15301. {
  15302. $this->sourcePath = $sourcePath;
  15303. $this->excludePatterns = array();
  15304. }
  15305. public function filter($relativePath, $exclude)
  15306. {
  15307. foreach ($this->excludePatterns as $patternData) {
  15308. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  15309. if ($stripLeadingSlash) {
  15310. $path = substr($relativePath, 1);
  15311. } else {
  15312. $path = $relativePath;
  15313. }
  15314. if (preg_match($pattern, $path)) {
  15315. $exclude = !$negate;
  15316. }
  15317. }
  15318. return $exclude;
  15319. }
  15320. protected function parseLines(array $lines, $lineParser)
  15321. {
  15322. return array_filter(
  15323. array_map(
  15324. function ($line) use ($lineParser) {
  15325. $line = trim($line);
  15326. if (!$line || 0 === strpos($line, '#')) {
  15327. return null;
  15328. }
  15329. return call_user_func($lineParser, $line);
  15330. },
  15331. $lines
  15332. ),
  15333. function ($pattern) {
  15334. return $pattern !== null;
  15335. }
  15336. );
  15337. }
  15338. protected function generatePatterns($rules)
  15339. {
  15340. $patterns = array();
  15341. foreach ($rules as $rule) {
  15342. $patterns[] = $this->generatePattern($rule);
  15343. }
  15344. return $patterns;
  15345. }
  15346. protected function generatePattern($rule)
  15347. {
  15348. $negate = false;
  15349. $pattern = '{';
  15350. if (strlen($rule) && $rule[0] === '!') {
  15351. $negate = true;
  15352. $rule = substr($rule, 1);
  15353. }
  15354. if (strlen($rule) && $rule[0] === '/') {
  15355. $pattern .= '^/';
  15356. $rule = substr($rule, 1);
  15357. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  15358. $pattern .= '/';
  15359. $rule = substr($rule, 0, -1);
  15360. } elseif (false === strpos($rule, '/')) {
  15361. $pattern .= '/';
  15362. }
  15363. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  15364. return array($pattern . '}', $negate, false);
  15365. }
  15366. }
  15367. <?php
  15368. namespace Composer\Package\Archiver;
  15369. class ComposerExcludeFilter extends BaseExcludeFilter
  15370. {
  15371. public function __construct($sourcePath, array $excludeRules)
  15372. {
  15373. parent::__construct($sourcePath);
  15374. $this->excludePatterns = $this->generatePatterns($excludeRules);
  15375. }
  15376. }
  15377. <?php
  15378. namespace Composer\Package\Archiver;
  15379. class GitExcludeFilter extends BaseExcludeFilter
  15380. {
  15381. public function __construct($sourcePath)
  15382. {
  15383. parent::__construct($sourcePath);
  15384. if (file_exists($sourcePath.'/.gitignore')) {
  15385. $this->excludePatterns = $this->parseLines(
  15386. file($sourcePath.'/.gitignore'),
  15387. array($this, 'parseGitIgnoreLine')
  15388. );
  15389. }
  15390. if (file_exists($sourcePath.'/.gitattributes')) {
  15391. $this->excludePatterns = array_merge(
  15392. $this->excludePatterns,
  15393. $this->parseLines(
  15394. file($sourcePath.'/.gitattributes'),
  15395. array($this, 'parseGitAttributesLine')
  15396. ));
  15397. }
  15398. }
  15399. public function parseGitIgnoreLine($line)
  15400. {
  15401. return $this->generatePattern($line);
  15402. }
  15403. public function parseGitAttributesLine($line)
  15404. {
  15405. $parts = preg_split('#\s+#', $line);
  15406. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  15407. return $this->generatePattern($parts[0]);
  15408. }
  15409. return null;
  15410. }
  15411. }
  15412. <?php
  15413. namespace Composer\Package\Archiver;
  15414. use Symfony\Component\Finder;
  15415. class HgExcludeFilter extends BaseExcludeFilter
  15416. {
  15417. const HG_IGNORE_REGEX = 1;
  15418. const HG_IGNORE_GLOB = 2;
  15419. protected $patternMode;
  15420. public function __construct($sourcePath)
  15421. {
  15422. parent::__construct($sourcePath);
  15423. $this->patternMode = self::HG_IGNORE_REGEX;
  15424. if (file_exists($sourcePath.'/.hgignore')) {
  15425. $this->excludePatterns = $this->parseLines(
  15426. file($sourcePath.'/.hgignore'),
  15427. array($this, 'parseHgIgnoreLine')
  15428. );
  15429. }
  15430. }
  15431. public function parseHgIgnoreLine($line)
  15432. {
  15433. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  15434. if ($matches[1] === 'glob') {
  15435. $this->patternMode = self::HG_IGNORE_GLOB;
  15436. } else {
  15437. $this->patternMode = self::HG_IGNORE_REGEX;
  15438. }
  15439. return null;
  15440. }
  15441. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  15442. return $this->patternFromGlob($line);
  15443. } else {
  15444. return $this->patternFromRegex($line);
  15445. }
  15446. }
  15447. protected function patternFromGlob($line)
  15448. {
  15449. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  15450. $pattern = str_replace('[^/]*', '.*', $pattern);
  15451. return array($pattern, false, true);
  15452. }
  15453. public function patternFromRegex($line)
  15454. {
  15455. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  15456. return array($pattern, false, true);
  15457. }
  15458. }
  15459. <?php
  15460. namespace Composer\Package\Archiver;
  15461. class PharArchiver implements ArchiverInterface
  15462. {
  15463. protected static $formats = array(
  15464. 'zip' => \Phar::ZIP,
  15465. 'tar' => \Phar::TAR,
  15466. 'tar.gz' => \Phar::TAR,
  15467. 'tar.bz2' => \Phar::TAR,
  15468. );
  15469. protected static $compressFormats = array(
  15470. 'tar.gz' => \Phar::GZ,
  15471. 'tar.bz2' => \Phar::BZ2,
  15472. );
  15473. public function archive($sources, $target, $format, array $excludes = array())
  15474. {
  15475. $sources = realpath($sources);
  15476. if (file_exists($target)) {
  15477. unlink($target);
  15478. }
  15479. try {
  15480. $filename = substr($target, 0, strrpos($target, $format) - 1);
  15481. if (isset(static::$compressFormats[$format])) {
  15482. $target = $filename . '.tar';
  15483. }
  15484. $phar = new \PharData($target, null, null, static::$formats[$format]);
  15485. $files = new ArchivableFilesFinder($sources, $excludes);
  15486. $filesOnly = new ArchivableFilesFilter($files);
  15487. $phar->buildFromIterator($filesOnly, $sources);
  15488. $filesOnly->addEmptyDir($phar, $sources);
  15489. if (isset(static::$compressFormats[$format])) {
  15490. if (!$phar->canCompress(static::$compressFormats[$format])) {
  15491. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  15492. }
  15493. unlink($target);
  15494. $phar->compress(static::$compressFormats[$format]);
  15495. $target = $filename . '.' . $format;
  15496. }
  15497. return $target;
  15498. } catch (\UnexpectedValueException $e) {
  15499. $message = sprintf("Could not create archive '%s' from '%s': %s",
  15500. $target,
  15501. $sources,
  15502. $e->getMessage()
  15503. );
  15504. throw new \RuntimeException($message, $e->getCode(), $e);
  15505. }
  15506. }
  15507. public function supports($format, $sourceType)
  15508. {
  15509. return isset(static::$formats[$format]);
  15510. }
  15511. }
  15512. <?php
  15513. namespace Composer\Package\Archiver;
  15514. use ZipArchive;
  15515. use Composer\Util\Filesystem;
  15516. class ZipArchiver implements ArchiverInterface
  15517. {
  15518. protected static $formats = array(
  15519. 'zip' => 1,
  15520. );
  15521. public function archive($sources, $target, $format, array $excludes = array())
  15522. {
  15523. $fs = new Filesystem();
  15524. $sources = $fs->normalizePath($sources);
  15525. $zip = new ZipArchive();
  15526. $res = $zip->open($target, ZipArchive::CREATE);
  15527. if ($res === true) {
  15528. $files = new ArchivableFilesFinder($sources, $excludes);
  15529. foreach ($files as $file) {
  15530. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  15531. $localname = str_replace($sources.'/', '', $filepath);
  15532. if ($file->isDir()) {
  15533. $zip->addEmptyDir($localname);
  15534. } else {
  15535. $zip->addFile($filepath, $localname);
  15536. }
  15537. }
  15538. if ($zip->close()) {
  15539. return $target;
  15540. }
  15541. }
  15542. $message = sprintf("Could not create archive '%s' from '%s': %s",
  15543. $target,
  15544. $sources,
  15545. $zip->getStatusString()
  15546. );
  15547. throw new \RuntimeException($message);
  15548. }
  15549. public function supports($format, $sourceType)
  15550. {
  15551. return isset(static::$formats[$format]) && $this->compressionAvailable();
  15552. }
  15553. private function compressionAvailable()
  15554. {
  15555. return class_exists('ZipArchive');
  15556. }
  15557. }
  15558. <?php
  15559. namespace Composer\Package;
  15560. use Composer\Repository\RepositoryInterface;
  15561. use Composer\Repository\PlatformRepository;
  15562. abstract class BasePackage implements PackageInterface
  15563. {
  15564. public static $supportedLinkTypes = array(
  15565. 'require' => array('description' => 'requires', 'method' => 'requires'),
  15566. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  15567. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  15568. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  15569. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  15570. );
  15571. const STABILITY_STABLE = 0;
  15572. const STABILITY_RC = 5;
  15573. const STABILITY_BETA = 10;
  15574. const STABILITY_ALPHA = 15;
  15575. const STABILITY_DEV = 20;
  15576. public static $stabilities = array(
  15577. 'stable' => self::STABILITY_STABLE,
  15578. 'RC' => self::STABILITY_RC,
  15579. 'beta' => self::STABILITY_BETA,
  15580. 'alpha' => self::STABILITY_ALPHA,
  15581. 'dev' => self::STABILITY_DEV,
  15582. );
  15583. public $id;
  15584. protected $name;
  15585. protected $prettyName;
  15586. protected $repository;
  15587. protected $transportOptions = array();
  15588. public function __construct($name)
  15589. {
  15590. $this->prettyName = $name;
  15591. $this->name = strtolower($name);
  15592. $this->id = -1;
  15593. }
  15594. public function getName()
  15595. {
  15596. return $this->name;
  15597. }
  15598. public function getPrettyName()
  15599. {
  15600. return $this->prettyName;
  15601. }
  15602. public function getNames()
  15603. {
  15604. $names = array(
  15605. $this->getName() => true,
  15606. );
  15607. foreach ($this->getProvides() as $link) {
  15608. $names[$link->getTarget()] = true;
  15609. }
  15610. foreach ($this->getReplaces() as $link) {
  15611. $names[$link->getTarget()] = true;
  15612. }
  15613. return array_keys($names);
  15614. }
  15615. public function setId($id)
  15616. {
  15617. $this->id = $id;
  15618. }
  15619. public function getId()
  15620. {
  15621. return $this->id;
  15622. }
  15623. public function setRepository(RepositoryInterface $repository)
  15624. {
  15625. if ($this->repository && $repository !== $this->repository) {
  15626. throw new \LogicException('A package can only be added to one repository');
  15627. }
  15628. $this->repository = $repository;
  15629. }
  15630. public function getRepository()
  15631. {
  15632. return $this->repository;
  15633. }
  15634. public function getTransportOptions()
  15635. {
  15636. return $this->transportOptions;
  15637. }
  15638. public function setTransportOptions(array $options)
  15639. {
  15640. $this->transportOptions = $options;
  15641. }
  15642. public function isPlatform()
  15643. {
  15644. return $this->getRepository() instanceof PlatformRepository;
  15645. }
  15646. public function getUniqueName()
  15647. {
  15648. return $this->getName().'-'.$this->getVersion();
  15649. }
  15650. public function equals(PackageInterface $package)
  15651. {
  15652. $self = $this;
  15653. if ($this instanceof AliasPackage) {
  15654. $self = $this->getAliasOf();
  15655. }
  15656. if ($package instanceof AliasPackage) {
  15657. $package = $package->getAliasOf();
  15658. }
  15659. return $package === $self;
  15660. }
  15661. public function __toString()
  15662. {
  15663. return $this->getUniqueName();
  15664. }
  15665. public function getPrettyString()
  15666. {
  15667. return $this->getPrettyName().' '.$this->getPrettyVersion();
  15668. }
  15669. public function getFullPrettyVersion($truncate = true)
  15670. {
  15671. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  15672. return $this->getPrettyVersion();
  15673. }
  15674. if ($truncate && strlen($this->getSourceReference()) === 40) {
  15675. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  15676. }
  15677. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  15678. }
  15679. public function getStabilityPriority()
  15680. {
  15681. return self::$stabilities[$this->getStability()];
  15682. }
  15683. public function __clone()
  15684. {
  15685. $this->repository = null;
  15686. $this->id = -1;
  15687. }
  15688. }
  15689. <?php
  15690. namespace Composer\Package;
  15691. class CompletePackage extends Package implements CompletePackageInterface
  15692. {
  15693. protected $repositories;
  15694. protected $license = array();
  15695. protected $keywords;
  15696. protected $authors;
  15697. protected $description;
  15698. protected $homepage;
  15699. protected $scripts = array();
  15700. protected $support = array();
  15701. protected $abandoned = false;
  15702. public function setScripts(array $scripts)
  15703. {
  15704. $this->scripts = $scripts;
  15705. }
  15706. public function getScripts()
  15707. {
  15708. return $this->scripts;
  15709. }
  15710. public function setRepositories($repositories)
  15711. {
  15712. $this->repositories = $repositories;
  15713. }
  15714. public function getRepositories()
  15715. {
  15716. return $this->repositories;
  15717. }
  15718. public function setLicense(array $license)
  15719. {
  15720. $this->license = $license;
  15721. }
  15722. public function getLicense()
  15723. {
  15724. return $this->license;
  15725. }
  15726. public function setKeywords(array $keywords)
  15727. {
  15728. $this->keywords = $keywords;
  15729. }
  15730. public function getKeywords()
  15731. {
  15732. return $this->keywords;
  15733. }
  15734. public function setAuthors(array $authors)
  15735. {
  15736. $this->authors = $authors;
  15737. }
  15738. public function getAuthors()
  15739. {
  15740. return $this->authors;
  15741. }
  15742. public function setDescription($description)
  15743. {
  15744. $this->description = $description;
  15745. }
  15746. public function getDescription()
  15747. {
  15748. return $this->description;
  15749. }
  15750. public function setHomepage($homepage)
  15751. {
  15752. $this->homepage = $homepage;
  15753. }
  15754. public function getHomepage()
  15755. {
  15756. return $this->homepage;
  15757. }
  15758. public function setSupport(array $support)
  15759. {
  15760. $this->support = $support;
  15761. }
  15762. public function getSupport()
  15763. {
  15764. return $this->support;
  15765. }
  15766. public function isAbandoned()
  15767. {
  15768. return (boolean) $this->abandoned;
  15769. }
  15770. public function setAbandoned($abandoned)
  15771. {
  15772. $this->abandoned = $abandoned;
  15773. }
  15774. public function getReplacementPackage()
  15775. {
  15776. return is_string($this->abandoned) ? $this->abandoned : null;
  15777. }
  15778. }
  15779. <?php
  15780. namespace Composer\Package;
  15781. interface CompletePackageInterface extends PackageInterface
  15782. {
  15783. public function getScripts();
  15784. public function getRepositories();
  15785. public function getLicense();
  15786. public function getKeywords();
  15787. public function getDescription();
  15788. public function getHomepage();
  15789. public function getAuthors();
  15790. public function getSupport();
  15791. public function isAbandoned();
  15792. public function getReplacementPackage();
  15793. }
  15794. <?php
  15795. namespace Composer\Package\Dumper;
  15796. use Composer\Package\BasePackage;
  15797. use Composer\Package\PackageInterface;
  15798. use Composer\Package\CompletePackageInterface;
  15799. use Composer\Package\RootPackageInterface;
  15800. class ArrayDumper
  15801. {
  15802. public function dump(PackageInterface $package)
  15803. {
  15804. $keys = array(
  15805. 'binaries' => 'bin',
  15806. 'type',
  15807. 'extra',
  15808. 'installationSource' => 'installation-source',
  15809. 'autoload',
  15810. 'devAutoload' => 'autoload-dev',
  15811. 'notificationUrl' => 'notification-url',
  15812. 'includePaths' => 'include-path',
  15813. );
  15814. $data = array();
  15815. $data['name'] = $package->getPrettyName();
  15816. $data['version'] = $package->getPrettyVersion();
  15817. $data['version_normalized'] = $package->getVersion();
  15818. if ($package->getTargetDir()) {
  15819. $data['target-dir'] = $package->getTargetDir();
  15820. }
  15821. if ($package->getSourceType()) {
  15822. $data['source']['type'] = $package->getSourceType();
  15823. $data['source']['url'] = $package->getSourceUrl();
  15824. $data['source']['reference'] = $package->getSourceReference();
  15825. if ($mirrors = $package->getSourceMirrors()) {
  15826. $data['source']['mirrors'] = $mirrors;
  15827. }
  15828. }
  15829. if ($package->getDistType()) {
  15830. $data['dist']['type'] = $package->getDistType();
  15831. $data['dist']['url'] = $package->getDistUrl();
  15832. $data['dist']['reference'] = $package->getDistReference();
  15833. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  15834. if ($mirrors = $package->getDistMirrors()) {
  15835. $data['dist']['mirrors'] = $mirrors;
  15836. }
  15837. }
  15838. if ($package->getArchiveExcludes()) {
  15839. $data['archive']['exclude'] = $package->getArchiveExcludes();
  15840. }
  15841. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  15842. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  15843. foreach ($links as $link) {
  15844. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  15845. }
  15846. ksort($data[$type]);
  15847. }
  15848. }
  15849. if ($packages = $package->getSuggests()) {
  15850. ksort($packages);
  15851. $data['suggest'] = $packages;
  15852. }
  15853. if ($package->getReleaseDate()) {
  15854. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  15855. }
  15856. $data = $this->dumpValues($package, $keys, $data);
  15857. if ($package instanceof CompletePackageInterface) {
  15858. $keys = array(
  15859. 'scripts',
  15860. 'license',
  15861. 'authors',
  15862. 'description',
  15863. 'homepage',
  15864. 'keywords',
  15865. 'repositories',
  15866. 'support',
  15867. );
  15868. $data = $this->dumpValues($package, $keys, $data);
  15869. if (isset($data['keywords']) && is_array($data['keywords'])) {
  15870. sort($data['keywords']);
  15871. }
  15872. if ($package->isAbandoned()) {
  15873. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  15874. }
  15875. }
  15876. if ($package instanceof RootPackageInterface) {
  15877. $minimumStability = $package->getMinimumStability();
  15878. if ($minimumStability) {
  15879. $data['minimum-stability'] = $minimumStability;
  15880. }
  15881. }
  15882. if (count($package->getTransportOptions()) > 0) {
  15883. $data['transport-options'] = $package->getTransportOptions();
  15884. }
  15885. return $data;
  15886. }
  15887. private function dumpValues(PackageInterface $package, array $keys, array $data)
  15888. {
  15889. foreach ($keys as $method => $key) {
  15890. if (is_numeric($method)) {
  15891. $method = $key;
  15892. }
  15893. $getter = 'get'.ucfirst($method);
  15894. $value = $package->$getter();
  15895. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  15896. $data[$key] = $value;
  15897. }
  15898. }
  15899. return $data;
  15900. }
  15901. }
  15902. <?php
  15903. namespace Composer\Package;
  15904. use Composer\Semver\Constraint\ConstraintInterface;
  15905. class Link
  15906. {
  15907. protected $source;
  15908. protected $target;
  15909. protected $constraint;
  15910. protected $description;
  15911. protected $prettyConstraint;
  15912. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  15913. {
  15914. $this->source = strtolower($source);
  15915. $this->target = strtolower($target);
  15916. $this->constraint = $constraint;
  15917. $this->description = $description;
  15918. $this->prettyConstraint = $prettyConstraint;
  15919. }
  15920. public function getDescription()
  15921. {
  15922. return $this->description;
  15923. }
  15924. public function getSource()
  15925. {
  15926. return $this->source;
  15927. }
  15928. public function getTarget()
  15929. {
  15930. return $this->target;
  15931. }
  15932. public function getConstraint()
  15933. {
  15934. return $this->constraint;
  15935. }
  15936. public function getPrettyConstraint()
  15937. {
  15938. if (null === $this->prettyConstraint) {
  15939. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  15940. }
  15941. return $this->prettyConstraint;
  15942. }
  15943. public function __toString()
  15944. {
  15945. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  15946. }
  15947. public function getPrettyString(PackageInterface $sourcePackage)
  15948. {
  15949. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  15950. }
  15951. }
  15952. <?php
  15953. namespace Composer\Package\LinkConstraint;
  15954. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  15955. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  15956. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  15957. {
  15958. }
  15959. <?php
  15960. namespace Composer\Package\LinkConstraint;
  15961. use Composer\Semver\Constraint\ConstraintInterface;
  15962. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  15963. interface LinkConstraintInterface extends ConstraintInterface
  15964. {
  15965. }
  15966. <?php
  15967. namespace Composer\Package\LinkConstraint;
  15968. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  15969. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  15970. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  15971. {
  15972. }
  15973. <?php
  15974. namespace Composer\Package\LinkConstraint;
  15975. use Composer\Semver\Constraint\AbstractConstraint;
  15976. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  15977. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  15978. {
  15979. }
  15980. <?php
  15981. namespace Composer\Package\LinkConstraint;
  15982. use Composer\Semver\Constraint\Constraint;
  15983. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  15984. class VersionConstraint extends Constraint implements LinkConstraintInterface
  15985. {
  15986. }
  15987. <?php
  15988. namespace Composer\Package\Loader;
  15989. use Composer\Package;
  15990. use Composer\Package\AliasPackage;
  15991. use Composer\Package\Link;
  15992. use Composer\Package\RootAliasPackage;
  15993. use Composer\Package\RootPackageInterface;
  15994. use Composer\Package\Version\VersionParser;
  15995. use Composer\Semver\VersionParser as SemverVersionParser;
  15996. class ArrayLoader implements LoaderInterface
  15997. {
  15998. protected $versionParser;
  15999. protected $loadOptions;
  16000. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  16001. {
  16002. if (!$parser) {
  16003. $parser = new VersionParser;
  16004. }
  16005. $this->versionParser = $parser;
  16006. $this->loadOptions = $loadOptions;
  16007. }
  16008. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16009. {
  16010. if (!isset($config['name'])) {
  16011. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  16012. }
  16013. if (!isset($config['version'])) {
  16014. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  16015. }
  16016. if (isset($config['version_normalized'])) {
  16017. $version = $config['version_normalized'];
  16018. } else {
  16019. $version = $this->versionParser->normalize($config['version']);
  16020. }
  16021. $package = new $class($config['name'], $version, $config['version']);
  16022. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  16023. if (isset($config['target-dir'])) {
  16024. $package->setTargetDir($config['target-dir']);
  16025. }
  16026. if (isset($config['extra']) && is_array($config['extra'])) {
  16027. $package->setExtra($config['extra']);
  16028. }
  16029. if (isset($config['bin'])) {
  16030. if (!is_array($config['bin'])) {
  16031. throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.');
  16032. }
  16033. foreach ($config['bin'] as $key => $bin) {
  16034. $config['bin'][$key] = ltrim($bin, '/');
  16035. }
  16036. $package->setBinaries($config['bin']);
  16037. }
  16038. if (isset($config['installation-source'])) {
  16039. $package->setInstallationSource($config['installation-source']);
  16040. }
  16041. if (isset($config['source'])) {
  16042. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  16043. throw new \UnexpectedValueException(sprintf(
  16044. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  16045. $config['name'],
  16046. json_encode($config['source'])
  16047. ));
  16048. }
  16049. $package->setSourceType($config['source']['type']);
  16050. $package->setSourceUrl($config['source']['url']);
  16051. $package->setSourceReference($config['source']['reference']);
  16052. if (isset($config['source']['mirrors'])) {
  16053. $package->setSourceMirrors($config['source']['mirrors']);
  16054. }
  16055. }
  16056. if (isset($config['dist'])) {
  16057. if (!isset($config['dist']['type'])
  16058. || !isset($config['dist']['url'])) {
  16059. throw new \UnexpectedValueException(sprintf(
  16060. "Package %s's dist key should be specified as ".
  16061. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  16062. $config['name'],
  16063. json_encode($config['dist'])
  16064. ));
  16065. }
  16066. $package->setDistType($config['dist']['type']);
  16067. $package->setDistUrl($config['dist']['url']);
  16068. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  16069. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  16070. if (isset($config['dist']['mirrors'])) {
  16071. $package->setDistMirrors($config['dist']['mirrors']);
  16072. }
  16073. }
  16074. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  16075. if (isset($config[$type])) {
  16076. $method = 'set'.ucfirst($opts['method']);
  16077. $package->{$method}(
  16078. $this->parseLinks(
  16079. $package->getName(),
  16080. $package->getPrettyVersion(),
  16081. $opts['description'],
  16082. $config[$type]
  16083. )
  16084. );
  16085. }
  16086. }
  16087. if (isset($config['suggest']) && is_array($config['suggest'])) {
  16088. foreach ($config['suggest'] as $target => $reason) {
  16089. if ('self.version' === trim($reason)) {
  16090. $config['suggest'][$target] = $package->getPrettyVersion();
  16091. }
  16092. }
  16093. $package->setSuggests($config['suggest']);
  16094. }
  16095. if (isset($config['autoload'])) {
  16096. $package->setAutoload($config['autoload']);
  16097. }
  16098. if (isset($config['autoload-dev'])) {
  16099. $package->setDevAutoload($config['autoload-dev']);
  16100. }
  16101. if (isset($config['include-path'])) {
  16102. $package->setIncludePaths($config['include-path']);
  16103. }
  16104. if (!empty($config['time'])) {
  16105. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  16106. try {
  16107. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  16108. $package->setReleaseDate($date);
  16109. } catch (\Exception $e) {
  16110. }
  16111. }
  16112. if (!empty($config['notification-url'])) {
  16113. $package->setNotificationUrl($config['notification-url']);
  16114. }
  16115. if (!empty($config['archive']['exclude'])) {
  16116. $package->setArchiveExcludes($config['archive']['exclude']);
  16117. }
  16118. if ($package instanceof Package\CompletePackageInterface) {
  16119. if (isset($config['scripts']) && is_array($config['scripts'])) {
  16120. foreach ($config['scripts'] as $event => $listeners) {
  16121. $config['scripts'][$event] = (array) $listeners;
  16122. }
  16123. if (isset($config['scripts']['composer'])) {
  16124. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  16125. }
  16126. $package->setScripts($config['scripts']);
  16127. }
  16128. if (!empty($config['description']) && is_string($config['description'])) {
  16129. $package->setDescription($config['description']);
  16130. }
  16131. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  16132. $package->setHomepage($config['homepage']);
  16133. }
  16134. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  16135. $package->setKeywords($config['keywords']);
  16136. }
  16137. if (!empty($config['license'])) {
  16138. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  16139. }
  16140. if (!empty($config['authors']) && is_array($config['authors'])) {
  16141. $package->setAuthors($config['authors']);
  16142. }
  16143. if (isset($config['support'])) {
  16144. $package->setSupport($config['support']);
  16145. }
  16146. if (isset($config['abandoned'])) {
  16147. $package->setAbandoned($config['abandoned']);
  16148. }
  16149. }
  16150. if ($aliasNormalized = $this->getBranchAlias($config)) {
  16151. if ($package instanceof RootPackageInterface) {
  16152. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16153. } else {
  16154. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16155. }
  16156. }
  16157. if ($this->loadOptions && isset($config['transport-options'])) {
  16158. $package->setTransportOptions($config['transport-options']);
  16159. }
  16160. return $package;
  16161. }
  16162. public function parseLinks($source, $sourceVersion, $description, $links)
  16163. {
  16164. $res = array();
  16165. foreach ($links as $target => $constraint) {
  16166. if (!is_string($constraint)) {
  16167. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  16168. }
  16169. if ('self.version' === $constraint) {
  16170. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  16171. } else {
  16172. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  16173. }
  16174. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  16175. }
  16176. return $res;
  16177. }
  16178. public function getBranchAlias(array $config)
  16179. {
  16180. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  16181. || !isset($config['extra']['branch-alias'])
  16182. || !is_array($config['extra']['branch-alias'])
  16183. ) {
  16184. return;
  16185. }
  16186. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16187. if ('-dev' !== substr($targetBranch, -4)) {
  16188. continue;
  16189. }
  16190. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16191. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16192. continue;
  16193. }
  16194. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  16195. continue;
  16196. }
  16197. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16198. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16199. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16200. ) {
  16201. continue;
  16202. }
  16203. return $validatedTargetBranch;
  16204. }
  16205. }
  16206. }
  16207. <?php
  16208. namespace Composer\Package\Loader;
  16209. class InvalidPackageException extends \Exception
  16210. {
  16211. private $errors;
  16212. private $warnings;
  16213. private $data;
  16214. public function __construct(array $errors, array $warnings, array $data)
  16215. {
  16216. $this->errors = $errors;
  16217. $this->warnings = $warnings;
  16218. $this->data = $data;
  16219. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  16220. }
  16221. public function getData()
  16222. {
  16223. return $this->data;
  16224. }
  16225. public function getErrors()
  16226. {
  16227. return $this->errors;
  16228. }
  16229. public function getWarnings()
  16230. {
  16231. return $this->warnings;
  16232. }
  16233. }
  16234. <?php
  16235. namespace Composer\Package\Loader;
  16236. use Composer\Json\JsonFile;
  16237. class JsonLoader
  16238. {
  16239. private $loader;
  16240. public function __construct(LoaderInterface $loader)
  16241. {
  16242. $this->loader = $loader;
  16243. }
  16244. public function load($json)
  16245. {
  16246. if ($json instanceof JsonFile) {
  16247. $config = $json->read();
  16248. } elseif (file_exists($json)) {
  16249. $config = JsonFile::parseJson(file_get_contents($json), $json);
  16250. } elseif (is_string($json)) {
  16251. $config = JsonFile::parseJson($json);
  16252. }
  16253. return $this->loader->load($config);
  16254. }
  16255. }
  16256. <?php
  16257. namespace Composer\Package\Loader;
  16258. interface LoaderInterface
  16259. {
  16260. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  16261. }
  16262. <?php
  16263. namespace Composer\Package\Loader;
  16264. use Composer\Package\BasePackage;
  16265. use Composer\Package\AliasPackage;
  16266. use Composer\Config;
  16267. use Composer\Package\RootPackageInterface;
  16268. use Composer\Repository\RepositoryFactory;
  16269. use Composer\Package\Version\VersionGuesser;
  16270. use Composer\Package\Version\VersionParser;
  16271. use Composer\Repository\RepositoryManager;
  16272. use Composer\Util\ProcessExecutor;
  16273. class RootPackageLoader extends ArrayLoader
  16274. {
  16275. private $manager;
  16276. private $config;
  16277. private $versionGuesser;
  16278. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  16279. {
  16280. parent::__construct($parser);
  16281. $this->manager = $manager;
  16282. $this->config = $config;
  16283. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  16284. }
  16285. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  16286. {
  16287. if (!isset($config['name'])) {
  16288. $config['name'] = '__root__';
  16289. }
  16290. $autoVersioned = false;
  16291. if (!isset($config['version'])) {
  16292. if (getenv('COMPOSER_ROOT_VERSION')) {
  16293. $version = getenv('COMPOSER_ROOT_VERSION');
  16294. $commit = null;
  16295. } else {
  16296. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  16297. $version = $versionData['version'];
  16298. $commit = $versionData['commit'];
  16299. }
  16300. if (!$version) {
  16301. $version = '1.0.0';
  16302. $autoVersioned = true;
  16303. }
  16304. $config['version'] = $version;
  16305. if ($commit) {
  16306. $config['source'] = array(
  16307. 'type' => '',
  16308. 'url' => '',
  16309. 'reference' => $commit,
  16310. );
  16311. $config['dist'] = array(
  16312. 'type' => '',
  16313. 'url' => '',
  16314. 'reference' => $commit,
  16315. );
  16316. }
  16317. }
  16318. $realPackage = $package = parent::load($config, $class);
  16319. if ($realPackage instanceof AliasPackage) {
  16320. $realPackage = $package->getAliasOf();
  16321. }
  16322. if ($autoVersioned) {
  16323. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  16324. }
  16325. if (isset($config['minimum-stability'])) {
  16326. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  16327. }
  16328. $aliases = array();
  16329. $stabilityFlags = array();
  16330. $references = array();
  16331. foreach (array('require', 'require-dev') as $linkType) {
  16332. if (isset($config[$linkType])) {
  16333. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  16334. $method = 'get'.ucfirst($linkInfo['method']);
  16335. $links = array();
  16336. foreach ($realPackage->$method() as $link) {
  16337. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  16338. }
  16339. $aliases = $this->extractAliases($links, $aliases);
  16340. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  16341. $references = $this->extractReferences($links, $references);
  16342. }
  16343. }
  16344. if (isset($links[$config['name']])) {
  16345. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  16346. 'Did you accidentally name your root package after an external package?', $config['name']));
  16347. }
  16348. $realPackage->setAliases($aliases);
  16349. $realPackage->setStabilityFlags($stabilityFlags);
  16350. $realPackage->setReferences($references);
  16351. if (isset($config['prefer-stable'])) {
  16352. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  16353. }
  16354. if (isset($config['config'])) {
  16355. $realPackage->setConfig($config['config']);
  16356. }
  16357. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  16358. foreach ($repos as $repo) {
  16359. $this->manager->addRepository($repo);
  16360. }
  16361. $realPackage->setRepositories($this->config->getRepositories());
  16362. return $package;
  16363. }
  16364. private function extractAliases(array $requires, array $aliases)
  16365. {
  16366. foreach ($requires as $reqName => $reqVersion) {
  16367. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  16368. $aliases[] = array(
  16369. 'package' => strtolower($reqName),
  16370. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  16371. 'alias' => $match[2],
  16372. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  16373. );
  16374. }
  16375. }
  16376. return $aliases;
  16377. }
  16378. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  16379. {
  16380. $stabilities = BasePackage::$stabilities;
  16381. $minimumStability = $stabilities[$minimumStability];
  16382. foreach ($requires as $reqName => $reqVersion) {
  16383. $constraints = array();
  16384. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  16385. foreach ($orSplit as $orConstraint) {
  16386. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  16387. foreach ($andSplit as $andConstraint) {
  16388. $constraints[] = $andConstraint;
  16389. }
  16390. }
  16391. $match = false;
  16392. foreach ($constraints as $constraint) {
  16393. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  16394. $name = strtolower($reqName);
  16395. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  16396. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  16397. continue;
  16398. }
  16399. $stabilityFlags[$name] = $stability;
  16400. $match = true;
  16401. }
  16402. }
  16403. if ($match) {
  16404. continue;
  16405. }
  16406. foreach ($constraints as $constraint) {
  16407. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  16408. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  16409. $name = strtolower($reqName);
  16410. $stability = $stabilities[$stabilityName];
  16411. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  16412. continue;
  16413. }
  16414. $stabilityFlags[$name] = $stability;
  16415. }
  16416. }
  16417. }
  16418. return $stabilityFlags;
  16419. }
  16420. private function extractReferences(array $requires, array $references)
  16421. {
  16422. foreach ($requires as $reqName => $reqVersion) {
  16423. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  16424. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  16425. $name = strtolower($reqName);
  16426. $references[$name] = $match[1];
  16427. }
  16428. }
  16429. return $references;
  16430. }
  16431. }
  16432. <?php
  16433. namespace Composer\Package\Loader;
  16434. use Composer\Package;
  16435. use Composer\Package\BasePackage;
  16436. use Composer\Semver\Constraint\Constraint;
  16437. use Composer\Package\Version\VersionParser;
  16438. use Composer\Repository\PlatformRepository;
  16439. class ValidatingArrayLoader implements LoaderInterface
  16440. {
  16441. const CHECK_ALL = 3;
  16442. const CHECK_UNBOUND_CONSTRAINTS = 1;
  16443. const CHECK_STRICT_CONSTRAINTS = 2;
  16444. private $loader;
  16445. private $versionParser;
  16446. private $errors;
  16447. private $warnings;
  16448. private $config;
  16449. private $strictName;
  16450. private $flags;
  16451. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  16452. {
  16453. $this->loader = $loader;
  16454. $this->versionParser = $parser ?: new VersionParser();
  16455. $this->strictName = $strictName;
  16456. $this->flags = $flags;
  16457. }
  16458. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16459. {
  16460. $this->errors = array();
  16461. $this->warnings = array();
  16462. $this->config = $config;
  16463. if ($this->strictName) {
  16464. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  16465. } else {
  16466. $this->validateString('name', true);
  16467. }
  16468. if (!empty($this->config['version'])) {
  16469. try {
  16470. $this->versionParser->normalize($this->config['version']);
  16471. } catch (\Exception $e) {
  16472. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  16473. unset($this->config['version']);
  16474. }
  16475. }
  16476. $this->validateRegex('type', '[A-Za-z0-9-]+');
  16477. $this->validateString('target-dir');
  16478. $this->validateArray('extra');
  16479. $this->validateFlatArray('bin');
  16480. $this->validateArray('scripts');
  16481. $this->validateString('description');
  16482. $this->validateUrl('homepage');
  16483. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  16484. if (isset($this->config['license'])) {
  16485. if (is_string($this->config['license'])) {
  16486. $this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
  16487. } else {
  16488. $this->validateFlatArray('license', '[A-Za-z0-9+. ()-]+');
  16489. }
  16490. }
  16491. $this->validateString('time');
  16492. if (!empty($this->config['time'])) {
  16493. try {
  16494. $date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  16495. } catch (\Exception $e) {
  16496. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  16497. unset($this->config['time']);
  16498. }
  16499. }
  16500. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  16501. foreach ($this->config['authors'] as $key => $author) {
  16502. if (!is_array($author)) {
  16503. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  16504. unset($this->config['authors'][$key]);
  16505. continue;
  16506. }
  16507. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  16508. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  16509. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  16510. unset($this->config['authors'][$key][$authorData]);
  16511. }
  16512. }
  16513. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  16514. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  16515. unset($this->config['authors'][$key]['homepage']);
  16516. }
  16517. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  16518. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  16519. unset($this->config['authors'][$key]['email']);
  16520. }
  16521. if (empty($this->config['authors'][$key])) {
  16522. unset($this->config['authors'][$key]);
  16523. }
  16524. }
  16525. if (empty($this->config['authors'])) {
  16526. unset($this->config['authors']);
  16527. }
  16528. }
  16529. if ($this->validateArray('support') && !empty($this->config['support'])) {
  16530. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  16531. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  16532. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  16533. unset($this->config['support'][$key]);
  16534. }
  16535. }
  16536. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  16537. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  16538. unset($this->config['support']['email']);
  16539. }
  16540. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  16541. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  16542. unset($this->config['support']['irc']);
  16543. }
  16544. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  16545. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  16546. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  16547. unset($this->config['support'][$key]);
  16548. }
  16549. }
  16550. if (empty($this->config['support'])) {
  16551. unset($this->config['support']);
  16552. }
  16553. }
  16554. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  16555. $stableConstraint = new Constraint('=', '1.0.0');
  16556. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  16557. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  16558. foreach ($this->config[$linkType] as $package => $constraint) {
  16559. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  16560. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  16561. }
  16562. if (!is_string($constraint)) {
  16563. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  16564. unset($this->config[$linkType][$package]);
  16565. } elseif ('self.version' !== $constraint) {
  16566. try {
  16567. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  16568. } catch (\Exception $e) {
  16569. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  16570. unset($this->config[$linkType][$package]);
  16571. continue;
  16572. }
  16573. if (
  16574. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  16575. && 'require' === $linkType
  16576. && $linkConstraint->matches($unboundConstraint)
  16577. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  16578. ) {
  16579. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  16580. } elseif (
  16581. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  16582. && 'require' === $linkType
  16583. && substr($linkConstraint, 0, 1) === '='
  16584. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  16585. ) {
  16586. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  16587. }
  16588. }
  16589. }
  16590. }
  16591. }
  16592. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  16593. foreach ($this->config['suggest'] as $package => $description) {
  16594. if (!is_string($description)) {
  16595. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  16596. unset($this->config['suggest'][$package]);
  16597. }
  16598. }
  16599. }
  16600. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  16601. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  16602. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  16603. unset($this->config['minimum-stability']);
  16604. }
  16605. }
  16606. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  16607. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  16608. foreach ($this->config['autoload'] as $type => $typeConfig) {
  16609. if (!in_array($type, $types)) {
  16610. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  16611. unset($this->config['autoload'][$type]);
  16612. }
  16613. if ($type === 'psr-4') {
  16614. foreach ($typeConfig as $namespace => $dirs) {
  16615. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  16616. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  16617. }
  16618. }
  16619. }
  16620. }
  16621. }
  16622. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  16623. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  16624. unset($this->config['autoload']['psr-4']);
  16625. }
  16626. $this->validateFlatArray('include-path');
  16627. $this->validateArray('transport-options');
  16628. if (isset($this->config['extra']['branch-alias'])) {
  16629. if (!is_array($this->config['extra']['branch-alias'])) {
  16630. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  16631. } else {
  16632. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16633. if ('-dev' !== substr($targetBranch, -4)) {
  16634. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  16635. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16636. continue;
  16637. }
  16638. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16639. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16640. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  16641. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16642. continue;
  16643. }
  16644. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16645. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16646. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16647. ) {
  16648. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  16649. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16650. }
  16651. }
  16652. }
  16653. }
  16654. if ($this->errors) {
  16655. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  16656. }
  16657. $package = $this->loader->load($this->config, $class);
  16658. $this->config = null;
  16659. return $package;
  16660. }
  16661. public function getWarnings()
  16662. {
  16663. return $this->warnings;
  16664. }
  16665. public function getErrors()
  16666. {
  16667. return $this->errors;
  16668. }
  16669. private function validateRegex($property, $regex, $mandatory = false)
  16670. {
  16671. if (!$this->validateString($property, $mandatory)) {
  16672. return false;
  16673. }
  16674. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  16675. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  16676. if ($mandatory) {
  16677. $this->errors[] = $message;
  16678. } else {
  16679. $this->warnings[] = $message;
  16680. }
  16681. unset($this->config[$property]);
  16682. return false;
  16683. }
  16684. return true;
  16685. }
  16686. private function validateString($property, $mandatory = false)
  16687. {
  16688. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  16689. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  16690. unset($this->config[$property]);
  16691. return false;
  16692. }
  16693. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  16694. if ($mandatory) {
  16695. $this->errors[] = $property.' : must be present';
  16696. }
  16697. unset($this->config[$property]);
  16698. return false;
  16699. }
  16700. return true;
  16701. }
  16702. private function validateArray($property, $mandatory = false)
  16703. {
  16704. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  16705. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  16706. unset($this->config[$property]);
  16707. return false;
  16708. }
  16709. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  16710. if ($mandatory) {
  16711. $this->errors[] = $property.' : must be present and contain at least one element';
  16712. }
  16713. unset($this->config[$property]);
  16714. return false;
  16715. }
  16716. return true;
  16717. }
  16718. private function validateFlatArray($property, $regex = null, $mandatory = false)
  16719. {
  16720. if (!$this->validateArray($property, $mandatory)) {
  16721. return false;
  16722. }
  16723. $pass = true;
  16724. foreach ($this->config[$property] as $key => $value) {
  16725. if (!is_string($value) && !is_numeric($value)) {
  16726. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  16727. unset($this->config[$property][$key]);
  16728. $pass = false;
  16729. continue;
  16730. }
  16731. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  16732. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  16733. unset($this->config[$property][$key]);
  16734. $pass = false;
  16735. }
  16736. }
  16737. return $pass;
  16738. }
  16739. private function validateUrl($property, $mandatory = false)
  16740. {
  16741. if (!$this->validateString($property, $mandatory)) {
  16742. return false;
  16743. }
  16744. if (!$this->filterUrl($this->config[$property])) {
  16745. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  16746. unset($this->config[$property]);
  16747. return false;
  16748. }
  16749. return true;
  16750. }
  16751. private function filterUrl($value, array $schemes = array('http', 'https'))
  16752. {
  16753. if ($value === '') {
  16754. return true;
  16755. }
  16756. $bits = parse_url($value);
  16757. if (empty($bits['scheme']) || empty($bits['host'])) {
  16758. return false;
  16759. }
  16760. if (!in_array($bits['scheme'], $schemes, true)) {
  16761. return false;
  16762. }
  16763. return true;
  16764. }
  16765. }
  16766. <?php
  16767. namespace Composer\Package;
  16768. use Composer\Json\JsonFile;
  16769. use Composer\Installer\InstallationManager;
  16770. use Composer\Repository\RepositoryManager;
  16771. use Composer\Util\ProcessExecutor;
  16772. use Composer\Repository\ArrayRepository;
  16773. use Composer\Package\Dumper\ArrayDumper;
  16774. use Composer\Package\Loader\ArrayLoader;
  16775. use Composer\Util\Git as GitUtil;
  16776. use Composer\IO\IOInterface;
  16777. use Seld\JsonLint\ParsingException;
  16778. class Locker
  16779. {
  16780. private $lockFile;
  16781. private $repositoryManager;
  16782. private $installationManager;
  16783. private $hash;
  16784. private $contentHash;
  16785. private $loader;
  16786. private $dumper;
  16787. private $process;
  16788. private $lockDataCache;
  16789. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  16790. {
  16791. $this->lockFile = $lockFile;
  16792. $this->repositoryManager = $repositoryManager;
  16793. $this->installationManager = $installationManager;
  16794. $this->hash = md5($composerFileContents);
  16795. $this->contentHash = self::getContentHash($composerFileContents);
  16796. $this->loader = new ArrayLoader(null, true);
  16797. $this->dumper = new ArrayDumper();
  16798. $this->process = new ProcessExecutor($io);
  16799. }
  16800. public static function getContentHash($composerFileContents)
  16801. {
  16802. $content = json_decode($composerFileContents, true);
  16803. $relevantKeys = array(
  16804. 'name',
  16805. 'version',
  16806. 'require',
  16807. 'require-dev',
  16808. 'conflict',
  16809. 'replace',
  16810. 'provide',
  16811. 'minimum-stability',
  16812. 'prefer-stable',
  16813. 'repositories',
  16814. 'extra',
  16815. );
  16816. $relevantContent = array();
  16817. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  16818. $relevantContent[$key] = $content[$key];
  16819. }
  16820. if (isset($content['config']['platform'])) {
  16821. $relevantContent['config']['platform'] = $content['config']['platform'];
  16822. }
  16823. ksort($relevantContent);
  16824. return md5(json_encode($relevantContent));
  16825. }
  16826. public function isLocked()
  16827. {
  16828. if (!$this->lockFile->exists()) {
  16829. return false;
  16830. }
  16831. $data = $this->getLockData();
  16832. return isset($data['packages']);
  16833. }
  16834. public function isFresh()
  16835. {
  16836. $lock = $this->lockFile->read();
  16837. if (!empty($lock['content-hash'])) {
  16838. return $this->contentHash === $lock['content-hash'];
  16839. }
  16840. if (!empty($lock['hash'])) {
  16841. return $this->hash === $lock['hash'];
  16842. }
  16843. return false;
  16844. }
  16845. public function getLockedRepository($withDevReqs = false)
  16846. {
  16847. $lockData = $this->getLockData();
  16848. $packages = new ArrayRepository();
  16849. $lockedPackages = $lockData['packages'];
  16850. if ($withDevReqs) {
  16851. if (isset($lockData['packages-dev'])) {
  16852. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  16853. } else {
  16854. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  16855. }
  16856. }
  16857. if (empty($lockedPackages)) {
  16858. return $packages;
  16859. }
  16860. if (isset($lockedPackages[0]['name'])) {
  16861. foreach ($lockedPackages as $info) {
  16862. $packages->addPackage($this->loader->load($info));
  16863. }
  16864. return $packages;
  16865. }
  16866. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  16867. }
  16868. public function getPlatformRequirements($withDevReqs = false)
  16869. {
  16870. $lockData = $this->getLockData();
  16871. $requirements = array();
  16872. if (!empty($lockData['platform'])) {
  16873. $requirements = $this->loader->parseLinks(
  16874. '__ROOT__',
  16875. '1.0.0',
  16876. 'requires',
  16877. isset($lockData['platform']) ? $lockData['platform'] : array()
  16878. );
  16879. }
  16880. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  16881. $devRequirements = $this->loader->parseLinks(
  16882. '__ROOT__',
  16883. '1.0.0',
  16884. 'requires',
  16885. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  16886. );
  16887. $requirements = array_merge($requirements, $devRequirements);
  16888. }
  16889. return $requirements;
  16890. }
  16891. public function getMinimumStability()
  16892. {
  16893. $lockData = $this->getLockData();
  16894. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  16895. }
  16896. public function getStabilityFlags()
  16897. {
  16898. $lockData = $this->getLockData();
  16899. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  16900. }
  16901. public function getPreferStable()
  16902. {
  16903. $lockData = $this->getLockData();
  16904. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  16905. }
  16906. public function getPreferLowest()
  16907. {
  16908. $lockData = $this->getLockData();
  16909. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  16910. }
  16911. public function getPlatformOverrides()
  16912. {
  16913. $lockData = $this->getLockData();
  16914. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  16915. }
  16916. public function getAliases()
  16917. {
  16918. $lockData = $this->getLockData();
  16919. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  16920. }
  16921. public function getLockData()
  16922. {
  16923. if (null !== $this->lockDataCache) {
  16924. return $this->lockDataCache;
  16925. }
  16926. if (!$this->lockFile->exists()) {
  16927. throw new \LogicException('No lockfile found. Unable to read locked packages');
  16928. }
  16929. return $this->lockDataCache = $this->lockFile->read();
  16930. }
  16931. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  16932. {
  16933. $lock = array(
  16934. '_readme' => array('This file locks the dependencies of your project to a known state',
  16935. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
  16936. 'This file is @gener'.'ated automatically', ),
  16937. 'content-hash' => $this->contentHash,
  16938. 'packages' => null,
  16939. 'packages-dev' => null,
  16940. 'aliases' => array(),
  16941. 'minimum-stability' => $minimumStability,
  16942. 'stability-flags' => $stabilityFlags,
  16943. 'prefer-stable' => $preferStable,
  16944. 'prefer-lowest' => $preferLowest,
  16945. );
  16946. foreach ($aliases as $package => $versions) {
  16947. foreach ($versions as $version => $alias) {
  16948. $lock['aliases'][] = array(
  16949. 'alias' => $alias['alias'],
  16950. 'alias_normalized' => $alias['alias_normalized'],
  16951. 'version' => $version,
  16952. 'package' => $package,
  16953. );
  16954. }
  16955. }
  16956. $lock['packages'] = $this->lockPackages($packages);
  16957. if (null !== $devPackages) {
  16958. $lock['packages-dev'] = $this->lockPackages($devPackages);
  16959. }
  16960. $lock['platform'] = $platformReqs;
  16961. $lock['platform-dev'] = $platformDevReqs;
  16962. if ($platformOverrides) {
  16963. $lock['platform-overrides'] = $platformOverrides;
  16964. }
  16965. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  16966. if ($this->lockFile->exists()) {
  16967. unlink($this->lockFile->getPath());
  16968. }
  16969. return false;
  16970. }
  16971. try {
  16972. $isLocked = $this->isLocked();
  16973. } catch (ParsingException $e) {
  16974. $isLocked = false;
  16975. }
  16976. if (!$isLocked || $lock !== $this->getLockData()) {
  16977. $this->lockFile->write($lock);
  16978. $this->lockDataCache = null;
  16979. return true;
  16980. }
  16981. return false;
  16982. }
  16983. private function lockPackages(array $packages)
  16984. {
  16985. $locked = array();
  16986. foreach ($packages as $package) {
  16987. if ($package instanceof AliasPackage) {
  16988. continue;
  16989. }
  16990. $name = $package->getPrettyName();
  16991. $version = $package->getPrettyVersion();
  16992. if (!$name || !$version) {
  16993. throw new \LogicException(sprintf(
  16994. 'Package "%s" has no version or name and can not be locked', $package
  16995. ));
  16996. }
  16997. $spec = $this->dumper->dump($package);
  16998. unset($spec['version_normalized']);
  16999. $time = isset($spec['time']) ? $spec['time'] : null;
  17000. unset($spec['time']);
  17001. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  17002. $time = $this->getPackageTime($package) ?: $time;
  17003. }
  17004. if (null !== $time) {
  17005. $spec['time'] = $time;
  17006. }
  17007. unset($spec['installation-source']);
  17008. $locked[] = $spec;
  17009. }
  17010. usort($locked, function ($a, $b) {
  17011. $comparison = strcmp($a['name'], $b['name']);
  17012. if (0 !== $comparison) {
  17013. return $comparison;
  17014. }
  17015. return strcmp($a['version'], $b['version']);
  17016. });
  17017. return $locked;
  17018. }
  17019. private function getPackageTime(PackageInterface $package)
  17020. {
  17021. if (!function_exists('proc_open')) {
  17022. return null;
  17023. }
  17024. $path = realpath($this->installationManager->getInstallPath($package));
  17025. $sourceType = $package->getSourceType();
  17026. $datetime = null;
  17027. if ($path && in_array($sourceType, array('git', 'hg'))) {
  17028. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  17029. switch ($sourceType) {
  17030. case 'git':
  17031. GitUtil::cleanEnv();
  17032. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  17033. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  17034. }
  17035. break;
  17036. case 'hg':
  17037. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  17038. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  17039. }
  17040. break;
  17041. }
  17042. }
  17043. return $datetime ? $datetime->format('Y-m-d H:i:s') : null;
  17044. }
  17045. }
  17046. <?php
  17047. namespace Composer\Package;
  17048. use Composer\Package\Version\VersionParser;
  17049. use Composer\Util\ComposerMirror;
  17050. class Package extends BasePackage
  17051. {
  17052. protected $type;
  17053. protected $targetDir;
  17054. protected $installationSource;
  17055. protected $sourceType;
  17056. protected $sourceUrl;
  17057. protected $sourceReference;
  17058. protected $sourceMirrors;
  17059. protected $distType;
  17060. protected $distUrl;
  17061. protected $distReference;
  17062. protected $distSha1Checksum;
  17063. protected $distMirrors;
  17064. protected $version;
  17065. protected $prettyVersion;
  17066. protected $releaseDate;
  17067. protected $extra = array();
  17068. protected $binaries = array();
  17069. protected $dev;
  17070. protected $stability;
  17071. protected $notificationUrl;
  17072. protected $requires = array();
  17073. protected $conflicts = array();
  17074. protected $provides = array();
  17075. protected $replaces = array();
  17076. protected $devRequires = array();
  17077. protected $suggests = array();
  17078. protected $autoload = array();
  17079. protected $devAutoload = array();
  17080. protected $includePaths = array();
  17081. protected $archiveExcludes = array();
  17082. public function __construct($name, $version, $prettyVersion)
  17083. {
  17084. parent::__construct($name);
  17085. $this->version = $version;
  17086. $this->prettyVersion = $prettyVersion;
  17087. $this->stability = VersionParser::parseStability($version);
  17088. $this->dev = $this->stability === 'dev';
  17089. }
  17090. public function isDev()
  17091. {
  17092. return $this->dev;
  17093. }
  17094. public function setType($type)
  17095. {
  17096. $this->type = $type;
  17097. }
  17098. public function getType()
  17099. {
  17100. return $this->type ?: 'library';
  17101. }
  17102. public function getStability()
  17103. {
  17104. return $this->stability;
  17105. }
  17106. public function setTargetDir($targetDir)
  17107. {
  17108. $this->targetDir = $targetDir;
  17109. }
  17110. public function getTargetDir()
  17111. {
  17112. if (null === $this->targetDir) {
  17113. return;
  17114. }
  17115. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  17116. }
  17117. public function setExtra(array $extra)
  17118. {
  17119. $this->extra = $extra;
  17120. }
  17121. public function getExtra()
  17122. {
  17123. return $this->extra;
  17124. }
  17125. public function setBinaries(array $binaries)
  17126. {
  17127. $this->binaries = $binaries;
  17128. }
  17129. public function getBinaries()
  17130. {
  17131. return $this->binaries;
  17132. }
  17133. public function setInstallationSource($type)
  17134. {
  17135. $this->installationSource = $type;
  17136. }
  17137. public function getInstallationSource()
  17138. {
  17139. return $this->installationSource;
  17140. }
  17141. public function setSourceType($type)
  17142. {
  17143. $this->sourceType = $type;
  17144. }
  17145. public function getSourceType()
  17146. {
  17147. return $this->sourceType;
  17148. }
  17149. public function setSourceUrl($url)
  17150. {
  17151. $this->sourceUrl = $url;
  17152. }
  17153. public function getSourceUrl()
  17154. {
  17155. return $this->sourceUrl;
  17156. }
  17157. public function setSourceReference($reference)
  17158. {
  17159. $this->sourceReference = $reference;
  17160. }
  17161. public function getSourceReference()
  17162. {
  17163. return $this->sourceReference;
  17164. }
  17165. public function setSourceMirrors($mirrors)
  17166. {
  17167. $this->sourceMirrors = $mirrors;
  17168. }
  17169. public function getSourceMirrors()
  17170. {
  17171. return $this->sourceMirrors;
  17172. }
  17173. public function getSourceUrls()
  17174. {
  17175. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  17176. }
  17177. public function setDistType($type)
  17178. {
  17179. $this->distType = $type;
  17180. }
  17181. public function getDistType()
  17182. {
  17183. return $this->distType;
  17184. }
  17185. public function setDistUrl($url)
  17186. {
  17187. $this->distUrl = $url;
  17188. }
  17189. public function getDistUrl()
  17190. {
  17191. return $this->distUrl;
  17192. }
  17193. public function setDistReference($reference)
  17194. {
  17195. $this->distReference = $reference;
  17196. }
  17197. public function getDistReference()
  17198. {
  17199. return $this->distReference;
  17200. }
  17201. public function setDistSha1Checksum($sha1checksum)
  17202. {
  17203. $this->distSha1Checksum = $sha1checksum;
  17204. }
  17205. public function getDistSha1Checksum()
  17206. {
  17207. return $this->distSha1Checksum;
  17208. }
  17209. public function setDistMirrors($mirrors)
  17210. {
  17211. $this->distMirrors = $mirrors;
  17212. }
  17213. public function getDistMirrors()
  17214. {
  17215. return $this->distMirrors;
  17216. }
  17217. public function getDistUrls()
  17218. {
  17219. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  17220. }
  17221. public function getVersion()
  17222. {
  17223. return $this->version;
  17224. }
  17225. public function getPrettyVersion()
  17226. {
  17227. return $this->prettyVersion;
  17228. }
  17229. public function setReleaseDate(\DateTime $releaseDate)
  17230. {
  17231. $this->releaseDate = $releaseDate;
  17232. }
  17233. public function getReleaseDate()
  17234. {
  17235. return $this->releaseDate;
  17236. }
  17237. public function setRequires(array $requires)
  17238. {
  17239. $this->requires = $requires;
  17240. }
  17241. public function getRequires()
  17242. {
  17243. return $this->requires;
  17244. }
  17245. public function setConflicts(array $conflicts)
  17246. {
  17247. $this->conflicts = $conflicts;
  17248. }
  17249. public function getConflicts()
  17250. {
  17251. return $this->conflicts;
  17252. }
  17253. public function setProvides(array $provides)
  17254. {
  17255. $this->provides = $provides;
  17256. }
  17257. public function getProvides()
  17258. {
  17259. return $this->provides;
  17260. }
  17261. public function setReplaces(array $replaces)
  17262. {
  17263. $this->replaces = $replaces;
  17264. }
  17265. public function getReplaces()
  17266. {
  17267. return $this->replaces;
  17268. }
  17269. public function setDevRequires(array $devRequires)
  17270. {
  17271. $this->devRequires = $devRequires;
  17272. }
  17273. public function getDevRequires()
  17274. {
  17275. return $this->devRequires;
  17276. }
  17277. public function setSuggests(array $suggests)
  17278. {
  17279. $this->suggests = $suggests;
  17280. }
  17281. public function getSuggests()
  17282. {
  17283. return $this->suggests;
  17284. }
  17285. public function setAutoload(array $autoload)
  17286. {
  17287. $this->autoload = $autoload;
  17288. }
  17289. public function getAutoload()
  17290. {
  17291. return $this->autoload;
  17292. }
  17293. public function setDevAutoload(array $devAutoload)
  17294. {
  17295. $this->devAutoload = $devAutoload;
  17296. }
  17297. public function getDevAutoload()
  17298. {
  17299. return $this->devAutoload;
  17300. }
  17301. public function setIncludePaths(array $includePaths)
  17302. {
  17303. $this->includePaths = $includePaths;
  17304. }
  17305. public function getIncludePaths()
  17306. {
  17307. return $this->includePaths;
  17308. }
  17309. public function setNotificationUrl($notificationUrl)
  17310. {
  17311. $this->notificationUrl = $notificationUrl;
  17312. }
  17313. public function getNotificationUrl()
  17314. {
  17315. return $this->notificationUrl;
  17316. }
  17317. public function setArchiveExcludes(array $excludes)
  17318. {
  17319. $this->archiveExcludes = $excludes;
  17320. }
  17321. public function getArchiveExcludes()
  17322. {
  17323. return $this->archiveExcludes;
  17324. }
  17325. public function replaceVersion($version, $prettyVersion)
  17326. {
  17327. $this->version = $version;
  17328. $this->prettyVersion = $prettyVersion;
  17329. $this->stability = VersionParser::parseStability($version);
  17330. $this->dev = $this->stability === 'dev';
  17331. }
  17332. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  17333. {
  17334. if (!$url) {
  17335. return array();
  17336. }
  17337. $urls = array($url);
  17338. if ($mirrors) {
  17339. foreach ($mirrors as $mirror) {
  17340. if ($urlType === 'dist') {
  17341. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  17342. } elseif ($urlType === 'source' && $type === 'git') {
  17343. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  17344. } elseif ($urlType === 'source' && $type === 'hg') {
  17345. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  17346. }
  17347. if (!in_array($mirrorUrl, $urls)) {
  17348. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  17349. $func($urls, $mirrorUrl);
  17350. }
  17351. }
  17352. }
  17353. return $urls;
  17354. }
  17355. }
  17356. <?php
  17357. namespace Composer\Package;
  17358. use Composer\Repository\RepositoryInterface;
  17359. interface PackageInterface
  17360. {
  17361. public function getName();
  17362. public function getPrettyName();
  17363. public function getNames();
  17364. public function setId($id);
  17365. public function getId();
  17366. public function isDev();
  17367. public function getType();
  17368. public function getTargetDir();
  17369. public function getExtra();
  17370. public function setInstallationSource($type);
  17371. public function getInstallationSource();
  17372. public function getSourceType();
  17373. public function getSourceUrl();
  17374. public function getSourceUrls();
  17375. public function getSourceReference();
  17376. public function getSourceMirrors();
  17377. public function getDistType();
  17378. public function getDistUrl();
  17379. public function getDistUrls();
  17380. public function getDistReference();
  17381. public function getDistSha1Checksum();
  17382. public function getDistMirrors();
  17383. public function getVersion();
  17384. public function getPrettyVersion();
  17385. public function getFullPrettyVersion($truncate = true);
  17386. public function getReleaseDate();
  17387. public function getStability();
  17388. public function getRequires();
  17389. public function getConflicts();
  17390. public function getProvides();
  17391. public function getReplaces();
  17392. public function getDevRequires();
  17393. public function getSuggests();
  17394. public function getAutoload();
  17395. public function getDevAutoload();
  17396. public function getIncludePaths();
  17397. public function setRepository(RepositoryInterface $repository);
  17398. public function getRepository();
  17399. public function getBinaries();
  17400. public function getUniqueName();
  17401. public function getNotificationUrl();
  17402. public function __toString();
  17403. public function getPrettyString();
  17404. public function getArchiveExcludes();
  17405. public function getTransportOptions();
  17406. }
  17407. <?php
  17408. namespace Composer\Package;
  17409. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  17410. {
  17411. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  17412. {
  17413. parent::__construct($aliasOf, $version, $prettyVersion);
  17414. }
  17415. public function getAliases()
  17416. {
  17417. return $this->aliasOf->getAliases();
  17418. }
  17419. public function getMinimumStability()
  17420. {
  17421. return $this->aliasOf->getMinimumStability();
  17422. }
  17423. public function getStabilityFlags()
  17424. {
  17425. return $this->aliasOf->getStabilityFlags();
  17426. }
  17427. public function getReferences()
  17428. {
  17429. return $this->aliasOf->getReferences();
  17430. }
  17431. public function getPreferStable()
  17432. {
  17433. return $this->aliasOf->getPreferStable();
  17434. }
  17435. public function getConfig()
  17436. {
  17437. return $this->aliasOf->getConfig();
  17438. }
  17439. public function setRequires(array $require)
  17440. {
  17441. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  17442. $this->aliasOf->setRequires($require);
  17443. }
  17444. public function setDevRequires(array $devRequire)
  17445. {
  17446. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  17447. $this->aliasOf->setDevRequires($devRequire);
  17448. }
  17449. public function setConflicts(array $conflicts)
  17450. {
  17451. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  17452. $this->aliasOf->setConflicts($conflicts);
  17453. }
  17454. public function setProvides(array $provides)
  17455. {
  17456. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  17457. $this->aliasOf->setProvides($provides);
  17458. }
  17459. public function setReplaces(array $replaces)
  17460. {
  17461. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  17462. $this->aliasOf->setReplaces($replaces);
  17463. }
  17464. public function setRepositories($repositories)
  17465. {
  17466. $this->aliasOf->setRepositories($repositories);
  17467. }
  17468. public function setAutoload(array $autoload)
  17469. {
  17470. $this->aliasOf->setAutoload($autoload);
  17471. }
  17472. public function setDevAutoload(array $devAutoload)
  17473. {
  17474. $this->aliasOf->setDevAutoload($devAutoload);
  17475. }
  17476. public function setStabilityFlags(array $stabilityFlags)
  17477. {
  17478. $this->aliasOf->setStabilityFlags($stabilityFlags);
  17479. }
  17480. public function setSuggests(array $suggests)
  17481. {
  17482. $this->aliasOf->setSuggests($suggests);
  17483. }
  17484. public function setExtra(array $extra)
  17485. {
  17486. $this->aliasOf->setExtra($extra);
  17487. }
  17488. public function __clone()
  17489. {
  17490. parent::__clone();
  17491. $this->aliasOf = clone $this->aliasOf;
  17492. }
  17493. }
  17494. <?php
  17495. namespace Composer\Package;
  17496. class RootPackage extends CompletePackage implements RootPackageInterface
  17497. {
  17498. protected $minimumStability = 'stable';
  17499. protected $preferStable = false;
  17500. protected $stabilityFlags = array();
  17501. protected $config = array();
  17502. protected $references = array();
  17503. protected $aliases = array();
  17504. public function setMinimumStability($minimumStability)
  17505. {
  17506. $this->minimumStability = $minimumStability;
  17507. }
  17508. public function getMinimumStability()
  17509. {
  17510. return $this->minimumStability;
  17511. }
  17512. public function setStabilityFlags(array $stabilityFlags)
  17513. {
  17514. $this->stabilityFlags = $stabilityFlags;
  17515. }
  17516. public function getStabilityFlags()
  17517. {
  17518. return $this->stabilityFlags;
  17519. }
  17520. public function setPreferStable($preferStable)
  17521. {
  17522. $this->preferStable = $preferStable;
  17523. }
  17524. public function getPreferStable()
  17525. {
  17526. return $this->preferStable;
  17527. }
  17528. public function setConfig(array $config)
  17529. {
  17530. $this->config = $config;
  17531. }
  17532. public function getConfig()
  17533. {
  17534. return $this->config;
  17535. }
  17536. public function setReferences(array $references)
  17537. {
  17538. $this->references = $references;
  17539. }
  17540. public function getReferences()
  17541. {
  17542. return $this->references;
  17543. }
  17544. public function setAliases(array $aliases)
  17545. {
  17546. $this->aliases = $aliases;
  17547. }
  17548. public function getAliases()
  17549. {
  17550. return $this->aliases;
  17551. }
  17552. }
  17553. <?php
  17554. namespace Composer\Package;
  17555. interface RootPackageInterface extends CompletePackageInterface
  17556. {
  17557. public function getAliases();
  17558. public function getMinimumStability();
  17559. public function getStabilityFlags();
  17560. public function getReferences();
  17561. public function getPreferStable();
  17562. public function getConfig();
  17563. public function setRequires(array $requires);
  17564. public function setDevRequires(array $devRequires);
  17565. public function setConflicts(array $conflicts);
  17566. public function setProvides(array $provides);
  17567. public function setReplaces(array $replaces);
  17568. public function setRepositories($repositories);
  17569. public function setAutoload(array $autoload);
  17570. public function setDevAutoload(array $devAutoload);
  17571. public function setStabilityFlags(array $stabilityFlags);
  17572. public function setSuggests(array $suggests);
  17573. public function setExtra(array $extra);
  17574. }
  17575. <?php
  17576. namespace Composer\Package\Version;
  17577. use Composer\Config;
  17578. use Composer\Repository\Vcs\HgDriver;
  17579. use Composer\IO\NullIO;
  17580. use Composer\Semver\VersionParser as SemverVersionParser;
  17581. use Composer\Util\Git as GitUtil;
  17582. use Composer\Util\ProcessExecutor;
  17583. use Composer\Util\Svn as SvnUtil;
  17584. class VersionGuesser
  17585. {
  17586. private $config;
  17587. private $process;
  17588. private $versionParser;
  17589. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  17590. {
  17591. $this->config = $config;
  17592. $this->process = $process;
  17593. $this->versionParser = $versionParser;
  17594. }
  17595. public function guessVersion(array $packageConfig, $path)
  17596. {
  17597. if (function_exists('proc_open')) {
  17598. $versionData = $this->guessGitVersion($packageConfig, $path);
  17599. if (null !== $versionData) {
  17600. return $versionData;
  17601. }
  17602. $versionData = $this->guessHgVersion($packageConfig, $path);
  17603. if (null !== $versionData) {
  17604. return $versionData;
  17605. }
  17606. $versionData = $this->guessFossilVersion($packageConfig, $path);
  17607. if (null !== $versionData) {
  17608. return $versionData;
  17609. }
  17610. return $this->guessSvnVersion($packageConfig, $path);
  17611. }
  17612. }
  17613. private function guessGitVersion(array $packageConfig, $path)
  17614. {
  17615. GitUtil::cleanEnv();
  17616. $commit = null;
  17617. $version = null;
  17618. $prettyVersion = null;
  17619. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  17620. $branches = array();
  17621. $isFeatureBranch = false;
  17622. foreach ($this->process->splitLines($output) as $branch) {
  17623. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at FETCH_HEAD\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  17624. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  17625. $version = 'dev-' . $match[2];
  17626. $prettyVersion = $version;
  17627. $isFeatureBranch = true;
  17628. } else {
  17629. $version = $this->versionParser->normalizeBranch($match[1]);
  17630. $prettyVersion = 'dev-' . $match[1];
  17631. $isFeatureBranch = 0 === strpos($version, 'dev-');
  17632. if ('9999999-dev' === $version) {
  17633. $version = $prettyVersion;
  17634. }
  17635. }
  17636. if ($match[2]) {
  17637. $commit = $match[2];
  17638. }
  17639. }
  17640. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  17641. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  17642. $branches[] = $match[1];
  17643. }
  17644. }
  17645. }
  17646. if ($isFeatureBranch) {
  17647. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  17648. $version = $result['version'];
  17649. $prettyVersion = $result['pretty_version'];
  17650. }
  17651. }
  17652. if (!$version) {
  17653. $result = $this->versionFromGitTags($path);
  17654. if ($result) {
  17655. $version = $result['version'];
  17656. $prettyVersion = $result['pretty_version'];
  17657. }
  17658. }
  17659. if (!$commit) {
  17660. $command = 'git log --pretty="%H" -n1 HEAD';
  17661. if (0 === $this->process->execute($command, $output, $path)) {
  17662. $commit = trim($output) ?: null;
  17663. }
  17664. }
  17665. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  17666. }
  17667. private function versionFromGitTags($path)
  17668. {
  17669. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  17670. try {
  17671. $version = $this->versionParser->normalize(trim($output));
  17672. return array('version' => $version, 'pretty_version' => trim($output));
  17673. } catch (\Exception $e) {
  17674. }
  17675. }
  17676. return null;
  17677. }
  17678. private function guessHgVersion(array $packageConfig, $path)
  17679. {
  17680. if (0 === $this->process->execute('hg branch', $output, $path)) {
  17681. $branch = trim($output);
  17682. $version = $this->versionParser->normalizeBranch($branch);
  17683. $isFeatureBranch = 0 === strpos($version, 'dev-');
  17684. if ('9999999-dev' === $version) {
  17685. $version = 'dev-' . $branch;
  17686. }
  17687. if (!$isFeatureBranch) {
  17688. return $version;
  17689. }
  17690. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  17691. $branches = array_keys($driver->getBranches());
  17692. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  17693. $result['commit'] = '';
  17694. return $result;
  17695. }
  17696. }
  17697. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  17698. {
  17699. $prettyVersion = $version;
  17700. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  17701. || strpos(json_encode($packageConfig), '"self.version"')
  17702. ) {
  17703. $branch = preg_replace('{^dev-}', '', $version);
  17704. $length = PHP_INT_MAX;
  17705. $nonFeatureBranches = '';
  17706. if (!empty($packageConfig['non-feature-branches'])) {
  17707. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  17708. }
  17709. foreach ($branches as $candidate) {
  17710. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  17711. break;
  17712. }
  17713. if ($candidate === $branch || !preg_match('{^(master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  17714. continue;
  17715. }
  17716. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  17717. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  17718. continue;
  17719. }
  17720. if (strlen($output) < $length) {
  17721. $length = strlen($output);
  17722. $version = $this->versionParser->normalizeBranch($candidate);
  17723. $prettyVersion = 'dev-' . $match[1];
  17724. if ('9999999-dev' === $version) {
  17725. $version = $prettyVersion;
  17726. }
  17727. }
  17728. }
  17729. }
  17730. return array('version' => $version, 'pretty_version' => $prettyVersion);
  17731. }
  17732. private function guessFossilVersion(array $packageConfig, $path)
  17733. {
  17734. $version = null;
  17735. $prettyVersion = null;
  17736. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  17737. $branch = trim($output);
  17738. $version = $this->versionParser->normalizeBranch($branch);
  17739. $prettyVersion = 'dev-' . $branch;
  17740. if ('9999999-dev' === $version) {
  17741. $version = $prettyVersion;
  17742. }
  17743. }
  17744. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  17745. try {
  17746. $version = $this->versionParser->normalize(trim($output));
  17747. $prettyVersion = trim($output);
  17748. } catch (\Exception $e) {
  17749. }
  17750. }
  17751. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  17752. }
  17753. private function guessSvnVersion(array $packageConfig, $path)
  17754. {
  17755. SvnUtil::cleanEnv();
  17756. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  17757. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  17758. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  17759. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  17760. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  17761. if (preg_match($urlPattern, $output, $matches)) {
  17762. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  17763. $version = $this->versionParser->normalizeBranch($matches[3]);
  17764. $prettyVersion = 'dev-' . $matches[3];
  17765. if ('9999999-dev' === $version) {
  17766. $version = $prettyVersion;
  17767. }
  17768. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  17769. }
  17770. $prettyVersion = trim($matches[1]);
  17771. $version = $this->versionParser->normalize($prettyVersion);
  17772. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  17773. }
  17774. }
  17775. }
  17776. }
  17777. <?php
  17778. namespace Composer\Package\Version;
  17779. use Composer\Semver\VersionParser as SemverVersionParser;
  17780. class VersionParser extends SemverVersionParser
  17781. {
  17782. private static $constraints = array();
  17783. public function parseConstraints($constraints)
  17784. {
  17785. if (!isset(self::$constraints[$constraints])) {
  17786. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  17787. }
  17788. return self::$constraints[$constraints];
  17789. }
  17790. public function parseNameVersionPairs(array $pairs)
  17791. {
  17792. $pairs = array_values($pairs);
  17793. $result = array();
  17794. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  17795. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  17796. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/')) {
  17797. $pair .= ' '.$pairs[$i + 1];
  17798. $i++;
  17799. }
  17800. if (strpos($pair, ' ')) {
  17801. list($name, $version) = explode(" ", $pair, 2);
  17802. $result[] = array('name' => $name, 'version' => $version);
  17803. } else {
  17804. $result[] = array('name' => $pair);
  17805. }
  17806. }
  17807. return $result;
  17808. }
  17809. }
  17810. <?php
  17811. namespace Composer\Package\Version;
  17812. use Composer\DependencyResolver\Pool;
  17813. use Composer\Package\BasePackage;
  17814. use Composer\Package\PackageInterface;
  17815. use Composer\Package\Loader\ArrayLoader;
  17816. use Composer\Package\Dumper\ArrayDumper;
  17817. use Composer\Semver\Constraint\Constraint;
  17818. class VersionSelector
  17819. {
  17820. private $pool;
  17821. private $parser;
  17822. public function __construct(Pool $pool)
  17823. {
  17824. $this->pool = $pool;
  17825. }
  17826. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  17827. {
  17828. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  17829. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  17830. if ($targetPhpVersion) {
  17831. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  17832. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  17833. $reqs = $pkg->getRequires();
  17834. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  17835. });
  17836. }
  17837. if (!$candidates) {
  17838. return false;
  17839. }
  17840. $package = reset($candidates);
  17841. $minPriority = BasePackage::$stabilities[$preferredStability];
  17842. foreach ($candidates as $candidate) {
  17843. $candidatePriority = $candidate->getStabilityPriority();
  17844. $currentPriority = $package->getStabilityPriority();
  17845. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  17846. continue;
  17847. }
  17848. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  17849. $package = $candidate;
  17850. continue;
  17851. }
  17852. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  17853. $package = $candidate;
  17854. continue;
  17855. }
  17856. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  17857. $package = $candidate;
  17858. }
  17859. }
  17860. return $package;
  17861. }
  17862. public function findRecommendedRequireVersion(PackageInterface $package)
  17863. {
  17864. $version = $package->getVersion();
  17865. if (!$package->isDev()) {
  17866. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  17867. }
  17868. $loader = new ArrayLoader($this->getParser());
  17869. $dumper = new ArrayDumper();
  17870. $extra = $loader->getBranchAlias($dumper->dump($package));
  17871. if ($extra) {
  17872. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  17873. if ($count) {
  17874. $extra = str_replace('.9999999', '.0', $extra);
  17875. return $this->transformVersion($extra, $extra, 'dev');
  17876. }
  17877. }
  17878. return $package->getPrettyVersion();
  17879. }
  17880. private function transformVersion($version, $prettyVersion, $stability)
  17881. {
  17882. $semanticVersionParts = explode('.', $version);
  17883. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  17884. if ($semanticVersionParts[0] === '0') {
  17885. unset($semanticVersionParts[3]);
  17886. } else {
  17887. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  17888. }
  17889. $version = implode('.', $semanticVersionParts);
  17890. } else {
  17891. return $prettyVersion;
  17892. }
  17893. if ($stability != 'stable') {
  17894. $version .= '@'.$stability;
  17895. }
  17896. return '^' . $version;
  17897. }
  17898. private function getParser()
  17899. {
  17900. if ($this->parser === null) {
  17901. $this->parser = new VersionParser();
  17902. }
  17903. return $this->parser;
  17904. }
  17905. }
  17906. <?php
  17907. namespace Composer\Plugin\Capability;
  17908. interface Capability
  17909. {
  17910. }
  17911. <?php
  17912. namespace Composer\Plugin\Capability;
  17913. interface CommandProvider extends Capability
  17914. {
  17915. public function getCommands();
  17916. }
  17917. <?php
  17918. namespace Composer\Plugin;
  17919. interface Capable
  17920. {
  17921. public function getCapabilities();
  17922. }
  17923. <?php
  17924. namespace Composer\Plugin;
  17925. use Composer\EventDispatcher\Event;
  17926. use Symfony\Component\Console\Input\InputInterface;
  17927. use Symfony\Component\Console\Output\OutputInterface;
  17928. class CommandEvent extends Event
  17929. {
  17930. private $commandName;
  17931. private $input;
  17932. private $output;
  17933. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  17934. {
  17935. parent::__construct($name, $args, $flags);
  17936. $this->commandName = $commandName;
  17937. $this->input = $input;
  17938. $this->output = $output;
  17939. }
  17940. public function getInput()
  17941. {
  17942. return $this->input;
  17943. }
  17944. public function getOutput()
  17945. {
  17946. return $this->output;
  17947. }
  17948. public function getCommandName()
  17949. {
  17950. return $this->commandName;
  17951. }
  17952. }
  17953. <?php
  17954. namespace Composer\Plugin;
  17955. class PluginEvents
  17956. {
  17957. const INIT = 'init';
  17958. const COMMAND = 'command';
  17959. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  17960. }
  17961. <?php
  17962. namespace Composer\Plugin;
  17963. use Composer\Composer;
  17964. use Composer\IO\IOInterface;
  17965. interface PluginInterface
  17966. {
  17967. const PLUGIN_API_VERSION = '1.1.0';
  17968. public function activate(Composer $composer, IOInterface $io);
  17969. }
  17970. <?php
  17971. namespace Composer\Plugin;
  17972. use Composer\Composer;
  17973. use Composer\EventDispatcher\EventSubscriberInterface;
  17974. use Composer\IO\IOInterface;
  17975. use Composer\Package\Package;
  17976. use Composer\Package\Version\VersionParser;
  17977. use Composer\Repository\RepositoryInterface;
  17978. use Composer\Package\AliasPackage;
  17979. use Composer\Package\PackageInterface;
  17980. use Composer\Package\Link;
  17981. use Composer\Semver\Constraint\Constraint;
  17982. use Composer\DependencyResolver\Pool;
  17983. use Composer\Plugin\Capability\Capability;
  17984. class PluginManager
  17985. {
  17986. protected $composer;
  17987. protected $io;
  17988. protected $globalComposer;
  17989. protected $versionParser;
  17990. protected $disablePlugins = false;
  17991. protected $plugins = array();
  17992. protected $registeredPlugins = array();
  17993. private static $classCounter = 0;
  17994. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  17995. {
  17996. $this->io = $io;
  17997. $this->composer = $composer;
  17998. $this->globalComposer = $globalComposer;
  17999. $this->versionParser = new VersionParser();
  18000. $this->disablePlugins = $disablePlugins;
  18001. }
  18002. public function loadInstalledPlugins()
  18003. {
  18004. if ($this->disablePlugins) {
  18005. return;
  18006. }
  18007. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  18008. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18009. if ($repo) {
  18010. $this->loadRepository($repo);
  18011. }
  18012. if ($globalRepo) {
  18013. $this->loadRepository($globalRepo);
  18014. }
  18015. }
  18016. public function getPlugins()
  18017. {
  18018. return $this->plugins;
  18019. }
  18020. public function getGlobalComposer()
  18021. {
  18022. return $this->globalComposer;
  18023. }
  18024. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  18025. {
  18026. if ($this->disablePlugins) {
  18027. return;
  18028. }
  18029. if ($package->getType() === 'composer-plugin') {
  18030. $requiresComposer = null;
  18031. foreach ($package->getRequires() as $link) {
  18032. if ('composer-plugin-api' === $link->getTarget()) {
  18033. $requiresComposer = $link->getConstraint();
  18034. break;
  18035. }
  18036. }
  18037. if (!$requiresComposer) {
  18038. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  18039. }
  18040. $currentPluginApiVersion = $this->getPluginApiVersion();
  18041. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  18042. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  18043. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  18044. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  18045. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  18046. return;
  18047. }
  18048. }
  18049. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  18050. if (in_array($package->getName(), $this->registeredPlugins)) {
  18051. return;
  18052. }
  18053. $extra = $package->getExtra();
  18054. if (empty($extra['class'])) {
  18055. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  18056. }
  18057. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  18058. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  18059. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18060. $pool = new Pool('dev');
  18061. $pool->addRepository($localRepo);
  18062. if ($globalRepo) {
  18063. $pool->addRepository($globalRepo);
  18064. }
  18065. $autoloadPackages = array($package->getName() => $package);
  18066. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  18067. $generator = $this->composer->getAutoloadGenerator();
  18068. $autoloads = array();
  18069. foreach ($autoloadPackages as $autoloadPackage) {
  18070. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  18071. $autoloads[] = array($autoloadPackage, $downloadPath);
  18072. }
  18073. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  18074. $classLoader = $generator->createLoader($map);
  18075. $classLoader->register();
  18076. foreach ($classes as $class) {
  18077. if (class_exists($class, false)) {
  18078. $class = trim($class, '\\');
  18079. $path = $classLoader->findFile($class);
  18080. $code = file_get_contents($path);
  18081. $separatorPos = strrpos($class, '\\');
  18082. $className = $class;
  18083. if ($separatorPos) {
  18084. $className = substr($class, $separatorPos + 1);
  18085. }
  18086. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  18087. $code = str_replace('__FILE__', var_export($path, true), $code);
  18088. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  18089. $code = str_replace('__CLASS__', var_export($class, true), $code);
  18090. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  18091. eval($code);
  18092. $class .= '_composer_tmp'.self::$classCounter;
  18093. self::$classCounter++;
  18094. }
  18095. if ($oldInstallerPlugin) {
  18096. $installer = new $class($this->io, $this->composer);
  18097. $this->composer->getInstallationManager()->addInstaller($installer);
  18098. } elseif (class_exists($class)) {
  18099. $plugin = new $class();
  18100. $this->addPlugin($plugin);
  18101. $this->registeredPlugins[] = $package->getName();
  18102. } elseif ($failOnMissingClasses) {
  18103. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  18104. }
  18105. }
  18106. }
  18107. protected function getPluginApiVersion()
  18108. {
  18109. return PluginInterface::PLUGIN_API_VERSION;
  18110. }
  18111. public function addPlugin(PluginInterface $plugin)
  18112. {
  18113. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  18114. $this->plugins[] = $plugin;
  18115. $plugin->activate($this->composer, $this->io);
  18116. if ($plugin instanceof EventSubscriberInterface) {
  18117. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  18118. }
  18119. }
  18120. private function loadRepository(RepositoryInterface $repo)
  18121. {
  18122. foreach ($repo->getPackages() as $package) {
  18123. if ($package instanceof AliasPackage) {
  18124. continue;
  18125. }
  18126. if ('composer-plugin' === $package->getType()) {
  18127. $this->registerPackage($package);
  18128. } elseif ('composer-installer' === $package->getType()) {
  18129. $this->registerPackage($package);
  18130. }
  18131. }
  18132. }
  18133. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  18134. {
  18135. $requires = array_merge(
  18136. $package->getRequires(),
  18137. $package->getDevRequires()
  18138. );
  18139. foreach ($requires as $requireLink) {
  18140. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  18141. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  18142. $collected[$requiredPackage->getName()] = $requiredPackage;
  18143. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  18144. }
  18145. }
  18146. return $collected;
  18147. }
  18148. private function lookupInstalledPackage(Pool $pool, Link $link)
  18149. {
  18150. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  18151. return (!empty($packages)) ? $packages[0] : null;
  18152. }
  18153. private function getInstallPath(PackageInterface $package, $global = false)
  18154. {
  18155. if (!$global) {
  18156. return $this->composer->getInstallationManager()->getInstallPath($package);
  18157. }
  18158. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  18159. }
  18160. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  18161. {
  18162. if (!($plugin instanceof Capable)) {
  18163. return null;
  18164. }
  18165. $capabilities = (array) $plugin->getCapabilities();
  18166. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  18167. return trim($capabilities[$capability]);
  18168. }
  18169. if (
  18170. array_key_exists($capability, $capabilities)
  18171. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  18172. ) {
  18173. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  18174. }
  18175. }
  18176. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  18177. {
  18178. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  18179. if (!class_exists($capabilityClass)) {
  18180. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  18181. }
  18182. $ctorArgs['plugin'] = $plugin;
  18183. $capabilityObj = new $capabilityClass($ctorArgs);
  18184. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  18185. throw new \RuntimeException(
  18186. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  18187. );
  18188. }
  18189. return $capabilityObj;
  18190. }
  18191. }
  18192. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  18193. {
  18194. $capabilities = array();
  18195. foreach ($this->getPlugins() as $plugin) {
  18196. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  18197. $capabilities[] = $capability;
  18198. }
  18199. }
  18200. return $capabilities;
  18201. }
  18202. }
  18203. <?php
  18204. namespace Composer\Plugin;
  18205. use Composer\EventDispatcher\Event;
  18206. use Composer\Util\RemoteFilesystem;
  18207. class PreFileDownloadEvent extends Event
  18208. {
  18209. private $rfs;
  18210. private $processedUrl;
  18211. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  18212. {
  18213. parent::__construct($name);
  18214. $this->rfs = $rfs;
  18215. $this->processedUrl = $processedUrl;
  18216. }
  18217. public function getRemoteFilesystem()
  18218. {
  18219. return $this->rfs;
  18220. }
  18221. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  18222. {
  18223. $this->rfs = $rfs;
  18224. }
  18225. public function getProcessedUrl()
  18226. {
  18227. return $this->processedUrl;
  18228. }
  18229. }
  18230. <?php
  18231. namespace Composer\Repository;
  18232. use Composer\Package\AliasPackage;
  18233. use Composer\Package\PackageInterface;
  18234. use Composer\Package\CompletePackageInterface;
  18235. use Composer\Package\Version\VersionParser;
  18236. use Composer\Semver\Constraint\ConstraintInterface;
  18237. use Composer\Semver\Constraint\Constraint;
  18238. class ArrayRepository extends BaseRepository
  18239. {
  18240. protected $packages;
  18241. public function __construct(array $packages = array())
  18242. {
  18243. foreach ($packages as $package) {
  18244. $this->addPackage($package);
  18245. }
  18246. }
  18247. public function findPackage($name, $constraint)
  18248. {
  18249. $name = strtolower($name);
  18250. if (!$constraint instanceof ConstraintInterface) {
  18251. $versionParser = new VersionParser();
  18252. $constraint = $versionParser->parseConstraints($constraint);
  18253. }
  18254. foreach ($this->getPackages() as $package) {
  18255. if ($name === $package->getName()) {
  18256. $pkgConstraint = new Constraint('==', $package->getVersion());
  18257. if ($constraint->matches($pkgConstraint)) {
  18258. return $package;
  18259. }
  18260. }
  18261. }
  18262. return null;
  18263. }
  18264. public function findPackages($name, $constraint = null)
  18265. {
  18266. $name = strtolower($name);
  18267. $packages = array();
  18268. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  18269. $versionParser = new VersionParser();
  18270. $constraint = $versionParser->parseConstraints($constraint);
  18271. }
  18272. foreach ($this->getPackages() as $package) {
  18273. if ($name === $package->getName()) {
  18274. $pkgConstraint = new Constraint('==', $package->getVersion());
  18275. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  18276. $packages[] = $package;
  18277. }
  18278. }
  18279. }
  18280. return $packages;
  18281. }
  18282. public function search($query, $mode = 0, $type = null)
  18283. {
  18284. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  18285. $matches = array();
  18286. foreach ($this->getPackages() as $package) {
  18287. $name = $package->getName();
  18288. if (isset($matches[$name])) {
  18289. continue;
  18290. }
  18291. if (preg_match($regex, $name)
  18292. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  18293. ) {
  18294. if (null !== $type && $package->getType() !== $type) {
  18295. continue;
  18296. }
  18297. $matches[$name] = array(
  18298. 'name' => $package->getPrettyName(),
  18299. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  18300. );
  18301. }
  18302. }
  18303. return array_values($matches);
  18304. }
  18305. public function hasPackage(PackageInterface $package)
  18306. {
  18307. $packageId = $package->getUniqueName();
  18308. foreach ($this->getPackages() as $repoPackage) {
  18309. if ($packageId === $repoPackage->getUniqueName()) {
  18310. return true;
  18311. }
  18312. }
  18313. return false;
  18314. }
  18315. public function addPackage(PackageInterface $package)
  18316. {
  18317. if (null === $this->packages) {
  18318. $this->initialize();
  18319. }
  18320. $package->setRepository($this);
  18321. $this->packages[] = $package;
  18322. if ($package instanceof AliasPackage) {
  18323. $aliasedPackage = $package->getAliasOf();
  18324. if (null === $aliasedPackage->getRepository()) {
  18325. $this->addPackage($aliasedPackage);
  18326. }
  18327. }
  18328. }
  18329. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  18330. {
  18331. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  18332. }
  18333. public function removePackage(PackageInterface $package)
  18334. {
  18335. $packageId = $package->getUniqueName();
  18336. foreach ($this->getPackages() as $key => $repoPackage) {
  18337. if ($packageId === $repoPackage->getUniqueName()) {
  18338. array_splice($this->packages, $key, 1);
  18339. return;
  18340. }
  18341. }
  18342. }
  18343. public function getPackages()
  18344. {
  18345. if (null === $this->packages) {
  18346. $this->initialize();
  18347. }
  18348. return $this->packages;
  18349. }
  18350. public function count()
  18351. {
  18352. return count($this->packages);
  18353. }
  18354. protected function initialize()
  18355. {
  18356. $this->packages = array();
  18357. }
  18358. }
  18359. <?php
  18360. namespace Composer\Repository;
  18361. use Composer\IO\IOInterface;
  18362. use Composer\Json\JsonFile;
  18363. use Composer\Package\Loader\ArrayLoader;
  18364. use Composer\Package\Loader\LoaderInterface;
  18365. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18366. {
  18367. protected $loader;
  18368. protected $lookup;
  18369. protected $repoConfig;
  18370. private $io;
  18371. public function __construct(array $repoConfig, IOInterface $io)
  18372. {
  18373. parent::__construct();
  18374. if (!extension_loaded('zip')) {
  18375. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  18376. }
  18377. $this->loader = new ArrayLoader();
  18378. $this->lookup = $repoConfig['url'];
  18379. $this->io = $io;
  18380. $this->repoConfig = $repoConfig;
  18381. }
  18382. public function getRepoConfig()
  18383. {
  18384. return $this->repoConfig;
  18385. }
  18386. protected function initialize()
  18387. {
  18388. parent::initialize();
  18389. $this->scanDirectory($this->lookup);
  18390. }
  18391. private function scanDirectory($path)
  18392. {
  18393. $io = $this->io;
  18394. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  18395. $iterator = new \RecursiveIteratorIterator($directory);
  18396. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  18397. foreach ($regex as $file) {
  18398. if (!$file->isFile()) {
  18399. continue;
  18400. }
  18401. $package = $this->getComposerInformation($file);
  18402. if (!$package) {
  18403. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  18404. continue;
  18405. }
  18406. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  18407. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  18408. $this->addPackage($package);
  18409. }
  18410. }
  18411. private function locateFile(\ZipArchive $zip, $filename)
  18412. {
  18413. $indexOfShortestMatch = false;
  18414. $lengthOfShortestMatch = -1;
  18415. for ($i = 0; $i < $zip->numFiles; $i++) {
  18416. $stat = $zip->statIndex($i);
  18417. if (strcmp(basename($stat['name']), $filename) === 0) {
  18418. $directoryName = dirname($stat['name']);
  18419. if ($directoryName == '.') {
  18420. return $i;
  18421. }
  18422. if (strpos($directoryName, '\\') !== false ||
  18423. strpos($directoryName, '/') !== false) {
  18424. continue;
  18425. }
  18426. $length = strlen($stat['name']);
  18427. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  18428. $contents = $zip->getFromIndex($i);
  18429. if ($contents !== false) {
  18430. $indexOfShortestMatch = $i;
  18431. $lengthOfShortestMatch = $length;
  18432. }
  18433. }
  18434. }
  18435. }
  18436. return $indexOfShortestMatch;
  18437. }
  18438. private function getComposerInformation(\SplFileInfo $file)
  18439. {
  18440. $zip = new \ZipArchive();
  18441. $zip->open($file->getPathname());
  18442. if (0 == $zip->numFiles) {
  18443. return false;
  18444. }
  18445. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  18446. if (false === $foundFileIndex) {
  18447. return false;
  18448. }
  18449. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  18450. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  18451. $json = file_get_contents($composerFile);
  18452. $package = JsonFile::parseJson($json, $composerFile);
  18453. $package['dist'] = array(
  18454. 'type' => 'zip',
  18455. 'url' => strtr($file->getPathname(), '\\', '/'),
  18456. 'shasum' => sha1_file($file->getRealPath()),
  18457. );
  18458. try {
  18459. $package = $this->loader->load($package);
  18460. } catch (\UnexpectedValueException $e) {
  18461. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  18462. }
  18463. return $package;
  18464. }
  18465. }
  18466. <?php
  18467. namespace Composer\Repository;
  18468. use Composer\Package\RootPackageInterface;
  18469. use Composer\Semver\Constraint\ConstraintInterface;
  18470. use Composer\Semver\Constraint\Constraint;
  18471. use Composer\Package\Link;
  18472. abstract class BaseRepository implements RepositoryInterface
  18473. {
  18474. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  18475. {
  18476. $needles = (array) $needle;
  18477. $results = array();
  18478. if (null === $packagesFound) {
  18479. $packagesFound = $needles;
  18480. }
  18481. $rootPackage = null;
  18482. foreach ($this->getPackages() as $package) {
  18483. if ($package instanceof RootPackageInterface) {
  18484. $rootPackage = $package;
  18485. break;
  18486. }
  18487. }
  18488. foreach ($this->getPackages() as $package) {
  18489. $links = $package->getRequires();
  18490. $packagesInTree = $packagesFound;
  18491. if (!$invert) {
  18492. $links += $package->getReplaces();
  18493. }
  18494. if ($package instanceof RootPackageInterface) {
  18495. $links += $package->getDevRequires();
  18496. }
  18497. foreach ($links as $link) {
  18498. foreach ($needles as $needle) {
  18499. if ($link->getTarget() === $needle) {
  18500. if (is_null($constraint) || (($link->getConstraint()->matches($constraint) === !$invert))) {
  18501. if (in_array($link->getSource(), $packagesInTree)) {
  18502. $results[$link->getSource()] = array($package, $link, false);
  18503. continue;
  18504. }
  18505. $packagesInTree[] = $link->getSource();
  18506. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  18507. $results[$link->getSource()] = array($package, $link, $dependents);
  18508. }
  18509. }
  18510. }
  18511. }
  18512. if ($invert && in_array($package->getName(), $needles)) {
  18513. foreach ($package->getConflicts() as $link) {
  18514. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  18515. $version = new Constraint('=', $pkg->getVersion());
  18516. if ($link->getConstraint()->matches($version) === $invert) {
  18517. $results[] = array($package, $link, false);
  18518. }
  18519. }
  18520. }
  18521. }
  18522. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  18523. foreach ($package->getRequires() as $link) {
  18524. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  18525. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  18526. continue;
  18527. }
  18528. $platformPkg = $this->findPackage($link->getTarget(), '*');
  18529. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  18530. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  18531. continue;
  18532. }
  18533. foreach ($this->getPackages() as $pkg) {
  18534. if (!in_array($link->getTarget(), $pkg->getNames())) {
  18535. continue;
  18536. }
  18537. $version = new Constraint('=', $pkg->getVersion());
  18538. if (!$link->getConstraint()->matches($version)) {
  18539. if ($rootPackage) {
  18540. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  18541. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  18542. $results[] = array($package, $link, false);
  18543. $results[] = array($rootPackage, $rootReq, false);
  18544. continue 3;
  18545. }
  18546. }
  18547. $results[] = array($package, $link, false);
  18548. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  18549. } else {
  18550. $results[] = array($package, $link, false);
  18551. }
  18552. }
  18553. continue 2;
  18554. }
  18555. }
  18556. }
  18557. }
  18558. ksort($results);
  18559. return $results;
  18560. }
  18561. }
  18562. <?php
  18563. namespace Composer\Repository;
  18564. use Composer\Package\Loader\ArrayLoader;
  18565. use Composer\Package\PackageInterface;
  18566. use Composer\Package\AliasPackage;
  18567. use Composer\Package\Version\VersionParser;
  18568. use Composer\DependencyResolver\Pool;
  18569. use Composer\Json\JsonFile;
  18570. use Composer\Cache;
  18571. use Composer\Config;
  18572. use Composer\Factory;
  18573. use Composer\IO\IOInterface;
  18574. use Composer\Util\RemoteFilesystem;
  18575. use Composer\Plugin\PluginEvents;
  18576. use Composer\Plugin\PreFileDownloadEvent;
  18577. use Composer\EventDispatcher\EventDispatcher;
  18578. use Composer\Downloader\TransportException;
  18579. use Composer\Semver\Constraint\ConstraintInterface;
  18580. use Composer\Semver\Constraint\Constraint;
  18581. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18582. {
  18583. protected $config;
  18584. protected $repoConfig;
  18585. protected $options;
  18586. protected $url;
  18587. protected $baseUrl;
  18588. protected $io;
  18589. protected $rfs;
  18590. protected $cache;
  18591. protected $notifyUrl;
  18592. protected $searchUrl;
  18593. protected $hasProviders = false;
  18594. protected $providersUrl;
  18595. protected $lazyProvidersUrl;
  18596. protected $providerListing;
  18597. protected $providers = array();
  18598. protected $providersByUid = array();
  18599. protected $loader;
  18600. protected $rootAliases;
  18601. protected $allowSslDowngrade = false;
  18602. protected $eventDispatcher;
  18603. protected $sourceMirrors;
  18604. protected $distMirrors;
  18605. private $degradedMode = false;
  18606. private $rootData;
  18607. private $hasPartialPackages;
  18608. private $partialPackagesByName;
  18609. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  18610. {
  18611. parent::__construct();
  18612. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  18613. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  18614. }
  18615. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  18616. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  18617. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  18618. }
  18619. $urlBits = parse_url($repoConfig['url']);
  18620. if ($urlBits === false || empty($urlBits['scheme'])) {
  18621. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  18622. }
  18623. if (!isset($repoConfig['options'])) {
  18624. $repoConfig['options'] = array();
  18625. }
  18626. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  18627. $this->allowSslDowngrade = true;
  18628. }
  18629. $this->config = $config;
  18630. $this->options = $repoConfig['options'];
  18631. $this->url = $repoConfig['url'];
  18632. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  18633. $this->io = $io;
  18634. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  18635. $this->loader = new ArrayLoader();
  18636. if ($rfs && $this->options) {
  18637. $rfs = clone $rfs;
  18638. $rfs->setOptions($this->options);
  18639. }
  18640. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  18641. $this->eventDispatcher = $eventDispatcher;
  18642. $this->repoConfig = $repoConfig;
  18643. }
  18644. public function getRepoConfig()
  18645. {
  18646. return $this->repoConfig;
  18647. }
  18648. public function setRootAliases(array $rootAliases)
  18649. {
  18650. $this->rootAliases = $rootAliases;
  18651. }
  18652. public function findPackage($name, $constraint)
  18653. {
  18654. if (!$this->hasProviders()) {
  18655. return parent::findPackage($name, $constraint);
  18656. }
  18657. $name = strtolower($name);
  18658. if (!$constraint instanceof ConstraintInterface) {
  18659. $versionParser = new VersionParser();
  18660. $constraint = $versionParser->parseConstraints($constraint);
  18661. }
  18662. foreach ($this->getProviderNames() as $providerName) {
  18663. if ($name === $providerName) {
  18664. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  18665. foreach ($packages as $package) {
  18666. if ($name === $package->getName()) {
  18667. $pkgConstraint = new Constraint('==', $package->getVersion());
  18668. if ($constraint->matches($pkgConstraint)) {
  18669. return $package;
  18670. }
  18671. }
  18672. }
  18673. break;
  18674. }
  18675. }
  18676. }
  18677. public function findPackages($name, $constraint = null)
  18678. {
  18679. if (!$this->hasProviders()) {
  18680. return parent::findPackages($name, $constraint);
  18681. }
  18682. $name = strtolower($name);
  18683. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  18684. $versionParser = new VersionParser();
  18685. $constraint = $versionParser->parseConstraints($constraint);
  18686. }
  18687. $packages = array();
  18688. foreach ($this->getProviderNames() as $providerName) {
  18689. if ($name === $providerName) {
  18690. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  18691. foreach ($candidates as $package) {
  18692. if ($name === $package->getName()) {
  18693. $pkgConstraint = new Constraint('==', $package->getVersion());
  18694. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  18695. $packages[] = $package;
  18696. }
  18697. }
  18698. }
  18699. break;
  18700. }
  18701. }
  18702. return $packages;
  18703. }
  18704. public function getPackages()
  18705. {
  18706. if ($this->hasProviders()) {
  18707. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  18708. }
  18709. return parent::getPackages();
  18710. }
  18711. public function search($query, $mode = 0, $type = null)
  18712. {
  18713. $this->loadRootServerFile();
  18714. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  18715. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  18716. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  18717. $json = $this->rfs->getContents($hostname, $url, false);
  18718. $results = JsonFile::parseJson($json, $url);
  18719. return $results['results'];
  18720. }
  18721. if ($this->hasProviders()) {
  18722. $results = array();
  18723. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  18724. foreach ($this->getProviderNames() as $name) {
  18725. if (preg_match($regex, $name)) {
  18726. $results[] = array('name' => $name);
  18727. }
  18728. }
  18729. return $results;
  18730. }
  18731. return parent::search($query, $mode);
  18732. }
  18733. public function getProviderNames()
  18734. {
  18735. $this->loadRootServerFile();
  18736. if (null === $this->providerListing) {
  18737. $this->loadProviderListings($this->loadRootServerFile());
  18738. }
  18739. if ($this->lazyProvidersUrl) {
  18740. return array();
  18741. }
  18742. if ($this->providersUrl) {
  18743. return array_keys($this->providerListing);
  18744. }
  18745. return array();
  18746. }
  18747. protected function configurePackageTransportOptions(PackageInterface $package)
  18748. {
  18749. foreach ($package->getDistUrls() as $url) {
  18750. if (strpos($url, $this->baseUrl) === 0) {
  18751. $package->setTransportOptions($this->options);
  18752. return;
  18753. }
  18754. }
  18755. }
  18756. public function hasProviders()
  18757. {
  18758. $this->loadRootServerFile();
  18759. return $this->hasProviders;
  18760. }
  18761. public function resetPackageIds()
  18762. {
  18763. foreach ($this->providersByUid as $package) {
  18764. if ($package instanceof AliasPackage) {
  18765. $package->getAliasOf()->setId(-1);
  18766. }
  18767. $package->setId(-1);
  18768. }
  18769. }
  18770. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  18771. {
  18772. if (isset($this->providers[$name]) && !$bypassFilters) {
  18773. return $this->providers[$name];
  18774. }
  18775. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  18776. $this->initializePartialPackages();
  18777. }
  18778. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  18779. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  18780. return array();
  18781. }
  18782. if (null === $this->providerListing) {
  18783. $this->loadProviderListings($this->loadRootServerFile());
  18784. }
  18785. $useLastModifiedCheck = false;
  18786. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  18787. $hash = null;
  18788. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  18789. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  18790. $useLastModifiedCheck = true;
  18791. } elseif ($this->providersUrl) {
  18792. if (!isset($this->providerListing[$name])) {
  18793. return array();
  18794. }
  18795. $hash = $this->providerListing[$name]['sha256'];
  18796. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  18797. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  18798. } else {
  18799. return array();
  18800. }
  18801. $packages = null;
  18802. if ($cacheKey) {
  18803. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  18804. $packages = json_decode($this->cache->read($cacheKey), true);
  18805. } elseif ($useLastModifiedCheck) {
  18806. if ($contents = $this->cache->read($cacheKey)) {
  18807. $contents = json_decode($contents, true);
  18808. if (isset($contents['last-modified'])) {
  18809. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  18810. if (true === $response) {
  18811. $packages = $contents;
  18812. } elseif ($response) {
  18813. $packages = $response;
  18814. }
  18815. }
  18816. }
  18817. }
  18818. }
  18819. if (!$packages) {
  18820. try {
  18821. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  18822. } catch (TransportException $e) {
  18823. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  18824. $packages = array('packages' => array());
  18825. } else {
  18826. throw $e;
  18827. }
  18828. }
  18829. }
  18830. $loadingPartialPackage = false;
  18831. } else {
  18832. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  18833. $loadingPartialPackage = true;
  18834. }
  18835. $this->providers[$name] = array();
  18836. foreach ($packages['packages'] as $versions) {
  18837. foreach ($versions as $version) {
  18838. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  18839. continue;
  18840. }
  18841. if (isset($this->providersByUid[$version['uid']])) {
  18842. if (!isset($this->providers[$name][$version['uid']])) {
  18843. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  18844. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  18845. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  18846. } else {
  18847. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  18848. }
  18849. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  18850. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  18851. }
  18852. }
  18853. } else {
  18854. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  18855. continue;
  18856. }
  18857. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  18858. $package->setRepository($this);
  18859. if ($package instanceof AliasPackage) {
  18860. $aliased = $package->getAliasOf();
  18861. $aliased->setRepository($this);
  18862. $this->providers[$name][$version['uid']] = $aliased;
  18863. $this->providers[$name][$version['uid'].'-alias'] = $package;
  18864. $this->providersByUid[$version['uid']] = $package;
  18865. } else {
  18866. $this->providers[$name][$version['uid']] = $package;
  18867. $this->providersByUid[$version['uid']] = $package;
  18868. }
  18869. unset($rootAliasData);
  18870. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  18871. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  18872. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  18873. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  18874. }
  18875. if (isset($rootAliasData)) {
  18876. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  18877. $alias->setRepository($this);
  18878. $this->providers[$name][$version['uid'].'-root'] = $alias;
  18879. $this->providersByUid[$version['uid'].'-root'] = $alias;
  18880. }
  18881. }
  18882. }
  18883. }
  18884. $result = $this->providers[$name];
  18885. if ($bypassFilters) {
  18886. foreach ($this->providers[$name] as $uid => $provider) {
  18887. unset($this->providersByUid[$uid]);
  18888. }
  18889. unset($this->providers[$name]);
  18890. }
  18891. return $result;
  18892. }
  18893. protected function initialize()
  18894. {
  18895. parent::initialize();
  18896. $repoData = $this->loadDataFromServer();
  18897. foreach ($repoData as $package) {
  18898. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  18899. }
  18900. }
  18901. public function addPackage(PackageInterface $package)
  18902. {
  18903. parent::addPackage($package);
  18904. $this->configurePackageTransportOptions($package);
  18905. }
  18906. protected function loadRootServerFile()
  18907. {
  18908. if (null !== $this->rootData) {
  18909. return $this->rootData;
  18910. }
  18911. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  18912. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  18913. }
  18914. $jsonUrlParts = parse_url($this->url);
  18915. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  18916. $jsonUrl = $this->url;
  18917. } else {
  18918. $jsonUrl = $this->url . '/packages.json';
  18919. }
  18920. $data = $this->fetchFile($jsonUrl, 'packages.json');
  18921. if (!empty($data['notify-batch'])) {
  18922. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  18923. } elseif (!empty($data['notify'])) {
  18924. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  18925. }
  18926. if (!empty($data['search'])) {
  18927. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  18928. }
  18929. if (!empty($data['mirrors'])) {
  18930. foreach ($data['mirrors'] as $mirror) {
  18931. if (!empty($mirror['git-url'])) {
  18932. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  18933. }
  18934. if (!empty($mirror['hg-url'])) {
  18935. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  18936. }
  18937. if (!empty($mirror['dist-url'])) {
  18938. $this->distMirrors[] = array('url' => $mirror['dist-url'], 'preferred' => !empty($mirror['preferred']));
  18939. }
  18940. }
  18941. }
  18942. if (!empty($data['warning'])) {
  18943. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  18944. }
  18945. if (!empty($data['providers-lazy-url'])) {
  18946. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  18947. $this->hasProviders = true;
  18948. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  18949. }
  18950. if ($this->allowSslDowngrade) {
  18951. $this->url = str_replace('https://', 'http://', $this->url);
  18952. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  18953. }
  18954. if (!empty($data['providers-url'])) {
  18955. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  18956. $this->hasProviders = true;
  18957. }
  18958. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  18959. $this->hasProviders = true;
  18960. }
  18961. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  18962. $this->url = 'https://packagist.org';
  18963. $this->baseUrl = 'https://packagist.org';
  18964. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  18965. $this->providersUrl = null;
  18966. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  18967. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  18968. $this->providersUrl = null;
  18969. }
  18970. return $this->rootData = $data;
  18971. }
  18972. protected function canonicalizeUrl($url)
  18973. {
  18974. if ('/' === $url[0]) {
  18975. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  18976. }
  18977. return $url;
  18978. }
  18979. protected function loadDataFromServer()
  18980. {
  18981. $data = $this->loadRootServerFile();
  18982. return $this->loadIncludes($data);
  18983. }
  18984. protected function loadProviderListings($data)
  18985. {
  18986. if (isset($data['providers'])) {
  18987. if (!is_array($this->providerListing)) {
  18988. $this->providerListing = array();
  18989. }
  18990. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  18991. }
  18992. if ($this->providersUrl && isset($data['provider-includes'])) {
  18993. $includes = $data['provider-includes'];
  18994. foreach ($includes as $include => $metadata) {
  18995. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  18996. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  18997. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  18998. $includedData = json_decode($this->cache->read($cacheKey), true);
  18999. } else {
  19000. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  19001. }
  19002. $this->loadProviderListings($includedData);
  19003. }
  19004. }
  19005. }
  19006. protected function loadIncludes($data)
  19007. {
  19008. $packages = array();
  19009. if (!isset($data['packages']) && !isset($data['includes'])) {
  19010. foreach ($data as $pkg) {
  19011. foreach ($pkg['versions'] as $metadata) {
  19012. $packages[] = $metadata;
  19013. }
  19014. }
  19015. return $packages;
  19016. }
  19017. if (isset($data['packages'])) {
  19018. foreach ($data['packages'] as $package => $versions) {
  19019. foreach ($versions as $version => $metadata) {
  19020. $packages[] = $metadata;
  19021. }
  19022. }
  19023. }
  19024. if (isset($data['includes'])) {
  19025. foreach ($data['includes'] as $include => $metadata) {
  19026. if ($this->cache->sha1($include) === $metadata['sha1']) {
  19027. $includedData = json_decode($this->cache->read($include), true);
  19028. } else {
  19029. $includedData = $this->fetchFile($include);
  19030. }
  19031. $packages = array_merge($packages, $this->loadIncludes($includedData));
  19032. }
  19033. }
  19034. return $packages;
  19035. }
  19036. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  19037. {
  19038. try {
  19039. if (!isset($data['notification-url'])) {
  19040. $data['notification-url'] = $this->notifyUrl;
  19041. }
  19042. $package = $this->loader->load($data, $class);
  19043. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  19044. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  19045. }
  19046. $package->setDistMirrors($this->distMirrors);
  19047. $this->configurePackageTransportOptions($package);
  19048. return $package;
  19049. } catch (\Exception $e) {
  19050. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  19051. }
  19052. }
  19053. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  19054. {
  19055. if (null === $cacheKey) {
  19056. $cacheKey = $filename;
  19057. $filename = $this->baseUrl.'/'.$filename;
  19058. }
  19059. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  19060. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  19061. }
  19062. $retries = 3;
  19063. while ($retries--) {
  19064. try {
  19065. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19066. if ($this->eventDispatcher) {
  19067. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19068. }
  19069. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19070. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19071. $json = $rfs->getContents($hostname, $filename, false);
  19072. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  19073. if ($this->allowSslDowngrade) {
  19074. $this->url = str_replace('http://', 'https://', $this->url);
  19075. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  19076. $filename = str_replace('http://', 'https://', $filename);
  19077. }
  19078. if ($retries) {
  19079. usleep(100000);
  19080. continue;
  19081. }
  19082. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This should indicate a man-in-the-middle attack. Try running composer again and report this if you think it is a mistake.');
  19083. }
  19084. $data = JsonFile::parseJson($json, $filename);
  19085. if ($cacheKey) {
  19086. if ($storeLastModifiedTime) {
  19087. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19088. if ($lastModifiedDate) {
  19089. $data['last-modified'] = $lastModifiedDate;
  19090. $json = json_encode($data);
  19091. }
  19092. }
  19093. $this->cache->write($cacheKey, $json);
  19094. }
  19095. break;
  19096. } catch (\Exception $e) {
  19097. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19098. throw $e;
  19099. }
  19100. if ($retries) {
  19101. usleep(100000);
  19102. continue;
  19103. }
  19104. if ($e instanceof RepositorySecurityException) {
  19105. throw $e;
  19106. }
  19107. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  19108. if (!$this->degradedMode) {
  19109. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19110. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  19111. }
  19112. $this->degradedMode = true;
  19113. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  19114. break;
  19115. }
  19116. throw $e;
  19117. }
  19118. }
  19119. return $data;
  19120. }
  19121. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  19122. {
  19123. $retries = 3;
  19124. while ($retries--) {
  19125. try {
  19126. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19127. if ($this->eventDispatcher) {
  19128. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19129. }
  19130. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19131. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19132. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  19133. $json = $rfs->getContents($hostname, $filename, false, $options);
  19134. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  19135. return true;
  19136. }
  19137. $data = JsonFile::parseJson($json, $filename);
  19138. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19139. if ($lastModifiedDate) {
  19140. $data['last-modified'] = $lastModifiedDate;
  19141. $json = json_encode($data);
  19142. }
  19143. $this->cache->write($cacheKey, $json);
  19144. return $data;
  19145. } catch (\Exception $e) {
  19146. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19147. throw $e;
  19148. }
  19149. if ($retries) {
  19150. usleep(100000);
  19151. continue;
  19152. }
  19153. if (!$this->degradedMode) {
  19154. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19155. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  19156. }
  19157. $this->degradedMode = true;
  19158. return true;
  19159. }
  19160. }
  19161. }
  19162. private function initializePartialPackages()
  19163. {
  19164. $rootData = $this->loadRootServerFile();
  19165. $this->partialPackagesByName = array();
  19166. foreach ($rootData['packages'] as $package => $versions) {
  19167. $package = strtolower($package);
  19168. foreach ($versions as $version) {
  19169. $this->partialPackagesByName[$package][] = $version;
  19170. if (!empty($version['provide']) && is_array($version['provide'])) {
  19171. foreach ($version['provide'] as $provided => $providedVersion) {
  19172. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19173. }
  19174. }
  19175. if (!empty($version['replace']) && is_array($version['replace'])) {
  19176. foreach ($version['replace'] as $provided => $providedVersion) {
  19177. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19178. }
  19179. }
  19180. }
  19181. }
  19182. $this->rootData = true;
  19183. }
  19184. }
  19185. <?php
  19186. namespace Composer\Repository;
  19187. use Composer\Package\PackageInterface;
  19188. class CompositeRepository extends BaseRepository
  19189. {
  19190. private $repositories;
  19191. public function __construct(array $repositories)
  19192. {
  19193. $this->repositories = array();
  19194. foreach ($repositories as $repo) {
  19195. $this->addRepository($repo);
  19196. }
  19197. }
  19198. public function getRepositories()
  19199. {
  19200. return $this->repositories;
  19201. }
  19202. public function hasPackage(PackageInterface $package)
  19203. {
  19204. foreach ($this->repositories as $repository) {
  19205. if ($repository->hasPackage($package)) {
  19206. return true;
  19207. }
  19208. }
  19209. return false;
  19210. }
  19211. public function findPackage($name, $constraint)
  19212. {
  19213. foreach ($this->repositories as $repository) {
  19214. $package = $repository->findPackage($name, $constraint);
  19215. if (null !== $package) {
  19216. return $package;
  19217. }
  19218. }
  19219. return null;
  19220. }
  19221. public function findPackages($name, $constraint = null)
  19222. {
  19223. $packages = array();
  19224. foreach ($this->repositories as $repository) {
  19225. $packages[] = $repository->findPackages($name, $constraint);
  19226. }
  19227. return $packages ? call_user_func_array('array_merge', $packages) : array();
  19228. }
  19229. public function search($query, $mode = 0, $type = null)
  19230. {
  19231. $matches = array();
  19232. foreach ($this->repositories as $repository) {
  19233. $matches[] = $repository->search($query, $mode, $type);
  19234. }
  19235. return $matches ? call_user_func_array('array_merge', $matches) : array();
  19236. }
  19237. public function getPackages()
  19238. {
  19239. $packages = array();
  19240. foreach ($this->repositories as $repository) {
  19241. $packages[] = $repository->getPackages();
  19242. }
  19243. return $packages ? call_user_func_array('array_merge', $packages) : array();
  19244. }
  19245. public function removePackage(PackageInterface $package)
  19246. {
  19247. foreach ($this->repositories as $repository) {
  19248. $repository->removePackage($package);
  19249. }
  19250. }
  19251. public function count()
  19252. {
  19253. $total = 0;
  19254. foreach ($this->repositories as $repository) {
  19255. $total += $repository->count();
  19256. }
  19257. return $total;
  19258. }
  19259. public function addRepository(RepositoryInterface $repository)
  19260. {
  19261. if ($repository instanceof self) {
  19262. foreach ($repository->getRepositories() as $repo) {
  19263. $this->addRepository($repo);
  19264. }
  19265. } else {
  19266. $this->repositories[] = $repository;
  19267. }
  19268. }
  19269. }
  19270. <?php
  19271. namespace Composer\Repository;
  19272. interface ConfigurableRepositoryInterface
  19273. {
  19274. public function getRepoConfig();
  19275. }
  19276. <?php
  19277. namespace Composer\Repository;
  19278. use Composer\Json\JsonFile;
  19279. use Composer\Package\Loader\ArrayLoader;
  19280. use Composer\Package\Dumper\ArrayDumper;
  19281. class FilesystemRepository extends WritableArrayRepository
  19282. {
  19283. private $file;
  19284. public function __construct(JsonFile $repositoryFile)
  19285. {
  19286. parent::__construct();
  19287. $this->file = $repositoryFile;
  19288. }
  19289. protected function initialize()
  19290. {
  19291. parent::initialize();
  19292. if (!$this->file->exists()) {
  19293. return;
  19294. }
  19295. try {
  19296. $packages = $this->file->read();
  19297. if (!is_array($packages)) {
  19298. throw new \UnexpectedValueException('Could not parse package list from the repository');
  19299. }
  19300. } catch (\Exception $e) {
  19301. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  19302. }
  19303. $loader = new ArrayLoader(null, true);
  19304. foreach ($packages as $packageData) {
  19305. $package = $loader->load($packageData);
  19306. $this->addPackage($package);
  19307. }
  19308. }
  19309. public function reload()
  19310. {
  19311. $this->packages = null;
  19312. $this->initialize();
  19313. }
  19314. public function write()
  19315. {
  19316. $data = array();
  19317. $dumper = new ArrayDumper();
  19318. foreach ($this->getCanonicalPackages() as $package) {
  19319. $data[] = $dumper->dump($package);
  19320. }
  19321. $this->file->write($data);
  19322. }
  19323. }
  19324. <?php
  19325. namespace Composer\Repository;
  19326. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  19327. {
  19328. }
  19329. <?php
  19330. namespace Composer\Repository;
  19331. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  19332. {
  19333. }
  19334. <?php
  19335. namespace Composer\Repository;
  19336. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  19337. {
  19338. }
  19339. <?php
  19340. namespace Composer\Repository;
  19341. class InvalidRepositoryException extends \Exception
  19342. {
  19343. }
  19344. <?php
  19345. namespace Composer\Repository;
  19346. use Composer\Package\Loader\ArrayLoader;
  19347. use Composer\Package\Loader\ValidatingArrayLoader;
  19348. class PackageRepository extends ArrayRepository
  19349. {
  19350. private $config;
  19351. public function __construct(array $config)
  19352. {
  19353. parent::__construct();
  19354. $this->config = $config['package'];
  19355. if (!is_numeric(key($this->config))) {
  19356. $this->config = array($this->config);
  19357. }
  19358. }
  19359. protected function initialize()
  19360. {
  19361. parent::initialize();
  19362. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  19363. foreach ($this->config as $package) {
  19364. try {
  19365. $package = $loader->load($package);
  19366. } catch (\Exception $e) {
  19367. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  19368. }
  19369. $this->addPackage($package);
  19370. }
  19371. }
  19372. }
  19373. <?php
  19374. namespace Composer\Repository;
  19375. use Composer\Config;
  19376. use Composer\IO\IOInterface;
  19377. use Composer\Json\JsonFile;
  19378. use Composer\Package\Loader\ArrayLoader;
  19379. use Composer\Package\Version\VersionGuesser;
  19380. use Composer\Package\Version\VersionParser;
  19381. use Composer\Util\Platform;
  19382. use Composer\Util\ProcessExecutor;
  19383. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19384. {
  19385. private $loader;
  19386. private $versionGuesser;
  19387. private $url;
  19388. private $repoConfig;
  19389. private $process;
  19390. private $options;
  19391. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  19392. {
  19393. if (!isset($repoConfig['url'])) {
  19394. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  19395. }
  19396. $this->loader = new ArrayLoader(null, true);
  19397. $this->url = Platform::expandPath($repoConfig['url']);
  19398. $this->process = new ProcessExecutor($io);
  19399. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  19400. $this->repoConfig = $repoConfig;
  19401. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  19402. parent::__construct();
  19403. }
  19404. public function getRepoConfig()
  19405. {
  19406. return $this->repoConfig;
  19407. }
  19408. protected function initialize()
  19409. {
  19410. parent::initialize();
  19411. foreach ($this->getUrlMatches() as $url) {
  19412. $path = realpath($url) . DIRECTORY_SEPARATOR;
  19413. $composerFilePath = $path.'composer.json';
  19414. if (!file_exists($composerFilePath)) {
  19415. continue;
  19416. }
  19417. $json = file_get_contents($composerFilePath);
  19418. $package = JsonFile::parseJson($json, $composerFilePath);
  19419. $package['dist'] = array(
  19420. 'type' => 'path',
  19421. 'url' => $url,
  19422. 'reference' => sha1($json . serialize($this->options)),
  19423. );
  19424. $package['transport-options'] = $this->options;
  19425. if (!isset($package['version'])) {
  19426. $versionData = $this->versionGuesser->guessVersion($package, $path);
  19427. $package['version'] = $versionData['version'] ?: 'dev-master';
  19428. }
  19429. $output = '';
  19430. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  19431. $package['dist']['reference'] = trim($output);
  19432. }
  19433. $package = $this->loader->load($package);
  19434. $this->addPackage($package);
  19435. }
  19436. }
  19437. private function getUrlMatches()
  19438. {
  19439. return array_map(function ($val) {
  19440. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  19441. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  19442. }
  19443. }
  19444. <?php
  19445. namespace Composer\Repository\Pear;
  19446. use Composer\Util\RemoteFilesystem;
  19447. abstract class BaseChannelReader
  19448. {
  19449. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  19450. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  19451. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  19452. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  19453. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  19454. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  19455. private $rfs;
  19456. protected function __construct(RemoteFilesystem $rfs)
  19457. {
  19458. $this->rfs = $rfs;
  19459. }
  19460. protected function requestContent($origin, $path)
  19461. {
  19462. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  19463. $content = $this->rfs->getContents($origin, $url, false);
  19464. if (!$content) {
  19465. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  19466. }
  19467. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  19468. }
  19469. protected function requestXml($origin, $path)
  19470. {
  19471. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  19472. if (false === $xml) {
  19473. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  19474. }
  19475. return $xml;
  19476. }
  19477. }
  19478. <?php
  19479. namespace Composer\Repository\Pear;
  19480. class ChannelInfo
  19481. {
  19482. private $name;
  19483. private $alias;
  19484. private $packages;
  19485. public function __construct($name, $alias, array $packages)
  19486. {
  19487. $this->name = $name;
  19488. $this->alias = $alias;
  19489. $this->packages = $packages;
  19490. }
  19491. public function getName()
  19492. {
  19493. return $this->name;
  19494. }
  19495. public function getAlias()
  19496. {
  19497. return $this->alias;
  19498. }
  19499. public function getPackages()
  19500. {
  19501. return $this->packages;
  19502. }
  19503. }
  19504. <?php
  19505. namespace Composer\Repository\Pear;
  19506. use Composer\Util\RemoteFilesystem;
  19507. class ChannelReader extends BaseChannelReader
  19508. {
  19509. private $readerMap;
  19510. public function __construct(RemoteFilesystem $rfs)
  19511. {
  19512. parent::__construct($rfs);
  19513. $rest10reader = new ChannelRest10Reader($rfs);
  19514. $rest11reader = new ChannelRest11Reader($rfs);
  19515. $this->readerMap = array(
  19516. 'REST1.3' => $rest11reader,
  19517. 'REST1.2' => $rest11reader,
  19518. 'REST1.1' => $rest11reader,
  19519. 'REST1.0' => $rest10reader,
  19520. );
  19521. }
  19522. public function read($url)
  19523. {
  19524. $xml = $this->requestXml($url, "/channel.xml");
  19525. $channelName = (string) $xml->name;
  19526. $channelAlias = (string) $xml->suggestedalias;
  19527. $supportedVersions = array_keys($this->readerMap);
  19528. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  19529. if (!$selectedRestVersion) {
  19530. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  19531. }
  19532. $reader = $this->readerMap[$selectedRestVersion['version']];
  19533. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  19534. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  19535. }
  19536. private function selectRestVersion($channelXml, $supportedVersions)
  19537. {
  19538. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  19539. foreach ($supportedVersions as $version) {
  19540. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  19541. $testResult = $channelXml->xpath($xpathTest);
  19542. foreach ($testResult as $result) {
  19543. $result = (string) $result;
  19544. if (preg_match('{^https://}i', $result)) {
  19545. return array('version' => $version, 'baseUrl' => $result);
  19546. }
  19547. }
  19548. if (count($testResult) > 0) {
  19549. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  19550. }
  19551. }
  19552. return null;
  19553. }
  19554. }
  19555. <?php
  19556. namespace Composer\Repository\Pear;
  19557. use Composer\Downloader\TransportException;
  19558. class ChannelRest10Reader extends BaseChannelReader
  19559. {
  19560. private $dependencyReader;
  19561. public function __construct($rfs)
  19562. {
  19563. parent::__construct($rfs);
  19564. $this->dependencyReader = new PackageDependencyParser();
  19565. }
  19566. public function read($baseUrl)
  19567. {
  19568. return $this->readPackages($baseUrl);
  19569. }
  19570. private function readPackages($baseUrl)
  19571. {
  19572. $result = array();
  19573. $xmlPath = '/p/packages.xml';
  19574. $xml = $this->requestXml($baseUrl, $xmlPath);
  19575. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  19576. foreach ($xml->xpath('ns:p') as $node) {
  19577. $packageName = (string) $node;
  19578. $packageInfo = $this->readPackage($baseUrl, $packageName);
  19579. $result[] = $packageInfo;
  19580. }
  19581. return $result;
  19582. }
  19583. private function readPackage($baseUrl, $packageName)
  19584. {
  19585. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  19586. $xml = $this->requestXml($baseUrl, $xmlPath);
  19587. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  19588. $channelName = (string) $xml->c;
  19589. $packageName = (string) $xml->n;
  19590. $license = (string) $xml->l;
  19591. $shortDescription = (string) $xml->s;
  19592. $description = (string) $xml->d;
  19593. return new PackageInfo(
  19594. $channelName,
  19595. $packageName,
  19596. $license,
  19597. $shortDescription,
  19598. $description,
  19599. $this->readPackageReleases($baseUrl, $packageName)
  19600. );
  19601. }
  19602. private function readPackageReleases($baseUrl, $packageName)
  19603. {
  19604. $result = array();
  19605. try {
  19606. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  19607. $xml = $this->requestXml($baseUrl, $xmlPath);
  19608. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  19609. foreach ($xml->xpath('ns:r') as $node) {
  19610. $releaseVersion = (string) $node->v;
  19611. $releaseStability = (string) $node->s;
  19612. try {
  19613. $result[$releaseVersion] = new ReleaseInfo(
  19614. $releaseStability,
  19615. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  19616. );
  19617. } catch (TransportException $exception) {
  19618. if ($exception->getCode() != 404) {
  19619. throw $exception;
  19620. }
  19621. }
  19622. }
  19623. } catch (TransportException $exception) {
  19624. if ($exception->getCode() != 404) {
  19625. throw $exception;
  19626. }
  19627. }
  19628. return $result;
  19629. }
  19630. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  19631. {
  19632. $dependencyReader = new PackageDependencyParser();
  19633. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  19634. $content = $this->requestContent($baseUrl, $depthPath);
  19635. $dependencyArray = unserialize($content);
  19636. $result = $dependencyReader->buildDependencyInfo($dependencyArray);
  19637. return $result;
  19638. }
  19639. }
  19640. <?php
  19641. namespace Composer\Repository\Pear;
  19642. class ChannelRest11Reader extends BaseChannelReader
  19643. {
  19644. private $dependencyReader;
  19645. public function __construct($rfs)
  19646. {
  19647. parent::__construct($rfs);
  19648. $this->dependencyReader = new PackageDependencyParser();
  19649. }
  19650. public function read($baseUrl)
  19651. {
  19652. return $this->readChannelPackages($baseUrl);
  19653. }
  19654. private function readChannelPackages($baseUrl)
  19655. {
  19656. $result = array();
  19657. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  19658. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  19659. foreach ($xml->xpath('ns:c') as $node) {
  19660. $categoryName = (string) $node;
  19661. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  19662. $result = array_merge($result, $categoryPackages);
  19663. }
  19664. return $result;
  19665. }
  19666. private function readCategoryPackages($baseUrl, $categoryName)
  19667. {
  19668. $result = array();
  19669. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  19670. $xml = $this->requestXml($baseUrl, $categoryPath);
  19671. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  19672. foreach ($xml->xpath('ns:pi') as $node) {
  19673. $packageInfo = $this->parsePackage($node);
  19674. $result[] = $packageInfo;
  19675. }
  19676. return $result;
  19677. }
  19678. private function parsePackage($packageInfo)
  19679. {
  19680. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  19681. $channelName = (string) $packageInfo->p->c;
  19682. $packageName = (string) $packageInfo->p->n;
  19683. $license = (string) $packageInfo->p->l;
  19684. $shortDescription = (string) $packageInfo->p->s;
  19685. $description = (string) $packageInfo->p->d;
  19686. $dependencies = array();
  19687. foreach ($packageInfo->xpath('ns:deps') as $node) {
  19688. $dependencyVersion = (string) $node->v;
  19689. $dependencyArray = unserialize((string) $node->d);
  19690. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  19691. $dependencies[$dependencyVersion] = $dependencyInfo;
  19692. }
  19693. $releases = array();
  19694. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  19695. if ($releasesInfo) {
  19696. foreach ($releasesInfo as $node) {
  19697. $releaseVersion = (string) $node->v;
  19698. $releaseStability = (string) $node->s;
  19699. $releases[$releaseVersion] = new ReleaseInfo(
  19700. $releaseStability,
  19701. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  19702. );
  19703. }
  19704. }
  19705. return new PackageInfo(
  19706. $channelName,
  19707. $packageName,
  19708. $license,
  19709. $shortDescription,
  19710. $description,
  19711. $releases
  19712. );
  19713. }
  19714. }
  19715. <?php
  19716. namespace Composer\Repository\Pear;
  19717. class DependencyConstraint
  19718. {
  19719. private $type;
  19720. private $constraint;
  19721. private $channelName;
  19722. private $packageName;
  19723. public function __construct($type, $constraint, $channelName, $packageName)
  19724. {
  19725. $this->type = $type;
  19726. $this->constraint = $constraint;
  19727. $this->channelName = $channelName;
  19728. $this->packageName = $packageName;
  19729. }
  19730. public function getChannelName()
  19731. {
  19732. return $this->channelName;
  19733. }
  19734. public function getConstraint()
  19735. {
  19736. return $this->constraint;
  19737. }
  19738. public function getPackageName()
  19739. {
  19740. return $this->packageName;
  19741. }
  19742. public function getType()
  19743. {
  19744. return $this->type;
  19745. }
  19746. }
  19747. <?php
  19748. namespace Composer\Repository\Pear;
  19749. class DependencyInfo
  19750. {
  19751. private $requires;
  19752. private $optionals;
  19753. public function __construct($requires, $optionals)
  19754. {
  19755. $this->requires = $requires;
  19756. $this->optionals = $optionals;
  19757. }
  19758. public function getRequires()
  19759. {
  19760. return $this->requires;
  19761. }
  19762. public function getOptionals()
  19763. {
  19764. return $this->optionals;
  19765. }
  19766. }
  19767. <?php
  19768. namespace Composer\Repository\Pear;
  19769. class PackageDependencyParser
  19770. {
  19771. public function buildDependencyInfo($depArray)
  19772. {
  19773. if (!is_array($depArray)) {
  19774. return new DependencyInfo(array(), array());
  19775. }
  19776. if (!$this->isHash($depArray)) {
  19777. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  19778. }
  19779. return $this->buildDependency20Info($depArray);
  19780. }
  19781. private function buildDependency10Info($depArray)
  19782. {
  19783. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  19784. $result = array();
  19785. foreach ($depArray as $depItem) {
  19786. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  19787. continue;
  19788. }
  19789. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  19790. ? 'optional'
  19791. : 'required';
  19792. $depType = 'not' == $depItem['rel']
  19793. ? 'conflicts'
  19794. : $depType;
  19795. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  19796. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  19797. ? '*'
  19798. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  19799. switch ($depItem['type']) {
  19800. case 'php':
  19801. $depChannelName = 'php';
  19802. $depPackageName = '';
  19803. break;
  19804. case 'pkg':
  19805. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  19806. $depPackageName = $depItem['name'];
  19807. break;
  19808. case 'ext':
  19809. $depChannelName = 'ext';
  19810. $depPackageName = $depItem['name'];
  19811. break;
  19812. case 'os':
  19813. case 'sapi':
  19814. $depChannelName = '';
  19815. $depPackageName = '';
  19816. break;
  19817. default:
  19818. $depChannelName = '';
  19819. $depPackageName = '';
  19820. break;
  19821. }
  19822. if ('' != $depChannelName) {
  19823. $result[] = new DependencyConstraint(
  19824. $depType,
  19825. $depVersionConstraint,
  19826. $depChannelName,
  19827. $depPackageName
  19828. );
  19829. }
  19830. }
  19831. return $result;
  19832. }
  19833. private function buildDependency20Info($depArray)
  19834. {
  19835. $result = array();
  19836. $optionals = array();
  19837. $defaultOptionals = array();
  19838. foreach ($depArray as $depType => $depTypeGroup) {
  19839. if (!is_array($depTypeGroup)) {
  19840. continue;
  19841. }
  19842. if ('required' == $depType || 'optional' == $depType) {
  19843. foreach ($depTypeGroup as $depItemType => $depItem) {
  19844. switch ($depItemType) {
  19845. case 'php':
  19846. $result[] = new DependencyConstraint(
  19847. $depType,
  19848. $this->parse20VersionConstraint($depItem),
  19849. 'php',
  19850. ''
  19851. );
  19852. break;
  19853. case 'package':
  19854. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  19855. $result = array_merge($result, $deps);
  19856. break;
  19857. case 'extension':
  19858. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  19859. $result = array_merge($result, $deps);
  19860. break;
  19861. case 'subpackage':
  19862. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  19863. $defaultOptionals += $deps;
  19864. break;
  19865. case 'os':
  19866. case 'pearinstaller':
  19867. break;
  19868. default:
  19869. break;
  19870. }
  19871. }
  19872. } elseif ('group' == $depType) {
  19873. if ($this->isHash($depTypeGroup)) {
  19874. $depTypeGroup = array($depTypeGroup);
  19875. }
  19876. foreach ($depTypeGroup as $depItem) {
  19877. $groupName = $depItem['attribs']['name'];
  19878. if (!isset($optionals[$groupName])) {
  19879. $optionals[$groupName] = array();
  19880. }
  19881. if (isset($depItem['subpackage'])) {
  19882. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  19883. } else {
  19884. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  19885. }
  19886. }
  19887. }
  19888. }
  19889. if (count($defaultOptionals) > 0) {
  19890. $optionals['*'] = $defaultOptionals;
  19891. }
  19892. return new DependencyInfo($result, $optionals);
  19893. }
  19894. private function buildDepExtensionConstraints($depItem, $depType)
  19895. {
  19896. if ($this->isHash($depItem)) {
  19897. $depItem = array($depItem);
  19898. }
  19899. $result = array();
  19900. foreach ($depItem as $subDepItem) {
  19901. $depChannelName = 'ext';
  19902. $depPackageName = $subDepItem['name'];
  19903. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  19904. $result[] = new DependencyConstraint(
  19905. $depType,
  19906. $depVersionConstraint,
  19907. $depChannelName,
  19908. $depPackageName
  19909. );
  19910. }
  19911. return $result;
  19912. }
  19913. private function buildDepPackageConstraints($depItem, $depType)
  19914. {
  19915. if ($this->isHash($depItem)) {
  19916. $depItem = array($depItem);
  19917. }
  19918. $result = array();
  19919. foreach ($depItem as $subDepItem) {
  19920. $depChannelName = $subDepItem['channel'];
  19921. $depPackageName = $subDepItem['name'];
  19922. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  19923. if (isset($subDepItem['conflicts'])) {
  19924. $depType = 'conflicts';
  19925. }
  19926. $result[] = new DependencyConstraint(
  19927. $depType,
  19928. $depVersionConstraint,
  19929. $depChannelName,
  19930. $depPackageName
  19931. );
  19932. }
  19933. return $result;
  19934. }
  19935. private function parse20VersionConstraint(array $data)
  19936. {
  19937. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  19938. $versions = array();
  19939. $values = array_intersect_key($data, $dep20toOperatorMap);
  19940. if (0 == count($values)) {
  19941. return '*';
  19942. }
  19943. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  19944. $versions[] = '>' . $this->parseVersion($values['min']);
  19945. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  19946. $versions[] = '<' . $this->parseVersion($values['max']);
  19947. } else {
  19948. foreach ($values as $op => $version) {
  19949. if ('exclude' == $op && is_array($version)) {
  19950. foreach ($version as $versionPart) {
  19951. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  19952. }
  19953. } else {
  19954. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  19955. }
  19956. }
  19957. }
  19958. return implode(',', $versions);
  19959. }
  19960. private function parseVersion($version)
  19961. {
  19962. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  19963. $version = $matches[1]
  19964. .(!empty($matches[2]) ? $matches[2] : '.0')
  19965. .(!empty($matches[3]) ? $matches[3] : '.0')
  19966. .(!empty($matches[4]) ? $matches[4] : '.0');
  19967. return $version;
  19968. }
  19969. return null;
  19970. }
  19971. private function isHash(array $array)
  19972. {
  19973. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  19974. }
  19975. }
  19976. <?php
  19977. namespace Composer\Repository\Pear;
  19978. class PackageInfo
  19979. {
  19980. private $channelName;
  19981. private $packageName;
  19982. private $license;
  19983. private $shortDescription;
  19984. private $description;
  19985. private $releases;
  19986. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  19987. {
  19988. $this->channelName = $channelName;
  19989. $this->packageName = $packageName;
  19990. $this->license = $license;
  19991. $this->shortDescription = $shortDescription;
  19992. $this->description = $description;
  19993. $this->releases = $releases;
  19994. }
  19995. public function getChannelName()
  19996. {
  19997. return $this->channelName;
  19998. }
  19999. public function getPackageName()
  20000. {
  20001. return $this->packageName;
  20002. }
  20003. public function getDescription()
  20004. {
  20005. return $this->description;
  20006. }
  20007. public function getShortDescription()
  20008. {
  20009. return $this->shortDescription;
  20010. }
  20011. public function getLicense()
  20012. {
  20013. return $this->license;
  20014. }
  20015. public function getReleases()
  20016. {
  20017. return $this->releases;
  20018. }
  20019. }
  20020. <?php
  20021. namespace Composer\Repository\Pear;
  20022. class ReleaseInfo
  20023. {
  20024. private $stability;
  20025. private $dependencyInfo;
  20026. public function __construct($stability, $dependencyInfo)
  20027. {
  20028. $this->stability = $stability;
  20029. $this->dependencyInfo = $dependencyInfo;
  20030. }
  20031. public function getDependencyInfo()
  20032. {
  20033. return $this->dependencyInfo;
  20034. }
  20035. public function getStability()
  20036. {
  20037. return $this->stability;
  20038. }
  20039. }
  20040. <?php
  20041. namespace Composer\Repository;
  20042. use Composer\IO\IOInterface;
  20043. use Composer\Semver\VersionParser as SemverVersionParser;
  20044. use Composer\Package\Version\VersionParser;
  20045. use Composer\Repository\Pear\ChannelReader;
  20046. use Composer\Package\CompletePackage;
  20047. use Composer\Repository\Pear\ChannelInfo;
  20048. use Composer\EventDispatcher\EventDispatcher;
  20049. use Composer\Package\Link;
  20050. use Composer\Semver\Constraint\Constraint;
  20051. use Composer\Util\RemoteFilesystem;
  20052. use Composer\Config;
  20053. use Composer\Factory;
  20054. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20055. {
  20056. private $url;
  20057. private $io;
  20058. private $rfs;
  20059. private $versionParser;
  20060. private $repoConfig;
  20061. private $vendorAlias;
  20062. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  20063. {
  20064. parent::__construct();
  20065. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  20066. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20067. }
  20068. $urlBits = parse_url($repoConfig['url']);
  20069. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  20070. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  20071. }
  20072. $this->url = rtrim($repoConfig['url'], '/');
  20073. $this->io = $io;
  20074. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  20075. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  20076. $this->versionParser = new VersionParser();
  20077. $this->repoConfig = $repoConfig;
  20078. }
  20079. public function getRepoConfig()
  20080. {
  20081. return $this->repoConfig;
  20082. }
  20083. protected function initialize()
  20084. {
  20085. parent::initialize();
  20086. $this->io->writeError('Initializing PEAR repository '.$this->url);
  20087. $reader = new ChannelReader($this->rfs);
  20088. try {
  20089. $channelInfo = $reader->read($this->url);
  20090. } catch (\Exception $e) {
  20091. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  20092. return;
  20093. }
  20094. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  20095. foreach ($packages as $package) {
  20096. $this->addPackage($package);
  20097. }
  20098. }
  20099. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  20100. {
  20101. $result = array();
  20102. foreach ($channelInfo->getPackages() as $packageDefinition) {
  20103. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  20104. try {
  20105. $normalizedVersion = $versionParser->normalize($version);
  20106. } catch (\UnexpectedValueException $e) {
  20107. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  20108. continue;
  20109. }
  20110. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  20111. $urlBits = parse_url($this->url);
  20112. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  20113. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  20114. $requires = array();
  20115. $suggests = array();
  20116. $conflicts = array();
  20117. $replaces = array();
  20118. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  20119. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  20120. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20121. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20122. }
  20123. if (!empty($this->vendorAlias)
  20124. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  20125. ) {
  20126. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  20127. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20128. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20129. }
  20130. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  20131. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20132. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  20133. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  20134. switch ($dependencyConstraint->getType()) {
  20135. case 'required':
  20136. $requires[] = $link;
  20137. break;
  20138. case 'conflicts':
  20139. $conflicts[] = $link;
  20140. break;
  20141. case 'replaces':
  20142. $replaces[] = $link;
  20143. break;
  20144. }
  20145. }
  20146. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  20147. foreach ($dependencyConstraints as $dependencyConstraint) {
  20148. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20149. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  20150. }
  20151. }
  20152. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  20153. $package->setType('pear-library');
  20154. $package->setDescription($packageDefinition->getDescription());
  20155. $package->setLicense(array($packageDefinition->getLicense()));
  20156. $package->setDistType('file');
  20157. $package->setDistUrl($distUrl);
  20158. $package->setAutoload(array('classmap' => array('')));
  20159. $package->setIncludePaths(array('/'));
  20160. $package->setRequires($requires);
  20161. $package->setConflicts($conflicts);
  20162. $package->setSuggests($suggests);
  20163. $package->setReplaces($replaces);
  20164. $result[] = $package;
  20165. }
  20166. }
  20167. return $result;
  20168. }
  20169. private function buildComposerPackageName($channelName, $packageName)
  20170. {
  20171. if ('php' === $channelName) {
  20172. return "php";
  20173. }
  20174. if ('ext' === $channelName) {
  20175. return "ext-{$packageName}";
  20176. }
  20177. return "pear-{$channelName}/{$packageName}";
  20178. }
  20179. }
  20180. <?php
  20181. namespace Composer\Repository;
  20182. use Composer\XdebugHandler;
  20183. use Composer\Package\CompletePackage;
  20184. use Composer\Package\PackageInterface;
  20185. use Composer\Package\Version\VersionParser;
  20186. use Composer\Plugin\PluginInterface;
  20187. use Composer\Util\Silencer;
  20188. class PlatformRepository extends ArrayRepository
  20189. {
  20190. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/]+)$}i';
  20191. private $versionParser;
  20192. private $overrides = array();
  20193. public function __construct(array $packages = array(), array $overrides = array())
  20194. {
  20195. foreach ($overrides as $name => $version) {
  20196. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  20197. }
  20198. parent::__construct($packages);
  20199. }
  20200. protected function initialize()
  20201. {
  20202. parent::initialize();
  20203. $this->versionParser = new VersionParser();
  20204. foreach ($this->overrides as $override) {
  20205. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  20206. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  20207. }
  20208. $this->addOverriddenPackage($override);
  20209. }
  20210. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  20211. $version = $this->versionParser->normalize($prettyVersion);
  20212. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  20213. $composerPluginApi->setDescription('The Composer Plugin API');
  20214. $this->addPackage($composerPluginApi);
  20215. try {
  20216. $prettyVersion = PHP_VERSION;
  20217. $version = $this->versionParser->normalize($prettyVersion);
  20218. } catch (\UnexpectedValueException $e) {
  20219. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  20220. $version = $this->versionParser->normalize($prettyVersion);
  20221. }
  20222. $php = new CompletePackage('php', $version, $prettyVersion);
  20223. $php->setDescription('The PHP interpreter');
  20224. $this->addPackage($php);
  20225. if (PHP_DEBUG) {
  20226. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  20227. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  20228. $this->addPackage($phpdebug);
  20229. }
  20230. if (defined('PHP_ZTS') && PHP_ZTS) {
  20231. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  20232. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  20233. $this->addPackage($phpzts);
  20234. }
  20235. if (PHP_INT_SIZE === 8) {
  20236. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  20237. $php64->setDescription('The PHP interpreter, 64bit');
  20238. $this->addPackage($php64);
  20239. }
  20240. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  20241. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  20242. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  20243. $this->addPackage($phpIpv6);
  20244. }
  20245. $loadedExtensions = get_loaded_extensions();
  20246. foreach ($loadedExtensions as $name) {
  20247. if (in_array($name, array('standard', 'Core'))) {
  20248. continue;
  20249. }
  20250. $reflExt = new \ReflectionExtension($name);
  20251. $prettyVersion = $reflExt->getVersion();
  20252. $this->addExtension($name, $prettyVersion);
  20253. }
  20254. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = strval(getenv(XdebugHandler::ENV_VERSION)))) {
  20255. $this->addExtension('xdebug', $prettyVersion);
  20256. }
  20257. foreach ($loadedExtensions as $name) {
  20258. $prettyVersion = null;
  20259. $description = 'The '.$name.' PHP library';
  20260. switch ($name) {
  20261. case 'curl':
  20262. $curlVersion = curl_version();
  20263. $prettyVersion = $curlVersion['version'];
  20264. break;
  20265. case 'iconv':
  20266. $prettyVersion = ICONV_VERSION;
  20267. break;
  20268. case 'intl':
  20269. $name = 'ICU';
  20270. if (defined('INTL_ICU_VERSION')) {
  20271. $prettyVersion = INTL_ICU_VERSION;
  20272. } else {
  20273. $reflector = new \ReflectionExtension('intl');
  20274. ob_start();
  20275. $reflector->info();
  20276. $output = ob_get_clean();
  20277. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  20278. $prettyVersion = $matches[1];
  20279. }
  20280. break;
  20281. case 'libxml':
  20282. $prettyVersion = LIBXML_DOTTED_VERSION;
  20283. break;
  20284. case 'openssl':
  20285. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  20286. if (empty($match[2])) {
  20287. return $match[1];
  20288. }
  20289. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  20290. return 0;
  20291. }
  20292. $len = strlen($match[2]);
  20293. $patchVersion = ($len - 1) * 26;
  20294. $patchVersion += ord($match[2][$len - 1]) - 96;
  20295. return $match[1].'.'.$patchVersion;
  20296. }, OPENSSL_VERSION_TEXT);
  20297. $description = OPENSSL_VERSION_TEXT;
  20298. break;
  20299. case 'pcre':
  20300. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  20301. break;
  20302. case 'uuid':
  20303. $prettyVersion = phpversion('uuid');
  20304. break;
  20305. case 'xsl':
  20306. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  20307. break;
  20308. default:
  20309. continue 2;
  20310. }
  20311. try {
  20312. $version = $this->versionParser->normalize($prettyVersion);
  20313. } catch (\UnexpectedValueException $e) {
  20314. continue;
  20315. }
  20316. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  20317. $lib->setDescription($description);
  20318. $this->addPackage($lib);
  20319. }
  20320. if (defined('HHVM_VERSION')) {
  20321. try {
  20322. $prettyVersion = HHVM_VERSION;
  20323. $version = $this->versionParser->normalize($prettyVersion);
  20324. } catch (\UnexpectedValueException $e) {
  20325. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  20326. $version = $this->versionParser->normalize($prettyVersion);
  20327. }
  20328. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  20329. $hhvm->setDescription('The HHVM Runtime (64bit)');
  20330. $this->addPackage($hhvm);
  20331. }
  20332. }
  20333. public function addPackage(PackageInterface $package)
  20334. {
  20335. if (isset($this->overrides[$package->getName()])) {
  20336. $overrider = $this->findPackage($package->getName(), '*');
  20337. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  20338. return;
  20339. }
  20340. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  20341. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  20342. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  20343. return;
  20344. }
  20345. parent::addPackage($package);
  20346. }
  20347. private function addOverriddenPackage(array $override, $name = null)
  20348. {
  20349. $version = $this->versionParser->normalize($override['version']);
  20350. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  20351. $package->setDescription('Package overridden via config.platform');
  20352. $package->setExtra(array('config.platform' => true));
  20353. parent::addPackage($package);
  20354. return $package;
  20355. }
  20356. private function addExtension($name, $prettyVersion)
  20357. {
  20358. $extraDescription = null;
  20359. try {
  20360. $version = $this->versionParser->normalize($prettyVersion);
  20361. } catch (\UnexpectedValueException $e) {
  20362. $extraDescription = ' (actual version: '.$prettyVersion.')';
  20363. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  20364. $prettyVersion = $match[1];
  20365. } else {
  20366. $prettyVersion = '0';
  20367. }
  20368. $version = $this->versionParser->normalize($prettyVersion);
  20369. }
  20370. $packageName = $this->buildPackageName($name);
  20371. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  20372. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  20373. $this->addPackage($ext);
  20374. }
  20375. private function buildPackageName($name)
  20376. {
  20377. return 'ext-' . str_replace(' ', '-', $name);
  20378. }
  20379. }
  20380. <?php
  20381. namespace Composer\Repository;
  20382. use Composer\Factory;
  20383. use Composer\IO\IOInterface;
  20384. use Composer\Config;
  20385. use Composer\EventDispatcher\EventDispatcher;
  20386. use Composer\Util\RemoteFilesystem;
  20387. use Composer\Json\JsonFile;
  20388. class RepositoryFactory
  20389. {
  20390. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  20391. {
  20392. if (0 === strpos($repository, 'http')) {
  20393. $repoConfig = array('type' => 'composer', 'url' => $repository);
  20394. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  20395. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  20396. $data = $json->read();
  20397. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  20398. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  20399. } elseif ($allowFilesystem) {
  20400. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  20401. } else {
  20402. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  20403. }
  20404. } elseif ('{' === substr($repository, 0, 1)) {
  20405. $repoConfig = JsonFile::parseJson($repository);
  20406. } else {
  20407. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  20408. }
  20409. return $repoConfig;
  20410. }
  20411. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  20412. {
  20413. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  20414. return static::createRepo($io, $config, $repoConfig);
  20415. }
  20416. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  20417. {
  20418. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  20419. $repos = static::createRepos($rm, array($repoConfig));
  20420. return reset($repos);
  20421. }
  20422. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  20423. {
  20424. if (!$config) {
  20425. $config = Factory::createConfig($io);
  20426. }
  20427. if (!$rm) {
  20428. if (!$io) {
  20429. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  20430. }
  20431. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  20432. }
  20433. return static::createRepos($rm, $config->getRepositories());
  20434. }
  20435. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20436. {
  20437. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  20438. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  20439. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  20440. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  20441. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  20442. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  20443. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  20444. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  20445. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  20446. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  20447. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  20448. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  20449. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  20450. return $rm;
  20451. }
  20452. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  20453. {
  20454. $repos = array();
  20455. foreach ($repoConfigs as $index => $repo) {
  20456. if (is_string($repo)) {
  20457. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  20458. }
  20459. if (!is_array($repo)) {
  20460. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  20461. }
  20462. if (!isset($repo['type'])) {
  20463. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  20464. }
  20465. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  20466. while (isset($repos[$name])) {
  20467. $name .= '2';
  20468. }
  20469. if ($repo['type'] === 'filesystem') {
  20470. $repos[$name] = new FilesystemRepository($repo['json']);
  20471. } else {
  20472. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  20473. }
  20474. }
  20475. return $repos;
  20476. }
  20477. }
  20478. <?php
  20479. namespace Composer\Repository;
  20480. use Composer\Package\PackageInterface;
  20481. interface RepositoryInterface extends \Countable
  20482. {
  20483. const SEARCH_FULLTEXT = 0;
  20484. const SEARCH_NAME = 1;
  20485. public function hasPackage(PackageInterface $package);
  20486. public function findPackage($name, $constraint);
  20487. public function findPackages($name, $constraint = null);
  20488. public function getPackages();
  20489. public function search($query, $mode = 0);
  20490. }
  20491. <?php
  20492. namespace Composer\Repository;
  20493. use Composer\IO\IOInterface;
  20494. use Composer\Config;
  20495. use Composer\EventDispatcher\EventDispatcher;
  20496. use Composer\Package\PackageInterface;
  20497. use Composer\Util\RemoteFilesystem;
  20498. class RepositoryManager
  20499. {
  20500. private $localRepository;
  20501. private $repositories = array();
  20502. private $repositoryClasses = array();
  20503. private $io;
  20504. private $config;
  20505. private $eventDispatcher;
  20506. private $rfs;
  20507. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20508. {
  20509. $this->io = $io;
  20510. $this->config = $config;
  20511. $this->eventDispatcher = $eventDispatcher;
  20512. $this->rfs = $rfs;
  20513. }
  20514. public function findPackage($name, $constraint)
  20515. {
  20516. foreach ($this->repositories as $repository) {
  20517. if ($package = $repository->findPackage($name, $constraint)) {
  20518. return $package;
  20519. }
  20520. }
  20521. return null;
  20522. }
  20523. public function findPackages($name, $constraint)
  20524. {
  20525. $packages = array();
  20526. foreach ($this->repositories as $repository) {
  20527. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  20528. }
  20529. return $packages;
  20530. }
  20531. public function addRepository(RepositoryInterface $repository)
  20532. {
  20533. $this->repositories[] = $repository;
  20534. }
  20535. public function prependRepository(RepositoryInterface $repository)
  20536. {
  20537. array_unshift($this->repositories, $repository);
  20538. }
  20539. public function createRepository($type, $config, $name = null)
  20540. {
  20541. if (!isset($this->repositoryClasses[$type])) {
  20542. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  20543. }
  20544. if (isset($config['packagist']) && false === $config['packagist']) {
  20545. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  20546. }
  20547. $class = $this->repositoryClasses[$type];
  20548. $reflMethod = new \ReflectionMethod($class, '__construct');
  20549. $params = $reflMethod->getParameters();
  20550. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  20551. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  20552. }
  20553. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  20554. }
  20555. public function setRepositoryClass($type, $class)
  20556. {
  20557. $this->repositoryClasses[$type] = $class;
  20558. }
  20559. public function getRepositories()
  20560. {
  20561. return $this->repositories;
  20562. }
  20563. public function setLocalRepository(WritableRepositoryInterface $repository)
  20564. {
  20565. $this->localRepository = $repository;
  20566. }
  20567. public function getLocalRepository()
  20568. {
  20569. return $this->localRepository;
  20570. }
  20571. }
  20572. <?php
  20573. namespace Composer\Repository;
  20574. class RepositorySecurityException extends \Exception
  20575. {
  20576. }
  20577. <?php
  20578. namespace Composer\Repository\Vcs;
  20579. use Composer\Cache;
  20580. use Composer\Downloader\TransportException;
  20581. use Composer\Json\JsonFile;
  20582. use Composer\Util\Bitbucket;
  20583. abstract class BitbucketDriver extends VcsDriver
  20584. {
  20585. protected $cache;
  20586. protected $owner;
  20587. protected $repository;
  20588. protected $hasIssues;
  20589. protected $rootIdentifier;
  20590. protected $tags;
  20591. protected $branches;
  20592. protected $infoCache = array();
  20593. protected $fallbackDriver;
  20594. public function initialize()
  20595. {
  20596. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  20597. $this->owner = $match[1];
  20598. $this->repository = $match[2];
  20599. $this->originUrl = 'bitbucket.org';
  20600. $this->cache = new Cache(
  20601. $this->io,
  20602. implode('/', array(
  20603. $this->config->get('cache-repo-dir'),
  20604. $this->originUrl,
  20605. $this->owner,
  20606. $this->repository
  20607. ))
  20608. );
  20609. }
  20610. public function getComposerInformation($identifier)
  20611. {
  20612. if ($this->fallbackDriver) {
  20613. return $this->fallbackDriver->getComposerInformation($identifier);
  20614. }
  20615. if (!isset($this->infoCache[$identifier])) {
  20616. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  20617. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  20618. }
  20619. $composer = $this->getBaseComposerInformation($identifier);
  20620. if (!isset($composer['support']['source'])) {
  20621. $label = array_search(
  20622. $identifier,
  20623. $this->getTags()
  20624. ) ?: array_search(
  20625. $identifier,
  20626. $this->getBranches()
  20627. ) ?: $identifier;
  20628. if (array_key_exists($label, $tags = $this->getTags())) {
  20629. $hash = $tags[$label];
  20630. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  20631. $hash = $branches[$label];
  20632. }
  20633. if (! isset($hash)) {
  20634. $composer['support']['source'] = sprintf(
  20635. 'https://%s/%s/%s/src',
  20636. $this->originUrl,
  20637. $this->owner,
  20638. $this->repository
  20639. );
  20640. } else {
  20641. $composer['support']['source'] = sprintf(
  20642. 'https://%s/%s/%s/src/%s/?at=%s',
  20643. $this->originUrl,
  20644. $this->owner,
  20645. $this->repository,
  20646. $hash,
  20647. $label
  20648. );
  20649. }
  20650. }
  20651. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  20652. $composer['support']['issues'] = sprintf(
  20653. 'https://%s/%s/%s/issues',
  20654. $this->originUrl,
  20655. $this->owner,
  20656. $this->repository
  20657. );
  20658. }
  20659. $this->infoCache[$identifier] = $composer;
  20660. if ($this->shouldCache($identifier)) {
  20661. $this->cache->write($identifier, json_encode($composer));
  20662. }
  20663. }
  20664. return $this->infoCache[$identifier];
  20665. }
  20666. public function getFileContent($file, $identifier)
  20667. {
  20668. if ($this->fallbackDriver) {
  20669. return $this->fallbackDriver->getFileContent($file, $identifier);
  20670. }
  20671. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'
  20672. . $this->owner . '/' . $this->repository . '/src/' . $identifier . '/' . $file;
  20673. $fileData = JsonFile::parseJson($this->getContents($resource), $resource);
  20674. if (!is_array($fileData) || ! array_key_exists('data', $fileData)) {
  20675. return null;
  20676. }
  20677. return $fileData['data'];
  20678. }
  20679. public function getChangeDate($identifier)
  20680. {
  20681. if ($this->fallbackDriver) {
  20682. return $this->fallbackDriver->getChangeDate($identifier);
  20683. }
  20684. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'
  20685. . $this->owner . '/' . $this->repository . '/changesets/' . $identifier;
  20686. $changeset = JsonFile::parseJson($this->getContents($resource), $resource);
  20687. return new \DateTime($changeset['timestamp']);
  20688. }
  20689. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  20690. {
  20691. try {
  20692. return parent::getContents($url);
  20693. } catch (TransportException $e) {
  20694. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  20695. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  20696. if (!$this->io->hasAuthentication($this->originUrl)
  20697. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  20698. ) {
  20699. return parent::getContents($url);
  20700. }
  20701. if (!$this->io->isInteractive() && $fetchingRepoData) {
  20702. return $this->attemptCloneFallback();
  20703. }
  20704. }
  20705. throw $e;
  20706. }
  20707. }
  20708. abstract protected function generateSshUrl();
  20709. protected function attemptCloneFallback()
  20710. {
  20711. try {
  20712. $this->setupFallbackDriver($this->generateSshUrl());
  20713. } catch (\RuntimeException $e) {
  20714. $this->fallbackDriver = null;
  20715. $this->io->writeError(
  20716. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  20717. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  20718. );
  20719. throw $e;
  20720. }
  20721. }
  20722. abstract protected function setupFallbackDriver($url);
  20723. }
  20724. <?php
  20725. namespace Composer\Repository\Vcs;
  20726. use Composer\Config;
  20727. use Composer\Json\JsonFile;
  20728. use Composer\Util\ProcessExecutor;
  20729. use Composer\Util\Filesystem;
  20730. use Composer\IO\IOInterface;
  20731. class FossilDriver extends VcsDriver
  20732. {
  20733. protected $tags;
  20734. protected $branches;
  20735. protected $rootIdentifier;
  20736. protected $repoFile;
  20737. protected $checkoutDir;
  20738. protected $infoCache = array();
  20739. public function initialize()
  20740. {
  20741. if (Filesystem::isLocalPath($this->url)) {
  20742. $this->checkoutDir = $this->url;
  20743. } else {
  20744. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '.fossil';
  20745. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  20746. $fs = new Filesystem();
  20747. $fs->ensureDirectoryExists($this->checkoutDir);
  20748. if (!is_writable(dirname($this->checkoutDir))) {
  20749. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  20750. }
  20751. $this->config->prohibitUrlByConfig($this->url, $this->io);
  20752. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  20753. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  20754. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  20755. }
  20756. } else {
  20757. $fs->removeDirectory($this->checkoutDir);
  20758. $fs->remove($this->repoFile);
  20759. $fs->ensureDirectoryExists($this->checkoutDir);
  20760. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  20761. $output = $this->process->getErrorOutput();
  20762. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  20763. throw new \RuntimeException('Failed to clone '.$this->url.', fossil was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  20764. }
  20765. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  20766. }
  20767. if (0 !== $this->process->execute(sprintf('fossil open %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  20768. $output = $this->process->getErrorOutput();
  20769. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  20770. }
  20771. }
  20772. }
  20773. $this->getTags();
  20774. $this->getBranches();
  20775. }
  20776. public function getRootIdentifier()
  20777. {
  20778. if (null === $this->rootIdentifier) {
  20779. $this->rootIdentifier = 'trunk';
  20780. }
  20781. return $this->rootIdentifier;
  20782. }
  20783. public function getUrl()
  20784. {
  20785. return $this->url;
  20786. }
  20787. public function getSource($identifier)
  20788. {
  20789. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  20790. }
  20791. public function getDist($identifier)
  20792. {
  20793. return null;
  20794. }
  20795. public function getFileContent($file, $identifier)
  20796. {
  20797. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  20798. $this->process->execute($command, $content, $this->checkoutDir);
  20799. if (!trim($content)) {
  20800. return null;
  20801. }
  20802. return $content;
  20803. }
  20804. public function getChangeDate($identifier)
  20805. {
  20806. $this->process->execute(sprintf('fossil finfo composer.json | head -n 2 | tail -n 1 | awk \'{print $1}\''), $output, $this->checkoutDir);
  20807. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  20808. }
  20809. public function getTags()
  20810. {
  20811. if (null === $this->tags) {
  20812. $tags = array();
  20813. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  20814. foreach ($this->process->splitLines($output) as $tag) {
  20815. $tags[$tag] = $tag;
  20816. }
  20817. $this->tags = $tags;
  20818. }
  20819. return $this->tags;
  20820. }
  20821. public function getBranches()
  20822. {
  20823. if (null === $this->branches) {
  20824. $branches = array();
  20825. $bookmarks = array();
  20826. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  20827. foreach ($this->process->splitLines($output) as $branch) {
  20828. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  20829. $branches[$branch] = $branch;
  20830. }
  20831. $this->branches = $branches;
  20832. }
  20833. return $this->branches;
  20834. }
  20835. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20836. {
  20837. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  20838. return true;
  20839. }
  20840. if (preg_match('!/fossil/|\.fossil!', $url))
  20841. {
  20842. return true;
  20843. }
  20844. if (Filesystem::isLocalPath($url)) {
  20845. $url = Filesystem::getPlatformPath($url);
  20846. if (!is_dir($url)) {
  20847. return false;
  20848. }
  20849. $process = new ProcessExecutor();
  20850. if ($process->execute('fossil info', $output, $url) === 0) {
  20851. return true;
  20852. }
  20853. }
  20854. return false;
  20855. }
  20856. }
  20857. <?php
  20858. namespace Composer\Repository\Vcs;
  20859. use Composer\Config;
  20860. use Composer\Json\JsonFile;
  20861. use Composer\IO\IOInterface;
  20862. class GitBitbucketDriver extends BitbucketDriver implements VcsDriverInterface
  20863. {
  20864. public function getRootIdentifier()
  20865. {
  20866. if ($this->fallbackDriver) {
  20867. return $this->fallbackDriver->getRootIdentifier();
  20868. }
  20869. if (null === $this->rootIdentifier) {
  20870. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository;
  20871. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  20872. $this->hasIssues = !empty($repoData['has_issues']);
  20873. $this->rootIdentifier = !empty($repoData['main_branch']) ? $repoData['main_branch'] : 'master';
  20874. }
  20875. return $this->rootIdentifier;
  20876. }
  20877. public function getUrl()
  20878. {
  20879. if ($this->fallbackDriver) {
  20880. return $this->fallbackDriver->getUrl();
  20881. }
  20882. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  20883. }
  20884. public function getSource($identifier)
  20885. {
  20886. if ($this->fallbackDriver) {
  20887. return $this->fallbackDriver->getSource($identifier);
  20888. }
  20889. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  20890. }
  20891. public function getDist($identifier)
  20892. {
  20893. $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
  20894. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  20895. }
  20896. public function getTags()
  20897. {
  20898. if ($this->fallbackDriver) {
  20899. return $this->fallbackDriver->getTags();
  20900. }
  20901. if (null === $this->tags) {
  20902. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  20903. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  20904. $this->tags = array();
  20905. foreach ($tagsData as $tag => $data) {
  20906. $this->tags[$tag] = $data['raw_node'];
  20907. }
  20908. }
  20909. return $this->tags;
  20910. }
  20911. public function getBranches()
  20912. {
  20913. if ($this->fallbackDriver) {
  20914. return $this->fallbackDriver->getBranches();
  20915. }
  20916. if (null === $this->branches) {
  20917. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
  20918. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  20919. $this->branches = array();
  20920. foreach ($branchData as $branch => $data) {
  20921. $this->branches[$branch] = $data['raw_node'];
  20922. }
  20923. }
  20924. return $this->branches;
  20925. }
  20926. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20927. {
  20928. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  20929. return false;
  20930. }
  20931. if (!extension_loaded('openssl')) {
  20932. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  20933. return false;
  20934. }
  20935. return true;
  20936. }
  20937. protected function setupFallbackDriver($url)
  20938. {
  20939. $this->fallbackDriver = new GitDriver(
  20940. array('url' => $url),
  20941. $this->io,
  20942. $this->config,
  20943. $this->process,
  20944. $this->remoteFilesystem
  20945. );
  20946. $this->fallbackDriver->initialize();
  20947. }
  20948. protected function generateSshUrl()
  20949. {
  20950. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  20951. }
  20952. }
  20953. <?php
  20954. namespace Composer\Repository\Vcs;
  20955. use Composer\Json\JsonFile;
  20956. use Composer\Util\ProcessExecutor;
  20957. use Composer\Util\Filesystem;
  20958. use Composer\Util\Git as GitUtil;
  20959. use Composer\IO\IOInterface;
  20960. use Composer\Cache;
  20961. use Composer\Config;
  20962. class GitDriver extends VcsDriver
  20963. {
  20964. protected $cache;
  20965. protected $tags;
  20966. protected $branches;
  20967. protected $rootIdentifier;
  20968. protected $repoDir;
  20969. protected $infoCache = array();
  20970. public function initialize()
  20971. {
  20972. if (Filesystem::isLocalPath($this->url)) {
  20973. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  20974. $this->repoDir = $this->url;
  20975. $cacheUrl = realpath($this->url);
  20976. } else {
  20977. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  20978. GitUtil::cleanEnv();
  20979. $fs = new Filesystem();
  20980. $fs->ensureDirectoryExists(dirname($this->repoDir));
  20981. if (!is_writable(dirname($this->repoDir))) {
  20982. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  20983. }
  20984. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  20985. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  20986. }
  20987. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  20988. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  20989. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  20990. }
  20991. $cacheUrl = $this->url;
  20992. }
  20993. $this->getTags();
  20994. $this->getBranches();
  20995. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  20996. }
  20997. public function getRootIdentifier()
  20998. {
  20999. if (null === $this->rootIdentifier) {
  21000. $this->rootIdentifier = 'master';
  21001. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  21002. $branches = $this->process->splitLines($output);
  21003. if (!in_array('* master', $branches)) {
  21004. foreach ($branches as $branch) {
  21005. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  21006. $this->rootIdentifier = $match[1];
  21007. break;
  21008. }
  21009. }
  21010. }
  21011. }
  21012. return $this->rootIdentifier;
  21013. }
  21014. public function getUrl()
  21015. {
  21016. return $this->url;
  21017. }
  21018. public function getSource($identifier)
  21019. {
  21020. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  21021. }
  21022. public function getDist($identifier)
  21023. {
  21024. return null;
  21025. }
  21026. public function getFileContent($file, $identifier)
  21027. {
  21028. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21029. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  21030. if (!trim($content)) {
  21031. return null;
  21032. }
  21033. return $content;
  21034. }
  21035. public function getChangeDate($identifier)
  21036. {
  21037. $this->process->execute(sprintf(
  21038. 'git log -1 --format=%%at %s',
  21039. ProcessExecutor::escape($identifier)
  21040. ), $output, $this->repoDir);
  21041. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  21042. }
  21043. public function getTags()
  21044. {
  21045. if (null === $this->tags) {
  21046. $this->tags = array();
  21047. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  21048. foreach ($output = $this->process->splitLines($output) as $tag) {
  21049. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  21050. $this->tags[$match[2]] = $match[1];
  21051. }
  21052. }
  21053. }
  21054. return $this->tags;
  21055. }
  21056. public function getBranches()
  21057. {
  21058. if (null === $this->branches) {
  21059. $branches = array();
  21060. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  21061. foreach ($this->process->splitLines($output) as $branch) {
  21062. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  21063. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  21064. $branches[$match[1]] = $match[2];
  21065. }
  21066. }
  21067. }
  21068. $this->branches = $branches;
  21069. }
  21070. return $this->branches;
  21071. }
  21072. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21073. {
  21074. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  21075. return true;
  21076. }
  21077. if (Filesystem::isLocalPath($url)) {
  21078. $url = Filesystem::getPlatformPath($url);
  21079. if (!is_dir($url)) {
  21080. return false;
  21081. }
  21082. $process = new ProcessExecutor($io);
  21083. if ($process->execute('git tag', $output, $url) === 0) {
  21084. return true;
  21085. }
  21086. }
  21087. if (!$deep) {
  21088. return false;
  21089. }
  21090. $process = new ProcessExecutor($io);
  21091. if ($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0) {
  21092. return true;
  21093. }
  21094. return false;
  21095. }
  21096. }
  21097. <?php
  21098. namespace Composer\Repository\Vcs;
  21099. use Composer\Config;
  21100. use Composer\Downloader\TransportException;
  21101. use Composer\Json\JsonFile;
  21102. use Composer\Cache;
  21103. use Composer\IO\IOInterface;
  21104. use Composer\Util\GitHub;
  21105. class GitHubDriver extends VcsDriver
  21106. {
  21107. protected $cache;
  21108. protected $owner;
  21109. protected $repository;
  21110. protected $tags;
  21111. protected $branches;
  21112. protected $rootIdentifier;
  21113. protected $repoData;
  21114. protected $hasIssues;
  21115. protected $infoCache = array();
  21116. protected $isPrivate = false;
  21117. protected $gitDriver;
  21118. public function initialize()
  21119. {
  21120. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  21121. $this->owner = $match[3];
  21122. $this->repository = $match[4];
  21123. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  21124. if ($this->originUrl === 'www.github.com') {
  21125. $this->originUrl = 'github.com';
  21126. }
  21127. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  21128. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  21129. $this->setupGitDriver($this->url);
  21130. return;
  21131. }
  21132. $this->fetchRootIdentifier();
  21133. }
  21134. public function getRepositoryUrl()
  21135. {
  21136. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  21137. }
  21138. public function getRootIdentifier()
  21139. {
  21140. if ($this->gitDriver) {
  21141. return $this->gitDriver->getRootIdentifier();
  21142. }
  21143. return $this->rootIdentifier;
  21144. }
  21145. public function getUrl()
  21146. {
  21147. if ($this->gitDriver) {
  21148. return $this->gitDriver->getUrl();
  21149. }
  21150. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  21151. }
  21152. protected function getApiUrl()
  21153. {
  21154. if ('github.com' === $this->originUrl) {
  21155. $apiUrl = 'api.github.com';
  21156. } else {
  21157. $apiUrl = $this->originUrl . '/api/v3';
  21158. }
  21159. return 'https://' . $apiUrl;
  21160. }
  21161. public function getSource($identifier)
  21162. {
  21163. if ($this->gitDriver) {
  21164. return $this->gitDriver->getSource($identifier);
  21165. }
  21166. if ($this->isPrivate) {
  21167. $url = $this->generateSshUrl();
  21168. } else {
  21169. $url = $this->getUrl();
  21170. }
  21171. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  21172. }
  21173. public function getDist($identifier)
  21174. {
  21175. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  21176. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21177. }
  21178. public function getComposerInformation($identifier)
  21179. {
  21180. if ($this->gitDriver) {
  21181. return $this->gitDriver->getComposerInformation($identifier);
  21182. }
  21183. if (!isset($this->infoCache[$identifier])) {
  21184. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  21185. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21186. }
  21187. $composer = $this->getBaseComposerInformation($identifier);
  21188. if ($composer) {
  21189. if (!isset($composer['support']['source'])) {
  21190. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  21191. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  21192. }
  21193. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21194. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  21195. }
  21196. }
  21197. if ($this->shouldCache($identifier)) {
  21198. $this->cache->write($identifier, json_encode($composer));
  21199. }
  21200. $this->infoCache[$identifier] = $composer;
  21201. }
  21202. return $this->infoCache[$identifier];
  21203. }
  21204. public function getFileContent($file, $identifier)
  21205. {
  21206. if ($this->gitDriver) {
  21207. return $this->gitDriver->getFileContent($file, $identifier);
  21208. }
  21209. $notFoundRetries = 2;
  21210. while ($notFoundRetries) {
  21211. try {
  21212. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  21213. $resource = JsonFile::parseJson($this->getContents($resource));
  21214. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  21215. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  21216. }
  21217. return $content;
  21218. } catch (TransportException $e) {
  21219. if (404 !== $e->getCode()) {
  21220. throw $e;
  21221. }
  21222. $notFoundRetries--;
  21223. return null;
  21224. }
  21225. }
  21226. return null;
  21227. }
  21228. public function getChangeDate($identifier) {
  21229. if ($this->gitDriver) {
  21230. return $this->gitDriver->getChangeDate($identifier);
  21231. }
  21232. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  21233. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  21234. return new \DateTime($commit['commit']['committer']['date']);
  21235. }
  21236. public function getTags()
  21237. {
  21238. if ($this->gitDriver) {
  21239. return $this->gitDriver->getTags();
  21240. }
  21241. if (null === $this->tags) {
  21242. $this->tags = array();
  21243. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  21244. do {
  21245. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  21246. foreach ($tagsData as $tag) {
  21247. $this->tags[$tag['name']] = $tag['commit']['sha'];
  21248. }
  21249. $resource = $this->getNextPage();
  21250. } while ($resource);
  21251. }
  21252. return $this->tags;
  21253. }
  21254. public function getBranches()
  21255. {
  21256. if ($this->gitDriver) {
  21257. return $this->gitDriver->getBranches();
  21258. }
  21259. if (null === $this->branches) {
  21260. $this->branches = array();
  21261. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  21262. $branchBlacklist = array('gh-pages');
  21263. do {
  21264. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  21265. foreach ($branchData as $branch) {
  21266. $name = substr($branch['ref'], 11);
  21267. if (!in_array($name, $branchBlacklist)) {
  21268. $this->branches[$name] = $branch['object']['sha'];
  21269. }
  21270. }
  21271. $resource = $this->getNextPage();
  21272. } while ($resource);
  21273. }
  21274. return $this->branches;
  21275. }
  21276. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21277. {
  21278. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  21279. return false;
  21280. }
  21281. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  21282. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  21283. return false;
  21284. }
  21285. if (!extension_loaded('openssl')) {
  21286. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21287. return false;
  21288. }
  21289. return true;
  21290. }
  21291. public function getRepoData()
  21292. {
  21293. $this->fetchRootIdentifier();
  21294. return $this->repoData;
  21295. }
  21296. protected function generateSshUrl()
  21297. {
  21298. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  21299. }
  21300. protected function getContents($url, $fetchingRepoData = false)
  21301. {
  21302. try {
  21303. return parent::getContents($url);
  21304. } catch (TransportException $e) {
  21305. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21306. switch ($e->getCode()) {
  21307. case 401:
  21308. case 404:
  21309. if (!$fetchingRepoData) {
  21310. throw $e;
  21311. }
  21312. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  21313. return parent::getContents($url);
  21314. }
  21315. if (!$this->io->isInteractive()) {
  21316. return $this->attemptCloneFallback();
  21317. }
  21318. $scopesIssued = array();
  21319. $scopesNeeded = array();
  21320. if ($headers = $e->getHeaders()) {
  21321. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  21322. $scopesIssued = explode(' ', $scopes);
  21323. }
  21324. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  21325. $scopesNeeded = explode(' ', $scopes);
  21326. }
  21327. }
  21328. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  21329. if (!$headers || count($scopesFailed)) {
  21330. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  21331. }
  21332. return parent::getContents($url);
  21333. case 403:
  21334. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  21335. return parent::getContents($url);
  21336. }
  21337. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21338. return $this->attemptCloneFallback();
  21339. }
  21340. $rateLimited = false;
  21341. foreach ($e->getHeaders() as $header) {
  21342. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  21343. $rateLimited = true;
  21344. }
  21345. }
  21346. if (!$this->io->hasAuthentication($this->originUrl)) {
  21347. if (!$this->io->isInteractive()) {
  21348. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  21349. throw $e;
  21350. }
  21351. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  21352. return parent::getContents($url);
  21353. }
  21354. if ($rateLimited) {
  21355. $rateLimit = $this->getRateLimit($e->getHeaders());
  21356. $this->io->writeError(sprintf(
  21357. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  21358. $rateLimit['limit'],
  21359. $rateLimit['reset']
  21360. ));
  21361. }
  21362. throw $e;
  21363. default:
  21364. throw $e;
  21365. }
  21366. }
  21367. }
  21368. protected function getRateLimit(array $headers)
  21369. {
  21370. $rateLimit = array(
  21371. 'limit' => '?',
  21372. 'reset' => '?',
  21373. );
  21374. foreach ($headers as $header) {
  21375. $header = trim($header);
  21376. if (false === strpos($header, 'X-RateLimit-')) {
  21377. continue;
  21378. }
  21379. list($type, $value) = explode(':', $header, 2);
  21380. switch ($type) {
  21381. case 'X-RateLimit-Limit':
  21382. $rateLimit['limit'] = (int) trim($value);
  21383. break;
  21384. case 'X-RateLimit-Reset':
  21385. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  21386. break;
  21387. }
  21388. }
  21389. return $rateLimit;
  21390. }
  21391. protected function fetchRootIdentifier()
  21392. {
  21393. if ($this->repoData) {
  21394. return;
  21395. }
  21396. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  21397. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  21398. if (null === $this->repoData && null !== $this->gitDriver) {
  21399. return;
  21400. }
  21401. $this->owner = $this->repoData['owner']['login'];
  21402. $this->repository = $this->repoData['name'];
  21403. $this->isPrivate = !empty($this->repoData['private']);
  21404. if (isset($this->repoData['default_branch'])) {
  21405. $this->rootIdentifier = $this->repoData['default_branch'];
  21406. } elseif (isset($this->repoData['master_branch'])) {
  21407. $this->rootIdentifier = $this->repoData['master_branch'];
  21408. } else {
  21409. $this->rootIdentifier = 'master';
  21410. }
  21411. $this->hasIssues = !empty($this->repoData['has_issues']);
  21412. }
  21413. protected function attemptCloneFallback()
  21414. {
  21415. $this->isPrivate = true;
  21416. try {
  21417. $this->setupGitDriver($this->generateSshUrl());
  21418. return;
  21419. } catch (\RuntimeException $e) {
  21420. $this->gitDriver = null;
  21421. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  21422. throw $e;
  21423. }
  21424. }
  21425. protected function setupGitDriver($url)
  21426. {
  21427. $this->gitDriver = new GitDriver(
  21428. array('url' => $url),
  21429. $this->io,
  21430. $this->config,
  21431. $this->process,
  21432. $this->remoteFilesystem
  21433. );
  21434. $this->gitDriver->initialize();
  21435. }
  21436. protected function getNextPage()
  21437. {
  21438. $headers = $this->remoteFilesystem->getLastHeaders();
  21439. foreach ($headers as $header) {
  21440. if (substr($header, 0, 5) === 'Link:') {
  21441. $links = explode(',', substr($header, 5));
  21442. foreach ($links as $link) {
  21443. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  21444. return $match[1];
  21445. }
  21446. }
  21447. }
  21448. }
  21449. }
  21450. }
  21451. <?php
  21452. namespace Composer\Repository\Vcs;
  21453. use Composer\Config;
  21454. use Composer\Cache;
  21455. use Composer\IO\IOInterface;
  21456. use Composer\Json\JsonFile;
  21457. use Composer\Downloader\TransportException;
  21458. use Composer\Util\RemoteFilesystem;
  21459. use Composer\Util\GitLab;
  21460. class GitLabDriver extends VcsDriver
  21461. {
  21462. private $scheme;
  21463. private $owner;
  21464. private $repository;
  21465. private $project;
  21466. private $commits = array();
  21467. private $tags;
  21468. private $branches;
  21469. protected $gitDriver;
  21470. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)/|git@(?P<domain2>[^:]+):)(?P<owner>[^/]+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  21471. public function initialize()
  21472. {
  21473. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  21474. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  21475. }
  21476. $this->scheme = !empty($match['scheme']) ? $match['scheme'] : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https');
  21477. $this->originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  21478. $this->owner = $match['owner'];
  21479. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  21480. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  21481. $this->fetchProject();
  21482. }
  21483. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  21484. {
  21485. $this->remoteFilesystem = $remoteFilesystem;
  21486. }
  21487. public function getFileContent($file, $identifier)
  21488. {
  21489. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  21490. $branches = $this->getBranches();
  21491. if (isset($branches[$identifier])) {
  21492. $identifier = $branches[$identifier];
  21493. }
  21494. }
  21495. $resource = $this->getApiUrl().'/repository/blobs/'.$identifier.'?filepath=' . $file;
  21496. try {
  21497. $content = $this->getContents($resource);
  21498. } catch (TransportException $e) {
  21499. if ($e->getCode() !== 404) {
  21500. throw $e;
  21501. }
  21502. return null;
  21503. }
  21504. return $content;
  21505. }
  21506. public function getChangeDate($identifier)
  21507. {
  21508. if (isset($this->commits[$identifier])) {
  21509. return new \DateTime($this->commits[$identifier]['committed_date']);
  21510. }
  21511. return new \DateTime();
  21512. }
  21513. public function getRepositoryUrl()
  21514. {
  21515. return $this->project['public'] ? $this->project['http_url_to_repo'] : $this->project['ssh_url_to_repo'];
  21516. }
  21517. public function getUrl()
  21518. {
  21519. return $this->project['web_url'];
  21520. }
  21521. public function getDist($identifier)
  21522. {
  21523. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  21524. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21525. }
  21526. public function getSource($identifier)
  21527. {
  21528. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  21529. }
  21530. public function getRootIdentifier()
  21531. {
  21532. return $this->project['default_branch'];
  21533. }
  21534. public function getBranches()
  21535. {
  21536. if (!$this->branches) {
  21537. $this->branches = $this->getReferences('branches');
  21538. }
  21539. return $this->branches;
  21540. }
  21541. public function getTags()
  21542. {
  21543. if (!$this->tags) {
  21544. $this->tags = $this->getReferences('tags');
  21545. }
  21546. return $this->tags;
  21547. }
  21548. public function getApiUrl()
  21549. {
  21550. return $this->scheme.'://'.$this->originUrl.'/api/v3/projects/'.$this->urlEncodeAll($this->owner).'%2F'.$this->urlEncodeAll($this->repository);
  21551. }
  21552. private function urlEncodeAll($string)
  21553. {
  21554. $encoded = '';
  21555. for ($i = 0; isset($string[$i]); $i++) {
  21556. $character = $string[$i];
  21557. if (!ctype_alnum($character)) $character = '%' . sprintf('%02X', ord($character));
  21558. $encoded .= $character;
  21559. }
  21560. return $encoded;
  21561. }
  21562. protected function getReferences($type)
  21563. {
  21564. $resource = $this->getApiUrl().'/repository/'.$type;
  21565. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  21566. $references = array();
  21567. foreach ($data as $datum) {
  21568. $references[$datum['name']] = $datum['commit']['id'];
  21569. $this->commits[$datum['commit']['id']] = $datum['commit'];
  21570. }
  21571. return $references;
  21572. }
  21573. protected function fetchProject()
  21574. {
  21575. $resource = $this->getApiUrl();
  21576. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  21577. }
  21578. protected function attemptCloneFallback()
  21579. {
  21580. try {
  21581. $this->setupGitDriver($this->generateSshUrl());
  21582. return;
  21583. } catch (\RuntimeException $e) {
  21584. $this->gitDriver = null;
  21585. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your credentials</error>');
  21586. throw $e;
  21587. }
  21588. }
  21589. protected function generateSshUrl()
  21590. {
  21591. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  21592. }
  21593. protected function setupGitDriver($url)
  21594. {
  21595. $this->gitDriver = new GitDriver(
  21596. array('url' => $url),
  21597. $this->io,
  21598. $this->config,
  21599. $this->process,
  21600. $this->remoteFilesystem
  21601. );
  21602. $this->gitDriver->initialize();
  21603. }
  21604. protected function getContents($url, $fetchingRepoData = false)
  21605. {
  21606. try {
  21607. return parent::getContents($url);
  21608. } catch (TransportException $e) {
  21609. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21610. switch ($e->getCode()) {
  21611. case 401:
  21612. case 404:
  21613. if (!$fetchingRepoData) {
  21614. throw $e;
  21615. }
  21616. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  21617. return parent::getContents($url);
  21618. }
  21619. if (!$this->io->isInteractive()) {
  21620. return $this->attemptCloneFallback();
  21621. }
  21622. $this->io->writeError('<warning>Failed to download ' . $this->owner . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  21623. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  21624. return parent::getContents($url);
  21625. case 403:
  21626. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  21627. return parent::getContents($url);
  21628. }
  21629. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21630. return $this->attemptCloneFallback();
  21631. }
  21632. throw $e;
  21633. default:
  21634. throw $e;
  21635. }
  21636. }
  21637. }
  21638. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21639. {
  21640. if (!preg_match(self::URL_REGEX, $url, $match)) {
  21641. return false;
  21642. }
  21643. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  21644. $originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  21645. if (!in_array($originUrl, (array) $config->get('gitlab-domains'))) {
  21646. return false;
  21647. }
  21648. if ('https' === $scheme && !extension_loaded('openssl')) {
  21649. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21650. return false;
  21651. }
  21652. return true;
  21653. }
  21654. }
  21655. <?php
  21656. namespace Composer\Repository\Vcs;
  21657. use Composer\Config;
  21658. use Composer\Json\JsonFile;
  21659. use Composer\IO\IOInterface;
  21660. class HgBitbucketDriver extends BitbucketDriver
  21661. {
  21662. public function getRootIdentifier()
  21663. {
  21664. if (null === $this->rootIdentifier) {
  21665. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  21666. $repoData = JsonFile::parseJson($this->getContents($resource), $resource);
  21667. if (array() === $repoData || !isset($repoData['tip'])) {
  21668. throw new \RuntimeException($this->url.' does not appear to be a mercurial repository, use '.$this->url.'.git if this is a git bitbucket repository');
  21669. }
  21670. $this->hasIssues = !empty($repoData['has_issues']);
  21671. $this->rootIdentifier = $repoData['tip']['raw_node'];
  21672. }
  21673. return $this->rootIdentifier;
  21674. }
  21675. public function getUrl()
  21676. {
  21677. return $this->url;
  21678. }
  21679. public function getSource($identifier)
  21680. {
  21681. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  21682. }
  21683. public function getDist($identifier)
  21684. {
  21685. $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
  21686. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21687. }
  21688. public function getTags()
  21689. {
  21690. if (null === $this->tags) {
  21691. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  21692. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  21693. $this->tags = array();
  21694. foreach ($tagsData as $tag => $data) {
  21695. $this->tags[$tag] = $data['raw_node'];
  21696. }
  21697. unset($this->tags['tip']);
  21698. }
  21699. return $this->tags;
  21700. }
  21701. public function getBranches()
  21702. {
  21703. if (null === $this->branches) {
  21704. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
  21705. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  21706. $this->branches = array();
  21707. foreach ($branchData as $branch => $data) {
  21708. $this->branches[$branch] = $data['raw_node'];
  21709. }
  21710. }
  21711. return $this->branches;
  21712. }
  21713. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21714. {
  21715. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  21716. return false;
  21717. }
  21718. if (!extension_loaded('openssl')) {
  21719. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21720. return false;
  21721. }
  21722. return true;
  21723. }
  21724. protected function setupFallbackDriver($url)
  21725. {
  21726. $this->fallbackDriver = new HgDriver(
  21727. array('url' => $url),
  21728. $this->io,
  21729. $this->config,
  21730. $this->process,
  21731. $this->remoteFilesystem
  21732. );
  21733. $this->fallbackDriver->initialize();
  21734. }
  21735. protected function generateSshUrl()
  21736. {
  21737. return 'hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  21738. }
  21739. }
  21740. <?php
  21741. namespace Composer\Repository\Vcs;
  21742. use Composer\Config;
  21743. use Composer\Json\JsonFile;
  21744. use Composer\Util\ProcessExecutor;
  21745. use Composer\Util\Filesystem;
  21746. use Composer\IO\IOInterface;
  21747. use Symfony\Component\Process\Process;
  21748. class HgDriver extends VcsDriver
  21749. {
  21750. protected $tags;
  21751. protected $branches;
  21752. protected $rootIdentifier;
  21753. protected $repoDir;
  21754. protected $infoCache = array();
  21755. public function initialize()
  21756. {
  21757. if (Filesystem::isLocalPath($this->url)) {
  21758. $this->repoDir = $this->url;
  21759. } else {
  21760. $cacheDir = $this->config->get('cache-vcs-dir');
  21761. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  21762. $fs = new Filesystem();
  21763. $fs->ensureDirectoryExists($cacheDir);
  21764. if (!is_writable(dirname($this->repoDir))) {
  21765. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  21766. }
  21767. $this->config->prohibitUrlByConfig($this->url, $this->io);
  21768. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  21769. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  21770. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  21771. }
  21772. } else {
  21773. $fs->removeDirectory($this->repoDir);
  21774. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  21775. $output = $this->process->getErrorOutput();
  21776. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  21777. throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  21778. }
  21779. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  21780. }
  21781. }
  21782. }
  21783. $this->getTags();
  21784. $this->getBranches();
  21785. }
  21786. public function getRootIdentifier()
  21787. {
  21788. if (null === $this->rootIdentifier) {
  21789. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  21790. $output = $this->process->splitLines($output);
  21791. $this->rootIdentifier = $output[0];
  21792. }
  21793. return $this->rootIdentifier;
  21794. }
  21795. public function getUrl()
  21796. {
  21797. return $this->url;
  21798. }
  21799. public function getSource($identifier)
  21800. {
  21801. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  21802. }
  21803. public function getDist($identifier)
  21804. {
  21805. return null;
  21806. }
  21807. public function getFileContent($file, $identifier)
  21808. {
  21809. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21810. $this->process->execute(sprintf('hg cat -r %s', $resource), $content, $this->repoDir);
  21811. if (!trim($content)) {
  21812. return;
  21813. }
  21814. return $content;
  21815. }
  21816. public function getChangeDate($identifier)
  21817. {
  21818. $this->process->execute(
  21819. sprintf(
  21820. 'hg log --template "{date|rfc3339date}" -r %s',
  21821. ProcessExecutor::escape($identifier)
  21822. ),
  21823. $output,
  21824. $this->repoDir
  21825. );
  21826. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  21827. }
  21828. public function getTags()
  21829. {
  21830. if (null === $this->tags) {
  21831. $tags = array();
  21832. $this->process->execute('hg tags', $output, $this->repoDir);
  21833. foreach ($this->process->splitLines($output) as $tag) {
  21834. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  21835. $tags[$match[1]] = $match[2];
  21836. }
  21837. }
  21838. unset($tags['tip']);
  21839. $this->tags = $tags;
  21840. }
  21841. return $this->tags;
  21842. }
  21843. public function getBranches()
  21844. {
  21845. if (null === $this->branches) {
  21846. $branches = array();
  21847. $bookmarks = array();
  21848. $this->process->execute('hg branches', $output, $this->repoDir);
  21849. foreach ($this->process->splitLines($output) as $branch) {
  21850. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  21851. $branches[$match[1]] = $match[2];
  21852. }
  21853. }
  21854. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  21855. foreach ($this->process->splitLines($output) as $branch) {
  21856. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  21857. $bookmarks[$match[1]] = $match[2];
  21858. }
  21859. }
  21860. $this->branches = array_merge($bookmarks, $branches);
  21861. }
  21862. return $this->branches;
  21863. }
  21864. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21865. {
  21866. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  21867. return true;
  21868. }
  21869. if (Filesystem::isLocalPath($url)) {
  21870. $url = Filesystem::getPlatformPath($url);
  21871. if (!is_dir($url)) {
  21872. return false;
  21873. }
  21874. $process = new ProcessExecutor();
  21875. if ($process->execute('hg summary', $output, $url) === 0) {
  21876. return true;
  21877. }
  21878. }
  21879. if (!$deep) {
  21880. return false;
  21881. }
  21882. $processExecutor = new ProcessExecutor();
  21883. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  21884. return $exit === 0;
  21885. }
  21886. }
  21887. <?php
  21888. namespace Composer\Repository\Vcs;
  21889. use Composer\Config;
  21890. use Composer\IO\IOInterface;
  21891. use Composer\Util\ProcessExecutor;
  21892. use Composer\Util\Perforce;
  21893. class PerforceDriver extends VcsDriver
  21894. {
  21895. protected $depot;
  21896. protected $branch;
  21897. protected $perforce;
  21898. public function initialize()
  21899. {
  21900. $this->depot = $this->repoConfig['depot'];
  21901. $this->branch = '';
  21902. if (!empty($this->repoConfig['branch'])) {
  21903. $this->branch = $this->repoConfig['branch'];
  21904. }
  21905. $this->initPerforce($this->repoConfig);
  21906. $this->perforce->p4Login();
  21907. $this->perforce->checkStream();
  21908. $this->perforce->writeP4ClientSpec();
  21909. $this->perforce->connectClient();
  21910. return true;
  21911. }
  21912. private function initPerforce($repoConfig)
  21913. {
  21914. if (!empty($this->perforce)) {
  21915. return;
  21916. }
  21917. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  21918. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  21919. }
  21920. public function getFileContent($file, $identifier)
  21921. {
  21922. return $this->perforce->getFileContent($file, $identifier);
  21923. }
  21924. public function getChangeDate($identifier)
  21925. {
  21926. return null;
  21927. }
  21928. public function getRootIdentifier()
  21929. {
  21930. return $this->branch;
  21931. }
  21932. public function getBranches()
  21933. {
  21934. $branches = $this->perforce->getBranches();
  21935. return $branches;
  21936. }
  21937. public function getTags()
  21938. {
  21939. $tags = $this->perforce->getTags();
  21940. return $tags;
  21941. }
  21942. public function getDist($identifier)
  21943. {
  21944. return null;
  21945. }
  21946. public function getSource($identifier)
  21947. {
  21948. $source = array(
  21949. 'type' => 'perforce',
  21950. 'url' => $this->repoConfig['url'],
  21951. 'reference' => $identifier,
  21952. 'p4user' => $this->perforce->getUser(),
  21953. );
  21954. return $source;
  21955. }
  21956. public function getUrl()
  21957. {
  21958. return $this->url;
  21959. }
  21960. public function hasComposerFile($identifier)
  21961. {
  21962. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  21963. $composerInfoIdentifier = $identifier;
  21964. return !empty($composerInfo);
  21965. }
  21966. public function getContents($url)
  21967. {
  21968. return false;
  21969. }
  21970. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21971. {
  21972. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  21973. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  21974. }
  21975. return false;
  21976. }
  21977. public function cleanup()
  21978. {
  21979. $this->perforce->cleanupClientSpec();
  21980. $this->perforce = null;
  21981. }
  21982. public function getDepot()
  21983. {
  21984. return $this->depot;
  21985. }
  21986. public function getBranch()
  21987. {
  21988. return $this->branch;
  21989. }
  21990. }
  21991. <?php
  21992. namespace Composer\Repository\Vcs;
  21993. use Composer\Cache;
  21994. use Composer\Config;
  21995. use Composer\Json\JsonFile;
  21996. use Composer\Util\ProcessExecutor;
  21997. use Composer\Util\Filesystem;
  21998. use Composer\Util\Svn as SvnUtil;
  21999. use Composer\IO\IOInterface;
  22000. use Composer\Downloader\TransportException;
  22001. class SvnDriver extends VcsDriver
  22002. {
  22003. protected $cache;
  22004. protected $baseUrl;
  22005. protected $tags;
  22006. protected $branches;
  22007. protected $rootIdentifier;
  22008. protected $infoCache = array();
  22009. protected $trunkPath = 'trunk';
  22010. protected $branchesPath = 'branches';
  22011. protected $tagsPath = 'tags';
  22012. protected $packagePath = '';
  22013. protected $cacheCredentials = true;
  22014. private $util;
  22015. public function initialize()
  22016. {
  22017. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  22018. SvnUtil::cleanEnv();
  22019. if (isset($this->repoConfig['trunk-path'])) {
  22020. $this->trunkPath = $this->repoConfig['trunk-path'];
  22021. }
  22022. if (isset($this->repoConfig['branches-path'])) {
  22023. $this->branchesPath = $this->repoConfig['branches-path'];
  22024. }
  22025. if (isset($this->repoConfig['tags-path'])) {
  22026. $this->tagsPath = $this->repoConfig['tags-path'];
  22027. }
  22028. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  22029. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  22030. }
  22031. if (isset($this->repoConfig['package-path'])) {
  22032. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  22033. }
  22034. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  22035. $this->baseUrl = substr($this->url, 0, $pos);
  22036. }
  22037. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  22038. $this->getBranches();
  22039. $this->getTags();
  22040. }
  22041. public function getRootIdentifier()
  22042. {
  22043. return $this->rootIdentifier ?: $this->trunkPath;
  22044. }
  22045. public function getUrl()
  22046. {
  22047. return $this->url;
  22048. }
  22049. public function getSource($identifier)
  22050. {
  22051. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  22052. }
  22053. public function getDist($identifier)
  22054. {
  22055. return null;
  22056. }
  22057. public function getComposerInformation($identifier)
  22058. {
  22059. if (!isset($this->infoCache[$identifier])) {
  22060. if ($res = $this->cache->read($identifier.'.json')) {
  22061. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22062. }
  22063. $composer = $this->getBaseComposerInformation($identifier);
  22064. $this->cache->write($identifier.'.json', json_encode($composer));
  22065. $this->infoCache[$identifier] = $composer;
  22066. }
  22067. return $this->infoCache[$identifier];
  22068. }
  22069. public function getFileContent($file, $identifier)
  22070. {
  22071. $identifier = '/' . trim($identifier, '/') . '/';
  22072. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  22073. if (!empty($match[2])) {
  22074. $path = $match[1];
  22075. $rev = $match[2];
  22076. } else {
  22077. $path = $identifier;
  22078. $rev = '';
  22079. }
  22080. try {
  22081. $resource = $path.$file;
  22082. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  22083. if (!trim($output)) {
  22084. return null;
  22085. }
  22086. } catch (\RuntimeException $e) {
  22087. throw new TransportException($e->getMessage());
  22088. }
  22089. return $output;
  22090. }
  22091. public function getChangeDate($identifier)
  22092. {
  22093. $identifier = '/' . trim($identifier, '/') . '/';
  22094. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  22095. if (!empty($match[2])) {
  22096. $path = $match[1];
  22097. $rev = $match[2];
  22098. } else {
  22099. $path = $identifier;
  22100. $rev = '';
  22101. }
  22102. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  22103. foreach ($this->process->splitLines($output) as $line) {
  22104. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  22105. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  22106. }
  22107. }
  22108. return null;
  22109. }
  22110. public function getTags()
  22111. {
  22112. if (null === $this->tags) {
  22113. $this->tags = array();
  22114. if ($this->tagsPath !== false) {
  22115. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  22116. if ($output) {
  22117. foreach ($this->process->splitLines($output) as $line) {
  22118. $line = trim($line);
  22119. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  22120. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  22121. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  22122. '/' . $this->tagsPath . '/' . $match[2],
  22123. $match[1]
  22124. );
  22125. }
  22126. }
  22127. }
  22128. }
  22129. }
  22130. }
  22131. return $this->tags;
  22132. }
  22133. public function getBranches()
  22134. {
  22135. if (null === $this->branches) {
  22136. $this->branches = array();
  22137. if (false === $this->trunkPath) {
  22138. $trunkParent = $this->baseUrl . '/';
  22139. } else {
  22140. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  22141. }
  22142. $output = $this->execute('svn ls --verbose', $trunkParent);
  22143. if ($output) {
  22144. foreach ($this->process->splitLines($output) as $line) {
  22145. $line = trim($line);
  22146. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  22147. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  22148. $this->branches['trunk'] = $this->buildIdentifier(
  22149. '/' . $this->trunkPath,
  22150. $match[1]
  22151. );
  22152. $this->rootIdentifier = $this->branches['trunk'];
  22153. break;
  22154. }
  22155. }
  22156. }
  22157. }
  22158. unset($output);
  22159. if ($this->branchesPath !== false) {
  22160. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  22161. if ($output) {
  22162. foreach ($this->process->splitLines(trim($output)) as $line) {
  22163. $line = trim($line);
  22164. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  22165. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  22166. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  22167. '/' . $this->branchesPath . '/' . $match[2],
  22168. $match[1]
  22169. );
  22170. }
  22171. }
  22172. }
  22173. }
  22174. }
  22175. }
  22176. return $this->branches;
  22177. }
  22178. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22179. {
  22180. $url = self::normalizeUrl($url);
  22181. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  22182. return true;
  22183. }
  22184. if (!$deep && !Filesystem::isLocalPath($url)) {
  22185. return false;
  22186. }
  22187. $processExecutor = new ProcessExecutor();
  22188. $exit = $processExecutor->execute(
  22189. "svn info --non-interactive {$url}",
  22190. $ignoredOutput
  22191. );
  22192. if ($exit === 0) {
  22193. return true;
  22194. }
  22195. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  22196. return true;
  22197. }
  22198. return false;
  22199. }
  22200. protected static function normalizeUrl($url)
  22201. {
  22202. $fs = new Filesystem();
  22203. if ($fs->isAbsolutePath($url)) {
  22204. return 'file://' . strtr($url, '\\', '/');
  22205. }
  22206. return $url;
  22207. }
  22208. protected function execute($command, $url)
  22209. {
  22210. if (null === $this->util) {
  22211. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  22212. $this->util->setCacheCredentials($this->cacheCredentials);
  22213. }
  22214. try {
  22215. return $this->util->execute($command, $url);
  22216. } catch (\RuntimeException $e) {
  22217. if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
  22218. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  22219. }
  22220. throw new \RuntimeException(
  22221. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  22222. );
  22223. }
  22224. }
  22225. protected function buildIdentifier($baseDir, $revision)
  22226. {
  22227. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  22228. }
  22229. }
  22230. <?php
  22231. namespace Composer\Repository\Vcs;
  22232. use Composer\Cache;
  22233. use Composer\Downloader\TransportException;
  22234. use Composer\Config;
  22235. use Composer\Factory;
  22236. use Composer\IO\IOInterface;
  22237. use Composer\Json\JsonFile;
  22238. use Composer\Util\ProcessExecutor;
  22239. use Composer\Util\RemoteFilesystem;
  22240. use Composer\Util\Filesystem;
  22241. abstract class VcsDriver implements VcsDriverInterface
  22242. {
  22243. protected $url;
  22244. protected $originUrl;
  22245. protected $repoConfig;
  22246. protected $io;
  22247. protected $config;
  22248. protected $process;
  22249. protected $remoteFilesystem;
  22250. protected $infoCache = array();
  22251. protected $cache;
  22252. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  22253. {
  22254. if (Filesystem::isLocalPath($repoConfig['url'])) {
  22255. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  22256. }
  22257. $this->url = $repoConfig['url'];
  22258. $this->originUrl = $repoConfig['url'];
  22259. $this->repoConfig = $repoConfig;
  22260. $this->io = $io;
  22261. $this->config = $config;
  22262. $this->process = $process ?: new ProcessExecutor($io);
  22263. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  22264. }
  22265. protected function shouldCache($identifier)
  22266. {
  22267. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  22268. }
  22269. public function getComposerInformation($identifier)
  22270. {
  22271. if (!isset($this->infoCache[$identifier])) {
  22272. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22273. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22274. }
  22275. $composer = $this->getBaseComposerInformation($identifier);
  22276. if ($this->shouldCache($identifier)) {
  22277. $this->cache->write($identifier, json_encode($composer));
  22278. }
  22279. $this->infoCache[$identifier] = $composer;
  22280. }
  22281. return $this->infoCache[$identifier];
  22282. }
  22283. protected function getBaseComposerInformation($identifier)
  22284. {
  22285. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  22286. if (!$composerFileContent) {
  22287. return null;
  22288. }
  22289. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  22290. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  22291. $composer['time'] = $changeDate->format('Y-m-d H:i:s');
  22292. }
  22293. return $composer;
  22294. }
  22295. public function hasComposerFile($identifier)
  22296. {
  22297. try {
  22298. return (bool) $this->getComposerInformation($identifier);
  22299. } catch (TransportException $e) {
  22300. }
  22301. return false;
  22302. }
  22303. protected function getScheme()
  22304. {
  22305. if (extension_loaded('openssl')) {
  22306. return 'https';
  22307. }
  22308. return 'http';
  22309. }
  22310. protected function getContents($url)
  22311. {
  22312. return $this->remoteFilesystem->getContents($this->originUrl, $url, false);
  22313. }
  22314. public function cleanup()
  22315. {
  22316. return;
  22317. }
  22318. }
  22319. <?php
  22320. namespace Composer\Repository\Vcs;
  22321. use Composer\Config;
  22322. use Composer\IO\IOInterface;
  22323. interface VcsDriverInterface
  22324. {
  22325. public function initialize();
  22326. public function getComposerInformation($identifier);
  22327. public function getFileContent($file, $identifier);
  22328. public function getChangeDate($identifier);
  22329. public function getRootIdentifier();
  22330. public function getBranches();
  22331. public function getTags();
  22332. public function getDist($identifier);
  22333. public function getSource($identifier);
  22334. public function getUrl();
  22335. public function hasComposerFile($identifier);
  22336. public function cleanup();
  22337. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  22338. }
  22339. <?php
  22340. namespace Composer\Repository;
  22341. use Composer\Downloader\TransportException;
  22342. use Composer\Repository\Vcs\VcsDriverInterface;
  22343. use Composer\Package\Version\VersionParser;
  22344. use Composer\Package\Loader\ArrayLoader;
  22345. use Composer\Package\Loader\ValidatingArrayLoader;
  22346. use Composer\Package\Loader\InvalidPackageException;
  22347. use Composer\Package\Loader\LoaderInterface;
  22348. use Composer\EventDispatcher\EventDispatcher;
  22349. use Composer\IO\IOInterface;
  22350. use Composer\Config;
  22351. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22352. {
  22353. protected $url;
  22354. protected $packageName;
  22355. protected $verbose;
  22356. protected $io;
  22357. protected $config;
  22358. protected $versionParser;
  22359. protected $type;
  22360. protected $loader;
  22361. protected $repoConfig;
  22362. protected $branchErrorOccurred = false;
  22363. private $drivers;
  22364. private $driver;
  22365. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  22366. {
  22367. parent::__construct();
  22368. $this->drivers = $drivers ?: array(
  22369. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  22370. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  22371. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  22372. 'git' => 'Composer\Repository\Vcs\GitDriver',
  22373. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  22374. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  22375. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  22376. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  22377. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  22378. );
  22379. $this->url = $repoConfig['url'];
  22380. $this->io = $io;
  22381. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  22382. $this->verbose = $io->isVeryVerbose();
  22383. $this->config = $config;
  22384. $this->repoConfig = $repoConfig;
  22385. }
  22386. public function getRepoConfig()
  22387. {
  22388. return $this->repoConfig;
  22389. }
  22390. public function setLoader(LoaderInterface $loader)
  22391. {
  22392. $this->loader = $loader;
  22393. }
  22394. public function getDriver()
  22395. {
  22396. if ($this->driver) {
  22397. return $this->driver;
  22398. }
  22399. if (isset($this->drivers[$this->type])) {
  22400. $class = $this->drivers[$this->type];
  22401. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  22402. $this->driver->initialize();
  22403. return $this->driver;
  22404. }
  22405. foreach ($this->drivers as $driver) {
  22406. if ($driver::supports($this->io, $this->config, $this->url)) {
  22407. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  22408. $this->driver->initialize();
  22409. return $this->driver;
  22410. }
  22411. }
  22412. foreach ($this->drivers as $driver) {
  22413. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  22414. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  22415. $this->driver->initialize();
  22416. return $this->driver;
  22417. }
  22418. }
  22419. }
  22420. public function hadInvalidBranches()
  22421. {
  22422. return $this->branchErrorOccurred;
  22423. }
  22424. protected function initialize()
  22425. {
  22426. parent::initialize();
  22427. $verbose = $this->verbose;
  22428. $driver = $this->getDriver();
  22429. if (!$driver) {
  22430. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  22431. }
  22432. $this->versionParser = new VersionParser;
  22433. if (!$this->loader) {
  22434. $this->loader = new ArrayLoader($this->versionParser);
  22435. }
  22436. try {
  22437. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  22438. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  22439. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  22440. }
  22441. } catch (\Exception $e) {
  22442. if ($verbose) {
  22443. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  22444. }
  22445. }
  22446. foreach ($driver->getTags() as $tag => $identifier) {
  22447. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  22448. if ($verbose) {
  22449. $this->io->writeError($msg);
  22450. } else {
  22451. $this->io->overwriteError($msg, false);
  22452. }
  22453. $tag = str_replace('release-', '', $tag);
  22454. if (!$parsedTag = $this->validateTag($tag)) {
  22455. if ($verbose) {
  22456. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  22457. }
  22458. continue;
  22459. }
  22460. try {
  22461. if (!$data = $driver->getComposerInformation($identifier)) {
  22462. if ($verbose) {
  22463. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  22464. }
  22465. continue;
  22466. }
  22467. if (isset($data['version'])) {
  22468. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  22469. } else {
  22470. $data['version'] = $tag;
  22471. $data['version_normalized'] = $parsedTag;
  22472. }
  22473. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  22474. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  22475. if ($data['version_normalized'] !== $parsedTag) {
  22476. if ($verbose) {
  22477. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  22478. }
  22479. continue;
  22480. }
  22481. if ($verbose) {
  22482. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  22483. }
  22484. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  22485. } catch (\Exception $e) {
  22486. if ($verbose) {
  22487. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  22488. }
  22489. continue;
  22490. }
  22491. }
  22492. if (!$verbose) {
  22493. $this->io->overwriteError('', false);
  22494. }
  22495. foreach ($driver->getBranches() as $branch => $identifier) {
  22496. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  22497. if ($verbose) {
  22498. $this->io->writeError($msg);
  22499. } else {
  22500. $this->io->overwriteError($msg, false);
  22501. }
  22502. if (!$parsedBranch = $this->validateBranch($branch)) {
  22503. if ($verbose) {
  22504. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  22505. }
  22506. continue;
  22507. }
  22508. try {
  22509. if (!$data = $driver->getComposerInformation($identifier)) {
  22510. if ($verbose) {
  22511. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  22512. }
  22513. continue;
  22514. }
  22515. $data['version'] = $branch;
  22516. $data['version_normalized'] = $parsedBranch;
  22517. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  22518. $data['version'] = 'dev-' . $data['version'];
  22519. } else {
  22520. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  22521. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  22522. }
  22523. if ($verbose) {
  22524. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  22525. }
  22526. $packageData = $this->preProcess($driver, $data, $identifier);
  22527. $package = $this->loader->load($packageData);
  22528. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  22529. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  22530. }
  22531. $this->addPackage($package);
  22532. } catch (TransportException $e) {
  22533. if ($verbose) {
  22534. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  22535. }
  22536. continue;
  22537. } catch (\Exception $e) {
  22538. if (!$verbose) {
  22539. $this->io->writeError('');
  22540. }
  22541. $this->branchErrorOccurred = true;
  22542. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  22543. $this->io->writeError('');
  22544. continue;
  22545. }
  22546. }
  22547. $driver->cleanup();
  22548. if (!$verbose) {
  22549. $this->io->overwriteError('', false);
  22550. }
  22551. if (!$this->getPackages()) {
  22552. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  22553. }
  22554. }
  22555. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  22556. {
  22557. $data['name'] = $this->packageName ?: $data['name'];
  22558. if (!isset($data['dist'])) {
  22559. $data['dist'] = $driver->getDist($identifier);
  22560. }
  22561. if (!isset($data['source'])) {
  22562. $data['source'] = $driver->getSource($identifier);
  22563. }
  22564. return $data;
  22565. }
  22566. private function validateBranch($branch)
  22567. {
  22568. try {
  22569. return $this->versionParser->normalizeBranch($branch);
  22570. } catch (\Exception $e) {
  22571. }
  22572. return false;
  22573. }
  22574. private function validateTag($version)
  22575. {
  22576. try {
  22577. return $this->versionParser->normalize($version);
  22578. } catch (\Exception $e) {
  22579. }
  22580. return false;
  22581. }
  22582. }
  22583. <?php
  22584. namespace Composer\Repository;
  22585. use Composer\Package\AliasPackage;
  22586. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  22587. {
  22588. public function write()
  22589. {
  22590. }
  22591. public function reload()
  22592. {
  22593. }
  22594. public function getCanonicalPackages()
  22595. {
  22596. $packages = $this->getPackages();
  22597. $packagesByName = array();
  22598. foreach ($packages as $package) {
  22599. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  22600. $packagesByName[$package->getName()] = $package;
  22601. }
  22602. }
  22603. $canonicalPackages = array();
  22604. foreach ($packagesByName as $package) {
  22605. while ($package instanceof AliasPackage) {
  22606. $package = $package->getAliasOf();
  22607. }
  22608. $canonicalPackages[] = $package;
  22609. }
  22610. return $canonicalPackages;
  22611. }
  22612. }
  22613. <?php
  22614. namespace Composer\Repository;
  22615. use Composer\Package\PackageInterface;
  22616. interface WritableRepositoryInterface extends RepositoryInterface
  22617. {
  22618. public function write();
  22619. public function addPackage(PackageInterface $package);
  22620. public function removePackage(PackageInterface $package);
  22621. public function getCanonicalPackages();
  22622. public function reload();
  22623. }
  22624. <?php
  22625. namespace Composer\Script;
  22626. class CommandEvent extends Event
  22627. {
  22628. }
  22629. <?php
  22630. namespace Composer\Script;
  22631. use Composer\Composer;
  22632. use Composer\IO\IOInterface;
  22633. use Composer\EventDispatcher\Event as BaseEvent;
  22634. class Event extends BaseEvent
  22635. {
  22636. private $composer;
  22637. private $io;
  22638. private $devMode;
  22639. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  22640. {
  22641. parent::__construct($name, $args, $flags);
  22642. $this->composer = $composer;
  22643. $this->io = $io;
  22644. $this->devMode = $devMode;
  22645. }
  22646. public function getComposer()
  22647. {
  22648. return $this->composer;
  22649. }
  22650. public function getIO()
  22651. {
  22652. return $this->io;
  22653. }
  22654. public function isDevMode()
  22655. {
  22656. return $this->devMode;
  22657. }
  22658. }
  22659. <?php
  22660. namespace Composer\Script;
  22661. use Composer\Installer\PackageEvent as BasePackageEvent;
  22662. class PackageEvent extends BasePackageEvent
  22663. {
  22664. }
  22665. <?php
  22666. namespace Composer\Script;
  22667. class ScriptEvents
  22668. {
  22669. const PRE_INSTALL_CMD = 'pre-install-cmd';
  22670. const POST_INSTALL_CMD = 'post-install-cmd';
  22671. const PRE_UPDATE_CMD = 'pre-update-cmd';
  22672. const POST_UPDATE_CMD = 'post-update-cmd';
  22673. const PRE_STATUS_CMD = 'pre-status-cmd';
  22674. const POST_STATUS_CMD = 'post-status-cmd';
  22675. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  22676. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  22677. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  22678. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  22679. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  22680. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  22681. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  22682. const POST_PACKAGE_INSTALL = 'post-package-install';
  22683. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  22684. const POST_PACKAGE_UPDATE = 'post-package-update';
  22685. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  22686. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  22687. }
  22688. <?php
  22689. namespace Composer\SelfUpdate;
  22690. class Keys
  22691. {
  22692. public static function fingerprint($path)
  22693. {
  22694. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  22695. return implode(' ', array(
  22696. substr($hash, 0, 8),
  22697. substr($hash, 8, 8),
  22698. substr($hash, 16, 8),
  22699. substr($hash, 24, 8),
  22700. '',
  22701. substr($hash, 32, 8),
  22702. substr($hash, 40, 8),
  22703. substr($hash, 48, 8),
  22704. substr($hash, 56, 8),
  22705. ));
  22706. }
  22707. }
  22708. <?php
  22709. namespace Composer\SelfUpdate;
  22710. use Composer\Util\RemoteFilesystem;
  22711. use Composer\Config;
  22712. use Composer\Json\JsonFile;
  22713. class Versions
  22714. {
  22715. private $rfs;
  22716. private $config;
  22717. private $channel;
  22718. public function __construct(Config $config, RemoteFilesystem $rfs)
  22719. {
  22720. $this->rfs = $rfs;
  22721. $this->config = $config;
  22722. }
  22723. public function getChannel()
  22724. {
  22725. if ($this->channel) {
  22726. return $this->channel;
  22727. }
  22728. $channelFile = $this->config->get('home').'/update-channel';
  22729. if (file_exists($channelFile)) {
  22730. $channel = trim(file_get_contents($channelFile));
  22731. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  22732. return $this->channel = $channel;
  22733. }
  22734. }
  22735. return $this->channel = 'stable';
  22736. }
  22737. public function setChannel($channel)
  22738. {
  22739. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  22740. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  22741. }
  22742. $channelFile = $this->config->get('home').'/update-channel';
  22743. $this->channel = $channel;
  22744. file_put_contents($channelFile, $channel.PHP_EOL);
  22745. }
  22746. public function getLatest()
  22747. {
  22748. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  22749. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  22750. foreach ($versions[$this->getChannel()] as $version) {
  22751. if ($version['min-php'] <= PHP_VERSION_ID) {
  22752. return $version;
  22753. }
  22754. }
  22755. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  22756. }
  22757. }
  22758. <?php
  22759. namespace Composer\Util;
  22760. use Composer\Config;
  22761. use Composer\IO\IOInterface;
  22762. class AuthHelper
  22763. {
  22764. protected $io;
  22765. protected $config;
  22766. public function __construct(IOInterface $io, Config $config)
  22767. {
  22768. $this->io = $io;
  22769. $this->config = $config;
  22770. }
  22771. public function storeAuth($originUrl, $storeAuth)
  22772. {
  22773. $store = false;
  22774. $configSource = $this->config->getAuthConfigSource();
  22775. if ($storeAuth === true) {
  22776. $store = $configSource;
  22777. } elseif ($storeAuth === 'prompt') {
  22778. $answer = $this->io->askAndValidate(
  22779. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  22780. function ($value) {
  22781. $input = strtolower(substr(trim($value), 0, 1));
  22782. if (in_array($input, array('y','n'))) {
  22783. return $input;
  22784. }
  22785. throw new \RuntimeException('Please answer (y)es or (n)o');
  22786. },
  22787. null,
  22788. 'y'
  22789. );
  22790. if ($answer === 'y') {
  22791. $store = $configSource;
  22792. }
  22793. }
  22794. if ($store) {
  22795. $store->addConfigSetting(
  22796. 'http-basic.'.$originUrl,
  22797. $this->io->getAuthentication($originUrl)
  22798. );
  22799. }
  22800. }
  22801. }
  22802. <?php
  22803. namespace Composer\Util;
  22804. use Composer\Factory;
  22805. use Composer\IO\IOInterface;
  22806. use Composer\Config;
  22807. use Composer\Downloader\TransportException;
  22808. class Bitbucket
  22809. {
  22810. private $io;
  22811. private $config;
  22812. private $process;
  22813. private $remoteFilesystem;
  22814. private $token = array();
  22815. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  22816. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  22817. {
  22818. $this->io = $io;
  22819. $this->config = $config;
  22820. $this->process = $process ?: new ProcessExecutor;
  22821. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  22822. }
  22823. public function getToken()
  22824. {
  22825. return $this->token;
  22826. }
  22827. public function authorizeOAuth($originUrl)
  22828. {
  22829. if ($originUrl !== 'bitbucket.org') {
  22830. return false;
  22831. }
  22832. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  22833. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  22834. return true;
  22835. }
  22836. return false;
  22837. }
  22838. private function requestAccessToken($originUrl)
  22839. {
  22840. try {
  22841. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  22842. 'retry-auth-failure' => false,
  22843. 'http' => array(
  22844. 'method' => 'POST',
  22845. 'content' => 'grant_type=client_credentials',
  22846. ),
  22847. ));
  22848. $this->token = json_decode($json, true);
  22849. } catch (TransportException $e) {
  22850. if ($e->getCode() === 400) {
  22851. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  22852. $this->io->writeError('This can have two reasons:');
  22853. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  22854. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  22855. return false;
  22856. } elseif (in_array($e->getCode(), array(403, 401))) {
  22857. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  22858. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  22859. return false;
  22860. }
  22861. throw $e;
  22862. }
  22863. }
  22864. public function authorizeOAuthInteractively($originUrl, $message = null)
  22865. {
  22866. if ($message) {
  22867. $this->io->writeError($message);
  22868. }
  22869. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  22870. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  22871. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  22872. $this->io->writeError('Ensure you enter a "Callback URL" or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  22873. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  22874. if (!$consumerKey) {
  22875. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  22876. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  22877. return false;
  22878. }
  22879. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  22880. if (!$consumerSecret) {
  22881. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  22882. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  22883. return false;
  22884. }
  22885. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  22886. $this->requestAccessToken($originUrl);
  22887. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  22888. $consumer = array(
  22889. "consumer-key" => $consumerKey,
  22890. "consumer-secret" => $consumerSecret,
  22891. );
  22892. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  22893. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  22894. $this->io->writeError('<info>Consumer stored successfully.</info>');
  22895. return true;
  22896. }
  22897. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  22898. {
  22899. if (!empty($this->token)) {
  22900. return $this->token;
  22901. }
  22902. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  22903. $this->requestAccessToken($originUrl);
  22904. return $this->token;
  22905. }
  22906. }
  22907. <?php
  22908. namespace Composer\Util;
  22909. class ComposerMirror
  22910. {
  22911. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  22912. {
  22913. if ($reference) {
  22914. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  22915. }
  22916. $version = strpos($version, '/') === false ? $version : md5($version);
  22917. return str_replace(
  22918. array('%package%', '%version%', '%reference%', '%type%'),
  22919. array($packageName, $version, $reference, $type),
  22920. $mirrorUrl
  22921. );
  22922. }
  22923. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  22924. {
  22925. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  22926. $url = 'gh-'.$match[1].'/'.$match[2];
  22927. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  22928. $url = 'bb-'.$match[1].'/'.$match[2];
  22929. } else {
  22930. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  22931. }
  22932. return str_replace(
  22933. array('%package%', '%normalizedUrl%', '%type%'),
  22934. array($packageName, $url, $type),
  22935. $mirrorUrl
  22936. );
  22937. }
  22938. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  22939. {
  22940. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  22941. }
  22942. }
  22943. <?php
  22944. namespace Composer\Util;
  22945. use Composer\Package\Loader\ArrayLoader;
  22946. use Composer\Package\Loader\ValidatingArrayLoader;
  22947. use Composer\Package\Loader\InvalidPackageException;
  22948. use Composer\Json\JsonValidationException;
  22949. use Composer\IO\IOInterface;
  22950. use Composer\Json\JsonFile;
  22951. use Composer\Spdx\SpdxLicenses;
  22952. class ConfigValidator
  22953. {
  22954. private $io;
  22955. public function __construct(IOInterface $io)
  22956. {
  22957. $this->io = $io;
  22958. }
  22959. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  22960. {
  22961. $errors = array();
  22962. $publishErrors = array();
  22963. $warnings = array();
  22964. $laxValid = false;
  22965. try {
  22966. $json = new JsonFile($file, null, $this->io);
  22967. $manifest = $json->read();
  22968. $json->validateSchema(JsonFile::LAX_SCHEMA);
  22969. $laxValid = true;
  22970. $json->validateSchema();
  22971. } catch (JsonValidationException $e) {
  22972. foreach ($e->getErrors() as $message) {
  22973. if ($laxValid) {
  22974. $publishErrors[] = $message;
  22975. } else {
  22976. $errors[] = $message;
  22977. }
  22978. }
  22979. } catch (\Exception $e) {
  22980. $errors[] = $e->getMessage();
  22981. return array($errors, $publishErrors, $warnings);
  22982. }
  22983. if (!empty($manifest['license'])) {
  22984. if (is_array($manifest['license'])) {
  22985. foreach ($manifest['license'] as $key => $license) {
  22986. if ('proprietary' === $license) {
  22987. unset($manifest['license'][$key]);
  22988. }
  22989. }
  22990. }
  22991. $licenseValidator = new SpdxLicenses();
  22992. if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
  22993. $warnings[] = sprintf(
  22994. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.'
  22995. ."\nIf the software is closed-source, you may use \"proprietary\" as license.",
  22996. json_encode($manifest['license'])
  22997. );
  22998. }
  22999. } else {
  23000. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  23001. }
  23002. if (isset($manifest['version'])) {
  23003. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  23004. }
  23005. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  23006. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  23007. $suggestName = strtolower($suggestName);
  23008. $publishErrors[] = sprintf(
  23009. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  23010. $manifest['name'],
  23011. $suggestName
  23012. );
  23013. }
  23014. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  23015. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  23016. }
  23017. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  23018. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  23019. if (!empty($requireOverrides)) {
  23020. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  23021. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  23022. }
  23023. }
  23024. $require = isset($manifest['require']) ? $manifest['require'] : array();
  23025. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  23026. $packages = array_merge($require, $requireDev);
  23027. foreach ($packages as $package => $version) {
  23028. if (preg_match('/#/', $version) === 1) {
  23029. $warnings[] = sprintf(
  23030. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  23031. $package
  23032. );
  23033. }
  23034. }
  23035. if (isset($manifest['autoload']['psr-0'][''])) {
  23036. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  23037. }
  23038. if (isset($manifest['autoload']['psr-4'][''])) {
  23039. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  23040. }
  23041. try {
  23042. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  23043. if (!isset($manifest['version'])) {
  23044. $manifest['version'] = '1.0.0';
  23045. }
  23046. if (!isset($manifest['name'])) {
  23047. $manifest['name'] = 'dummy/dummy';
  23048. }
  23049. $loader->load($manifest);
  23050. } catch (InvalidPackageException $e) {
  23051. $errors = array_merge($errors, $e->getErrors());
  23052. }
  23053. $warnings = array_merge($warnings, $loader->getWarnings());
  23054. return array($errors, $publishErrors, $warnings);
  23055. }
  23056. }
  23057. <?php
  23058. namespace Composer\Util;
  23059. use Composer\IO\IOInterface;
  23060. class ErrorHandler
  23061. {
  23062. private static $io;
  23063. public static function handle($level, $message, $file, $line)
  23064. {
  23065. if (!(error_reporting() & $level)) {
  23066. return;
  23067. }
  23068. if (ini_get('xdebug.scream')) {
  23069. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  23070. "\na legitimately suppressed error that you were not supposed to see.";
  23071. }
  23072. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  23073. throw new \ErrorException($message, 0, $level, $file, $line);
  23074. }
  23075. if (self::$io) {
  23076. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  23077. if (self::$io->isVerbose()) {
  23078. self::$io->writeError('<warning>Stack trace:</warning>');
  23079. self::$io->writeError(array_filter(array_map(function ($a) {
  23080. if (isset($a['line'], $a['file'])) {
  23081. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  23082. }
  23083. return null;
  23084. }, array_slice(debug_backtrace(), 2))));
  23085. }
  23086. }
  23087. }
  23088. public static function register(IOInterface $io = null)
  23089. {
  23090. set_error_handler(array(__CLASS__, 'handle'));
  23091. error_reporting(E_ALL | E_STRICT);
  23092. self::$io = $io;
  23093. }
  23094. }
  23095. <?php
  23096. namespace Composer\Util;
  23097. use RecursiveDirectoryIterator;
  23098. use RecursiveIteratorIterator;
  23099. use Symfony\Component\Filesystem\Exception\IOException;
  23100. use Symfony\Component\Finder\Finder;
  23101. class Filesystem
  23102. {
  23103. private $processExecutor;
  23104. public function __construct(ProcessExecutor $executor = null)
  23105. {
  23106. $this->processExecutor = $executor ?: new ProcessExecutor();
  23107. }
  23108. public function remove($file)
  23109. {
  23110. if (is_dir($file)) {
  23111. return $this->removeDirectory($file);
  23112. }
  23113. if (file_exists($file)) {
  23114. return $this->unlink($file);
  23115. }
  23116. return false;
  23117. }
  23118. public function isDirEmpty($dir)
  23119. {
  23120. $finder = Finder::create()
  23121. ->ignoreVCS(false)
  23122. ->ignoreDotFiles(false)
  23123. ->depth(0)
  23124. ->in($dir);
  23125. return count($finder) === 0;
  23126. }
  23127. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  23128. {
  23129. if (file_exists($dir) && is_link($dir)) {
  23130. $this->unlink($dir);
  23131. }
  23132. if ($ensureDirectoryExists) {
  23133. $this->ensureDirectoryExists($dir);
  23134. }
  23135. if (is_dir($dir)) {
  23136. $finder = Finder::create()
  23137. ->ignoreVCS(false)
  23138. ->ignoreDotFiles(false)
  23139. ->depth(0)
  23140. ->in($dir);
  23141. foreach ($finder as $path) {
  23142. $this->remove((string) $path);
  23143. }
  23144. }
  23145. }
  23146. public function removeDirectory($directory)
  23147. {
  23148. if ($this->isSymlinkedDirectory($directory)) {
  23149. return $this->unlinkSymlinkedDirectory($directory);
  23150. }
  23151. if ($this->isJunction($directory)) {
  23152. return $this->removeJunction($directory);
  23153. }
  23154. if (!file_exists($directory) || !is_dir($directory)) {
  23155. return true;
  23156. }
  23157. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  23158. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  23159. }
  23160. if (!function_exists('proc_open')) {
  23161. return $this->removeDirectoryPhp($directory);
  23162. }
  23163. if (Platform::isWindows()) {
  23164. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  23165. } else {
  23166. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  23167. }
  23168. $result = $this->getProcess()->execute($cmd, $output) === 0;
  23169. clearstatcache();
  23170. if ($result && !file_exists($directory)) {
  23171. return true;
  23172. }
  23173. return $this->removeDirectoryPhp($directory);
  23174. }
  23175. public function removeDirectoryPhp($directory)
  23176. {
  23177. try {
  23178. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23179. } catch (\UnexpectedValueException $e) {
  23180. clearstatcache();
  23181. usleep(100000);
  23182. if (!is_dir($directory)) {
  23183. return true;
  23184. }
  23185. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23186. }
  23187. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  23188. foreach ($ri as $file) {
  23189. if ($file->isDir()) {
  23190. $this->rmdir($file->getPathname());
  23191. } else {
  23192. $this->unlink($file->getPathname());
  23193. }
  23194. }
  23195. return $this->rmdir($directory);
  23196. }
  23197. public function ensureDirectoryExists($directory)
  23198. {
  23199. if (!is_dir($directory)) {
  23200. if (file_exists($directory)) {
  23201. throw new \RuntimeException(
  23202. $directory.' exists and is not a directory.'
  23203. );
  23204. }
  23205. if (!@mkdir($directory, 0777, true)) {
  23206. throw new \RuntimeException(
  23207. $directory.' does not exist and could not be created.'
  23208. );
  23209. }
  23210. }
  23211. }
  23212. public function unlink($path)
  23213. {
  23214. if (!@$this->unlinkImplementation($path)) {
  23215. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  23216. $error = error_get_last();
  23217. $message = 'Could not delete '.$path.': ' . @$error['message'];
  23218. if (Platform::isWindows()) {
  23219. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  23220. }
  23221. throw new \RuntimeException($message);
  23222. }
  23223. }
  23224. return true;
  23225. }
  23226. public function rmdir($path)
  23227. {
  23228. if (!@rmdir($path)) {
  23229. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  23230. $error = error_get_last();
  23231. $message = 'Could not delete '.$path.': ' . @$error['message'];
  23232. if (Platform::isWindows()) {
  23233. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  23234. }
  23235. throw new \RuntimeException($message);
  23236. }
  23237. }
  23238. return true;
  23239. }
  23240. public function copyThenRemove($source, $target)
  23241. {
  23242. if (!is_dir($source)) {
  23243. copy($source, $target);
  23244. $this->unlink($source);
  23245. return;
  23246. }
  23247. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  23248. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  23249. $this->ensureDirectoryExists($target);
  23250. foreach ($ri as $file) {
  23251. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  23252. if ($file->isDir()) {
  23253. $this->ensureDirectoryExists($targetPath);
  23254. } else {
  23255. copy($file->getPathname(), $targetPath);
  23256. }
  23257. }
  23258. $this->removeDirectoryPhp($source);
  23259. }
  23260. public function rename($source, $target)
  23261. {
  23262. if (true === @rename($source, $target)) {
  23263. return;
  23264. }
  23265. if (!function_exists('proc_open')) {
  23266. return $this->copyThenRemove($source, $target);
  23267. }
  23268. if (Platform::isWindows()) {
  23269. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  23270. $result = $this->processExecutor->execute($command, $output);
  23271. clearstatcache();
  23272. if (0 === $result) {
  23273. $this->remove($source);
  23274. return;
  23275. }
  23276. } else {
  23277. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  23278. $result = $this->processExecutor->execute($command, $output);
  23279. clearstatcache();
  23280. if (0 === $result) {
  23281. return;
  23282. }
  23283. }
  23284. return $this->copyThenRemove($source, $target);
  23285. }
  23286. public function findShortestPath($from, $to, $directories = false)
  23287. {
  23288. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  23289. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  23290. }
  23291. $from = lcfirst($this->normalizePath($from));
  23292. $to = lcfirst($this->normalizePath($to));
  23293. if ($directories) {
  23294. $from = rtrim($from, '/') . '/dummy_file';
  23295. }
  23296. if (dirname($from) === dirname($to)) {
  23297. return './'.basename($to);
  23298. }
  23299. $commonPath = $to;
  23300. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  23301. $commonPath = strtr(dirname($commonPath), '\\', '/');
  23302. }
  23303. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  23304. return $to;
  23305. }
  23306. $commonPath = rtrim($commonPath, '/') . '/';
  23307. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  23308. $commonPathCode = str_repeat('../', $sourcePathDepth);
  23309. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  23310. }
  23311. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  23312. {
  23313. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  23314. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  23315. }
  23316. $from = lcfirst($this->normalizePath($from));
  23317. $to = lcfirst($this->normalizePath($to));
  23318. if ($from === $to) {
  23319. return $directories ? '__DIR__' : '__FILE__';
  23320. }
  23321. $commonPath = $to;
  23322. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  23323. $commonPath = strtr(dirname($commonPath), '\\', '/');
  23324. }
  23325. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  23326. return var_export($to, true);
  23327. }
  23328. $commonPath = rtrim($commonPath, '/') . '/';
  23329. if (strpos($to, $from.'/') === 0) {
  23330. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  23331. }
  23332. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  23333. if ($staticCode) {
  23334. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  23335. } else {
  23336. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  23337. }
  23338. $relTarget = substr($to, strlen($commonPath));
  23339. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  23340. }
  23341. public function isAbsolutePath($path)
  23342. {
  23343. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  23344. }
  23345. public function size($path)
  23346. {
  23347. if (!file_exists($path)) {
  23348. throw new \RuntimeException("$path does not exist.");
  23349. }
  23350. if (is_dir($path)) {
  23351. return $this->directorySize($path);
  23352. }
  23353. return filesize($path);
  23354. }
  23355. public function normalizePath($path)
  23356. {
  23357. $parts = array();
  23358. $path = strtr($path, '\\', '/');
  23359. $prefix = '';
  23360. $absolute = false;
  23361. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  23362. $prefix = $match[1];
  23363. $path = substr($path, strlen($prefix));
  23364. }
  23365. if (substr($path, 0, 1) === '/') {
  23366. $absolute = true;
  23367. $path = substr($path, 1);
  23368. }
  23369. $up = false;
  23370. foreach (explode('/', $path) as $chunk) {
  23371. if ('..' === $chunk && ($absolute || $up)) {
  23372. array_pop($parts);
  23373. $up = !(empty($parts) || '..' === end($parts));
  23374. } elseif ('.' !== $chunk && '' !== $chunk) {
  23375. $parts[] = $chunk;
  23376. $up = '..' !== $chunk;
  23377. }
  23378. }
  23379. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  23380. }
  23381. public static function isLocalPath($path)
  23382. {
  23383. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  23384. }
  23385. public static function getPlatformPath($path)
  23386. {
  23387. if (Platform::isWindows()) {
  23388. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  23389. }
  23390. return preg_replace('{^file://}i', '', $path);
  23391. }
  23392. protected function directorySize($directory)
  23393. {
  23394. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23395. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  23396. $size = 0;
  23397. foreach ($ri as $file) {
  23398. if ($file->isFile()) {
  23399. $size += $file->getSize();
  23400. }
  23401. }
  23402. return $size;
  23403. }
  23404. protected function getProcess()
  23405. {
  23406. return new ProcessExecutor;
  23407. }
  23408. private function unlinkImplementation($path)
  23409. {
  23410. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  23411. return rmdir($path);
  23412. }
  23413. return unlink($path);
  23414. }
  23415. public function relativeSymlink($target, $link)
  23416. {
  23417. $cwd = getcwd();
  23418. $relativePath = $this->findShortestPath($link, $target);
  23419. chdir(dirname($link));
  23420. $result = @symlink($relativePath, $link);
  23421. chdir($cwd);
  23422. return (bool) $result;
  23423. }
  23424. public function isSymlinkedDirectory($directory)
  23425. {
  23426. if (!is_dir($directory)) {
  23427. return false;
  23428. }
  23429. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  23430. return is_link($resolved);
  23431. }
  23432. private function unlinkSymlinkedDirectory($directory)
  23433. {
  23434. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  23435. return $this->unlink($resolved);
  23436. }
  23437. private function resolveSymlinkedDirectorySymlink($pathname)
  23438. {
  23439. if (!is_dir($pathname)) {
  23440. return $pathname;
  23441. }
  23442. $resolved = rtrim($pathname, '/');
  23443. if (!strlen($resolved)) {
  23444. return $pathname;
  23445. }
  23446. return $resolved;
  23447. }
  23448. public function junction($target, $junction)
  23449. {
  23450. if (!Platform::isWindows()) {
  23451. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  23452. }
  23453. if (!is_dir($target)) {
  23454. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  23455. }
  23456. $cmd = sprintf('mklink /J %s %s',
  23457. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  23458. ProcessExecutor::escape(realpath($target)));
  23459. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  23460. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  23461. }
  23462. clearstatcache(true, $junction);
  23463. }
  23464. public function isJunction($junction)
  23465. {
  23466. if (!Platform::isWindows()) {
  23467. return false;
  23468. }
  23469. if (!is_dir($junction) || is_link($junction)) {
  23470. return false;
  23471. }
  23472. clearstatcache(true, $junction);
  23473. $stat = lstat($junction);
  23474. return !($stat['mode'] & 0xC000);
  23475. }
  23476. public function removeJunction($junction)
  23477. {
  23478. if (!Platform::isWindows()) {
  23479. return false;
  23480. }
  23481. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  23482. if (!$this->isJunction($junction)) {
  23483. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  23484. }
  23485. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  23486. clearstatcache(true, $junction);
  23487. return ($this->getProcess()->execute($cmd, $output) === 0);
  23488. }
  23489. }
  23490. <?php
  23491. namespace Composer\Util;
  23492. use Composer\Config;
  23493. use Composer\IO\IOInterface;
  23494. class Git
  23495. {
  23496. private static $version;
  23497. protected $io;
  23498. protected $config;
  23499. protected $process;
  23500. protected $filesystem;
  23501. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  23502. {
  23503. $this->io = $io;
  23504. $this->config = $config;
  23505. $this->process = $process;
  23506. $this->filesystem = $fs;
  23507. }
  23508. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  23509. {
  23510. $this->config->prohibitUrlByConfig($url, $this->io);
  23511. if ($initialClone) {
  23512. $origCwd = $cwd;
  23513. $cwd = null;
  23514. }
  23515. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  23516. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  23517. }
  23518. if (!$initialClone) {
  23519. $this->process->execute('git remote -v', $output, $cwd);
  23520. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  23521. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  23522. }
  23523. }
  23524. $protocols = $this->config->get('github-protocols');
  23525. if (!is_array($protocols)) {
  23526. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  23527. }
  23528. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  23529. $messages = array();
  23530. foreach ($protocols as $protocol) {
  23531. if ('ssh' === $protocol) {
  23532. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  23533. } else {
  23534. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  23535. }
  23536. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  23537. return;
  23538. }
  23539. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  23540. if ($initialClone) {
  23541. $this->filesystem->removeDirectory($origCwd);
  23542. }
  23543. }
  23544. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  23545. }
  23546. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  23547. $command = call_user_func($commandCallable, $url);
  23548. $auth = null;
  23549. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  23550. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  23551. if (!$this->io->hasAuthentication($match[1])) {
  23552. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  23553. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  23554. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  23555. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  23556. }
  23557. }
  23558. if ($this->io->hasAuthentication($match[1])) {
  23559. $auth = $this->io->getAuthentication($match[1]);
  23560. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  23561. $command = call_user_func($commandCallable, $authUrl);
  23562. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23563. return;
  23564. }
  23565. }
  23566. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  23567. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  23568. if (!$this->io->hasAuthentication($match[1])) {
  23569. $message = 'Enter your Bitbucket credentials to access private repos';
  23570. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  23571. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  23572. $token = $bitbucketUtil->getToken();
  23573. $this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
  23574. }
  23575. } else {
  23576. $auth = $this->io->getAuthentication($match[1]);
  23577. if ($auth['username'] !== 'x-token-auth') {
  23578. $token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  23579. if (!empty($token)) {
  23580. $this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
  23581. }
  23582. }
  23583. }
  23584. if ($this->io->hasAuthentication($match[1])) {
  23585. $auth = $this->io->getAuthentication($match[1]);
  23586. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  23587. $command = call_user_func($commandCallable, $authUrl);
  23588. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23589. return;
  23590. }
  23591. } else {
  23592. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  23593. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  23594. $command = call_user_func($commandCallable, $sshUrl);
  23595. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23596. return;
  23597. }
  23598. }
  23599. } elseif ($this->isAuthenticationFailure($url, $match)) {
  23600. if (strpos($match[2], '@')) {
  23601. list($authParts, $match[2]) = explode('@', $match[2], 2);
  23602. }
  23603. $storeAuth = false;
  23604. if ($this->io->hasAuthentication($match[2])) {
  23605. $auth = $this->io->getAuthentication($match[2]);
  23606. } elseif ($this->io->isInteractive()) {
  23607. $defaultUsername = null;
  23608. if (isset($authParts) && $authParts) {
  23609. if (false !== strpos($authParts, ':')) {
  23610. list($defaultUsername,) = explode(':', $authParts, 2);
  23611. } else {
  23612. $defaultUsername = $authParts;
  23613. }
  23614. }
  23615. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  23616. $auth = array(
  23617. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  23618. 'password' => $this->io->askAndHideAnswer(' Password: '),
  23619. );
  23620. $storeAuth = $this->config->get('store-auths');
  23621. }
  23622. if ($auth) {
  23623. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  23624. $command = call_user_func($commandCallable, $authUrl);
  23625. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23626. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  23627. $authHelper = new AuthHelper($this->io, $this->config);
  23628. $authHelper->storeAuth($match[2], $storeAuth);
  23629. return;
  23630. }
  23631. }
  23632. }
  23633. if ($initialClone) {
  23634. $this->filesystem->removeDirectory($origCwd);
  23635. }
  23636. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  23637. }
  23638. }
  23639. public function syncMirror($url, $dir)
  23640. {
  23641. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  23642. try {
  23643. $commandCallable = function ($url) {
  23644. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  23645. };
  23646. $this->runCommand($commandCallable, $url, $dir);
  23647. } catch (\Exception $e) {
  23648. return false;
  23649. }
  23650. return true;
  23651. }
  23652. $this->filesystem->removeDirectory($dir);
  23653. $commandCallable = function ($url) use ($dir) {
  23654. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  23655. };
  23656. $this->runCommand($commandCallable, $url, $dir, true);
  23657. return true;
  23658. }
  23659. private function isAuthenticationFailure($url, &$match)
  23660. {
  23661. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  23662. return false;
  23663. }
  23664. $authFailures = array(
  23665. 'fatal: Authentication failed',
  23666. 'remote error: Invalid username or password.',
  23667. 'error: 401 Unauthorized',
  23668. 'fatal: unable to access'
  23669. );
  23670. foreach ($authFailures as $authFailure) {
  23671. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  23672. return true;
  23673. }
  23674. }
  23675. return false;
  23676. }
  23677. public static function cleanEnv()
  23678. {
  23679. if (ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  23680. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  23681. }
  23682. if (getenv('GIT_ASKPASS') !== 'echo') {
  23683. putenv('GIT_ASKPASS=echo');
  23684. unset($_SERVER['GIT_ASKPASS']);
  23685. }
  23686. if (getenv('GIT_DIR')) {
  23687. putenv('GIT_DIR');
  23688. unset($_SERVER['GIT_DIR']);
  23689. }
  23690. if (getenv('GIT_WORK_TREE')) {
  23691. putenv('GIT_WORK_TREE');
  23692. unset($_SERVER['GIT_WORK_TREE']);
  23693. }
  23694. if (getenv('LANGUAGE') !== 'C') {
  23695. putenv('LANGUAGE=C');
  23696. }
  23697. putenv("DYLD_LIBRARY_PATH");
  23698. unset($_SERVER['DYLD_LIBRARY_PATH']);
  23699. }
  23700. public static function getGitHubDomainsRegex(Config $config)
  23701. {
  23702. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  23703. }
  23704. public static function sanitizeUrl($message)
  23705. {
  23706. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  23707. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  23708. return '://***:***@';
  23709. }
  23710. return '://' . $m[1] . ':***@';
  23711. }, $message);
  23712. }
  23713. private function throwException($message, $url)
  23714. {
  23715. clearstatcache();
  23716. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  23717. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  23718. }
  23719. throw new \RuntimeException(self::sanitizeUrl($message));
  23720. }
  23721. public function getVersion()
  23722. {
  23723. if (isset(self::$version)) {
  23724. return self::$version;
  23725. }
  23726. if (0 !== $this->process->execute('git --version', $output)) {
  23727. return;
  23728. }
  23729. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  23730. return self::$version = $matches[1];
  23731. }
  23732. }
  23733. }
  23734. <?php
  23735. namespace Composer\Util;
  23736. use Composer\Factory;
  23737. use Composer\IO\IOInterface;
  23738. use Composer\Config;
  23739. use Composer\Downloader\TransportException;
  23740. class GitHub
  23741. {
  23742. protected $io;
  23743. protected $config;
  23744. protected $process;
  23745. protected $remoteFilesystem;
  23746. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23747. {
  23748. $this->io = $io;
  23749. $this->config = $config;
  23750. $this->process = $process ?: new ProcessExecutor;
  23751. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23752. }
  23753. public function authorizeOAuth($originUrl)
  23754. {
  23755. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  23756. return false;
  23757. }
  23758. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  23759. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  23760. return true;
  23761. }
  23762. return false;
  23763. }
  23764. public function authorizeOAuthInteractively($originUrl, $message = null)
  23765. {
  23766. if ($message) {
  23767. $this->io->writeError($message);
  23768. }
  23769. $note = 'Composer';
  23770. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  23771. $note .= ' on ' . trim($output);
  23772. }
  23773. $note .= ' ' . date('Y-m-d Hi');
  23774. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  23775. $this->io->writeError(sprintf('Head to %s', $url));
  23776. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  23777. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  23778. if (!$token) {
  23779. $this->io->writeError('<warning>No token given, aborting.</warning>');
  23780. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  23781. return false;
  23782. }
  23783. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  23784. try {
  23785. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  23786. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  23787. 'retry-auth-failure' => false,
  23788. ));
  23789. } catch (TransportException $e) {
  23790. if (in_array($e->getCode(), array(403, 401))) {
  23791. $this->io->writeError('<error>Invalid token provided.</error>');
  23792. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  23793. return false;
  23794. }
  23795. throw $e;
  23796. }
  23797. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  23798. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  23799. $this->io->writeError('<info>Token stored successfully.</info>');
  23800. return true;
  23801. }
  23802. }
  23803. <?php
  23804. namespace Composer\Util;
  23805. use Composer\IO\IOInterface;
  23806. use Composer\Config;
  23807. use Composer\Factory;
  23808. use Composer\Downloader\TransportException;
  23809. use Composer\Json\JsonFile;
  23810. class GitLab
  23811. {
  23812. protected $io;
  23813. protected $config;
  23814. protected $process;
  23815. protected $remoteFilesystem;
  23816. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23817. {
  23818. $this->io = $io;
  23819. $this->config = $config;
  23820. $this->process = $process ?: new ProcessExecutor();
  23821. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23822. }
  23823. public function authorizeOAuth($originUrl)
  23824. {
  23825. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  23826. return false;
  23827. }
  23828. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  23829. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  23830. return true;
  23831. }
  23832. $authTokens = $this->config->get('gitlab-token');
  23833. if (isset($authTokens[$originUrl])) {
  23834. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  23835. return true;
  23836. }
  23837. return false;
  23838. }
  23839. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  23840. {
  23841. if ($message) {
  23842. $this->io->writeError($message);
  23843. }
  23844. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  23845. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  23846. $attemptCounter = 0;
  23847. while ($attemptCounter++ < 5) {
  23848. try {
  23849. $response = $this->createToken($scheme, $originUrl);
  23850. } catch (TransportException $e) {
  23851. if (in_array($e->getCode(), array(403, 401))) {
  23852. if (401 === $e->getCode()) {
  23853. $this->io->writeError('Bad credentials.');
  23854. } else {
  23855. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  23856. }
  23857. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/applications');
  23858. $this->io->writeError('Add it using "composer config gitlab-oauth.'.$originUrl.' <token>"');
  23859. continue;
  23860. }
  23861. throw $e;
  23862. }
  23863. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  23864. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  23865. return true;
  23866. }
  23867. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  23868. }
  23869. private function createToken($scheme, $originUrl)
  23870. {
  23871. $username = $this->io->ask('Username: ');
  23872. $password = $this->io->askAndHideAnswer('Password: ');
  23873. $headers = array('Content-Type: application/x-www-form-urlencoded');
  23874. $apiUrl = $originUrl;
  23875. $data = http_build_query(array(
  23876. 'username' => $username,
  23877. 'password' => $password,
  23878. 'grant_type' => 'password',
  23879. ));
  23880. $options = array(
  23881. 'retry-auth-failure' => false,
  23882. 'http' => array(
  23883. 'method' => 'POST',
  23884. 'header' => $headers,
  23885. 'content' => $data,
  23886. ),
  23887. );
  23888. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  23889. $this->io->writeError('Token successfully created');
  23890. return JsonFile::parseJson($json);
  23891. }
  23892. }
  23893. <?php
  23894. namespace Composer\Util;
  23895. class IniHelper
  23896. {
  23897. const ENV_ORIGINAL = 'COMPOSER_ORIGINAL_INIS';
  23898. public static function getAll()
  23899. {
  23900. if ($env = strval(getenv(self::ENV_ORIGINAL))) {
  23901. return explode(PATH_SEPARATOR, $env);
  23902. }
  23903. $paths = array(strval(php_ini_loaded_file()));
  23904. if ($scanned = php_ini_scanned_files()) {
  23905. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  23906. }
  23907. return $paths;
  23908. }
  23909. public static function getMessage()
  23910. {
  23911. $paths = self::getAll();
  23912. if (empty($paths[0])) {
  23913. return 'A php.ini file does not exist. You will have to create one.';
  23914. }
  23915. return 'The php.ini used by your command-line PHP is: '.$paths[0];
  23916. }
  23917. }
  23918. <?php
  23919. namespace Composer\Util;
  23920. class NoProxyPattern
  23921. {
  23922. protected $rules = array();
  23923. public function __construct($pattern)
  23924. {
  23925. $this->rules = preg_split("/[\s,]+/", $pattern);
  23926. }
  23927. public function test($url)
  23928. {
  23929. $host = parse_url($url, PHP_URL_HOST);
  23930. $port = parse_url($url, PHP_URL_PORT);
  23931. if (empty($port)) {
  23932. switch (parse_url($url, PHP_URL_SCHEME)) {
  23933. case 'http':
  23934. $port = 80;
  23935. break;
  23936. case 'https':
  23937. $port = 443;
  23938. break;
  23939. }
  23940. }
  23941. foreach ($this->rules as $rule) {
  23942. if ($rule == '*') {
  23943. return true;
  23944. }
  23945. $match = false;
  23946. list($ruleHost) = explode(':', $rule);
  23947. list($base) = explode('/', $ruleHost);
  23948. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  23949. if (!isset($ip)) {
  23950. $ip = gethostbyname($host);
  23951. }
  23952. if (strpos($ruleHost, '/') === false) {
  23953. $match = $ip === $ruleHost;
  23954. } else {
  23955. if ($ip === $host) {
  23956. $match = false;
  23957. } else {
  23958. $match = self::inCIDRBlock($ruleHost, $ip);
  23959. }
  23960. }
  23961. } else {
  23962. $haystack = '.' . trim($host, '.') . '.';
  23963. $needle = '.'. trim($ruleHost, '.') .'.';
  23964. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  23965. }
  23966. if ($match && strpos($rule, ':') !== false) {
  23967. list(, $rulePort) = explode(':', $rule);
  23968. if (!empty($rulePort) && $port != $rulePort) {
  23969. $match = false;
  23970. }
  23971. }
  23972. if ($match) {
  23973. return true;
  23974. }
  23975. }
  23976. return false;
  23977. }
  23978. private static function inCIDRBlock($cidr, $ip)
  23979. {
  23980. list($base, $bits) = explode('/', $cidr);
  23981. list($a, $b, $c, $d) = explode('.', $base);
  23982. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  23983. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  23984. $low = $i & $mask;
  23985. $high = $i | (~$mask & 0xFFFFFFFF);
  23986. list($a, $b, $c, $d) = explode('.', $ip);
  23987. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  23988. return $check >= $low && $check <= $high;
  23989. }
  23990. }
  23991. <?php
  23992. namespace Composer\Util;
  23993. use Composer\IO\IOInterface;
  23994. use Symfony\Component\Process\Process;
  23995. class Perforce
  23996. {
  23997. protected $path;
  23998. protected $p4Depot;
  23999. protected $p4Client;
  24000. protected $p4User;
  24001. protected $p4Password;
  24002. protected $p4Port;
  24003. protected $p4Stream;
  24004. protected $p4ClientSpec;
  24005. protected $p4DepotType;
  24006. protected $p4Branch;
  24007. protected $process;
  24008. protected $uniquePerforceClientName;
  24009. protected $windowsFlag;
  24010. protected $commandResult;
  24011. protected $io;
  24012. protected $filesystem;
  24013. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  24014. {
  24015. $this->windowsFlag = $isWindows;
  24016. $this->p4Port = $port;
  24017. $this->initializePath($path);
  24018. $this->process = $process;
  24019. $this->initialize($repoConfig);
  24020. $this->io = $io;
  24021. }
  24022. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  24023. {
  24024. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  24025. }
  24026. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  24027. {
  24028. $output = null;
  24029. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  24030. }
  24031. public function initialize($repoConfig)
  24032. {
  24033. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  24034. if (!$repoConfig) {
  24035. return;
  24036. }
  24037. if (isset($repoConfig['unique_perforce_client_name'])) {
  24038. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  24039. }
  24040. if (isset($repoConfig['depot'])) {
  24041. $this->p4Depot = $repoConfig['depot'];
  24042. }
  24043. if (isset($repoConfig['branch'])) {
  24044. $this->p4Branch = $repoConfig['branch'];
  24045. }
  24046. if (isset($repoConfig['p4user'])) {
  24047. $this->p4User = $repoConfig['p4user'];
  24048. } else {
  24049. $this->p4User = $this->getP4variable('P4USER');
  24050. }
  24051. if (isset($repoConfig['p4password'])) {
  24052. $this->p4Password = $repoConfig['p4password'];
  24053. }
  24054. }
  24055. public function initializeDepotAndBranch($depot, $branch)
  24056. {
  24057. if (isset($depot)) {
  24058. $this->p4Depot = $depot;
  24059. }
  24060. if (isset($branch)) {
  24061. $this->p4Branch = $branch;
  24062. }
  24063. }
  24064. public function generateUniquePerforceClientName()
  24065. {
  24066. return gethostname() . "_" . time();
  24067. }
  24068. public function cleanupClientSpec()
  24069. {
  24070. $client = $this->getClient();
  24071. $task = 'client -d ' . $client;
  24072. $useP4Client = false;
  24073. $command = $this->generateP4Command($task, $useP4Client);
  24074. $this->executeCommand($command);
  24075. $clientSpec = $this->getP4ClientSpec();
  24076. $fileSystem = $this->getFilesystem();
  24077. $fileSystem->remove($clientSpec);
  24078. }
  24079. protected function executeCommand($command)
  24080. {
  24081. $this->commandResult = "";
  24082. $exit_code = $this->process->execute($command, $this->commandResult);
  24083. return $exit_code;
  24084. }
  24085. public function getClient()
  24086. {
  24087. if (!isset($this->p4Client)) {
  24088. $cleanStreamName = str_replace('@', '', str_replace('/', '_', str_replace('//', '', $this->getStream())));
  24089. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  24090. }
  24091. return $this->p4Client;
  24092. }
  24093. protected function getPath()
  24094. {
  24095. return $this->path;
  24096. }
  24097. public function initializePath($path)
  24098. {
  24099. $this->path = $path;
  24100. $fs = $this->getFilesystem();
  24101. $fs->ensureDirectoryExists($path);
  24102. }
  24103. protected function getPort()
  24104. {
  24105. return $this->p4Port;
  24106. }
  24107. public function setStream($stream)
  24108. {
  24109. $this->p4Stream = $stream;
  24110. $index = strrpos($stream, '/');
  24111. if ($index > 2) {
  24112. $this->p4DepotType = 'stream';
  24113. }
  24114. }
  24115. public function isStream()
  24116. {
  24117. return (strcmp($this->p4DepotType, 'stream') === 0);
  24118. }
  24119. public function getStream()
  24120. {
  24121. if (!isset($this->p4Stream)) {
  24122. if ($this->isStream()) {
  24123. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  24124. } else {
  24125. $this->p4Stream = '//' . $this->p4Depot;
  24126. }
  24127. }
  24128. return $this->p4Stream;
  24129. }
  24130. public function getStreamWithoutLabel($stream)
  24131. {
  24132. $index = strpos($stream, '@');
  24133. if ($index === false) {
  24134. return $stream;
  24135. }
  24136. return substr($stream, 0, $index);
  24137. }
  24138. public function getP4ClientSpec()
  24139. {
  24140. $p4clientSpec = $this->path . '/' . $this->getClient() . '.p4.spec';
  24141. return $p4clientSpec;
  24142. }
  24143. public function getUser()
  24144. {
  24145. return $this->p4User;
  24146. }
  24147. public function setUser($user)
  24148. {
  24149. $this->p4User = $user;
  24150. }
  24151. public function queryP4User()
  24152. {
  24153. $this->getUser();
  24154. if (strlen($this->p4User) > 0) {
  24155. return;
  24156. }
  24157. $this->p4User = $this->getP4variable('P4USER');
  24158. if (strlen($this->p4User) > 0) {
  24159. return;
  24160. }
  24161. $this->p4User = $this->io->ask('Enter P4 User:');
  24162. if ($this->windowsFlag) {
  24163. $command = 'p4 set P4USER=' . $this->p4User;
  24164. } else {
  24165. $command = 'export P4USER=' . $this->p4User;
  24166. }
  24167. $this->executeCommand($command);
  24168. }
  24169. protected function getP4variable($name)
  24170. {
  24171. if ($this->windowsFlag) {
  24172. $command = 'p4 set';
  24173. $this->executeCommand($command);
  24174. $result = trim($this->commandResult);
  24175. $resArray = explode(PHP_EOL, $result);
  24176. foreach ($resArray as $line) {
  24177. $fields = explode('=', $line);
  24178. if (strcmp($name, $fields[0]) == 0) {
  24179. $index = strpos($fields[1], ' ');
  24180. if ($index === false) {
  24181. $value = $fields[1];
  24182. } else {
  24183. $value = substr($fields[1], 0, $index);
  24184. }
  24185. $value = trim($value);
  24186. return $value;
  24187. }
  24188. }
  24189. return null;
  24190. } else {
  24191. $command = 'echo $' . $name;
  24192. $this->executeCommand($command);
  24193. $result = trim($this->commandResult);
  24194. return $result;
  24195. }
  24196. }
  24197. public function queryP4Password()
  24198. {
  24199. if (isset($this->p4Password)) {
  24200. return $this->p4Password;
  24201. }
  24202. $password = $this->getP4variable('P4PASSWD');
  24203. if (strlen($password) <= 0) {
  24204. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  24205. }
  24206. $this->p4Password = $password;
  24207. return $password;
  24208. }
  24209. public function generateP4Command($command, $useClient = true)
  24210. {
  24211. $p4Command = 'p4 ';
  24212. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  24213. if ($useClient) {
  24214. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  24215. }
  24216. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ';
  24217. $p4Command = $p4Command . $command;
  24218. return $p4Command;
  24219. }
  24220. public function isLoggedIn()
  24221. {
  24222. $command = $this->generateP4Command('login -s', false);
  24223. $exitCode = $this->executeCommand($command);
  24224. if ($exitCode) {
  24225. $errorOutput = $this->process->getErrorOutput();
  24226. $index = strpos($errorOutput, $this->getUser());
  24227. if ($index === false) {
  24228. $index = strpos($errorOutput, 'p4');
  24229. if ($index === false) {
  24230. return false;
  24231. }
  24232. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  24233. }
  24234. throw new \Exception('Invalid user name: ' . $this->getUser());
  24235. }
  24236. return true;
  24237. }
  24238. public function connectClient()
  24239. {
  24240. $p4CreateClientCommand = $this->generateP4Command(
  24241. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  24242. );
  24243. $this->executeCommand($p4CreateClientCommand);
  24244. }
  24245. public function syncCodeBase($sourceReference)
  24246. {
  24247. $prevDir = getcwd();
  24248. chdir($this->path);
  24249. $p4SyncCommand = $this->generateP4Command('sync -f ');
  24250. if (null !== $sourceReference) {
  24251. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  24252. }
  24253. $this->executeCommand($p4SyncCommand);
  24254. chdir($prevDir);
  24255. }
  24256. public function writeClientSpecToFile($spec)
  24257. {
  24258. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  24259. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  24260. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  24261. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  24262. fwrite($spec, 'Description:' . PHP_EOL);
  24263. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  24264. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  24265. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  24266. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  24267. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  24268. if ($this->isStream()) {
  24269. fwrite($spec, 'Stream:' . PHP_EOL);
  24270. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  24271. } else {
  24272. fwrite(
  24273. $spec,
  24274. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  24275. );
  24276. }
  24277. }
  24278. public function writeP4ClientSpec()
  24279. {
  24280. $clientSpec = $this->getP4ClientSpec();
  24281. $spec = fopen($clientSpec, 'w');
  24282. try {
  24283. $this->writeClientSpecToFile($spec);
  24284. } catch (\Exception $e) {
  24285. fclose($spec);
  24286. throw $e;
  24287. }
  24288. fclose($spec);
  24289. }
  24290. protected function read($pipe, $name)
  24291. {
  24292. if (feof($pipe)) {
  24293. return;
  24294. }
  24295. $line = fgets($pipe);
  24296. while ($line !== false) {
  24297. $line = fgets($pipe);
  24298. }
  24299. return;
  24300. }
  24301. public function windowsLogin($password)
  24302. {
  24303. $command = $this->generateP4Command(' login -a');
  24304. $process = new Process($command, null, null, $password);
  24305. return $process->run();
  24306. }
  24307. public function p4Login()
  24308. {
  24309. $this->queryP4User();
  24310. if (!$this->isLoggedIn()) {
  24311. $password = $this->queryP4Password();
  24312. if ($this->windowsFlag) {
  24313. $this->windowsLogin($password);
  24314. } else {
  24315. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  24316. $exitCode = $this->executeCommand($command);
  24317. $result = trim($this->commandResult);
  24318. if ($exitCode) {
  24319. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  24320. }
  24321. }
  24322. }
  24323. }
  24324. public function getComposerInformation($identifier)
  24325. {
  24326. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24327. if (!$composerFileContent) {
  24328. return;
  24329. }
  24330. return json_decode($composerFileContent, true);
  24331. }
  24332. public function getFileContent($file, $identifier)
  24333. {
  24334. $path = $this->getFilePath($file, $identifier);
  24335. $command = $this->generateP4Command(' print ' . $path);
  24336. $this->executeCommand($command);
  24337. $result = $this->commandResult;
  24338. if (!trim($result)) {
  24339. return null;
  24340. }
  24341. return $result;
  24342. }
  24343. public function getFilePath($file, $identifier)
  24344. {
  24345. $index = strpos($identifier, '@');
  24346. if ($index === false) {
  24347. $path = $identifier. '/' . $file;
  24348. return $path;
  24349. } else {
  24350. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  24351. $command = $this->generateP4Command(' files ' . $path, false);
  24352. $this->executeCommand($command);
  24353. $result = $this->commandResult;
  24354. $index2 = strpos($result, 'no such file(s).');
  24355. if ($index2 === false) {
  24356. $index3 = strpos($result, 'change');
  24357. if ($index3 !== false) {
  24358. $phrase = trim(substr($result, $index3));
  24359. $fields = explode(' ', $phrase);
  24360. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  24361. }
  24362. }
  24363. }
  24364. return null;
  24365. }
  24366. public function getBranches()
  24367. {
  24368. $possibleBranches = array();
  24369. if (!$this->isStream()) {
  24370. $possibleBranches[$this->p4Branch] = $this->getStream();
  24371. } else {
  24372. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  24373. $this->executeCommand($command);
  24374. $result = $this->commandResult;
  24375. $resArray = explode(PHP_EOL, $result);
  24376. foreach ($resArray as $line) {
  24377. $resBits = explode(' ', $line);
  24378. if (count($resBits) > 4) {
  24379. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  24380. $possibleBranches[$branch] = $resBits[1];
  24381. }
  24382. }
  24383. }
  24384. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  24385. $this->executeCommand($command);
  24386. $result = $this->commandResult;
  24387. $resArray = explode(PHP_EOL, $result);
  24388. $lastCommit = $resArray[0];
  24389. $lastCommitArr = explode(' ', $lastCommit);
  24390. $lastCommitNum = $lastCommitArr[1];
  24391. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  24392. return $branches;
  24393. }
  24394. public function getTags()
  24395. {
  24396. $command = $this->generateP4Command('labels');
  24397. $this->executeCommand($command);
  24398. $result = $this->commandResult;
  24399. $resArray = explode(PHP_EOL, $result);
  24400. $tags = array();
  24401. foreach ($resArray as $line) {
  24402. $index = strpos($line, 'Label');
  24403. if (!($index === false)) {
  24404. $fields = explode(' ', $line);
  24405. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  24406. }
  24407. }
  24408. return $tags;
  24409. }
  24410. public function checkStream()
  24411. {
  24412. $command = $this->generateP4Command('depots', false);
  24413. $this->executeCommand($command);
  24414. $result = $this->commandResult;
  24415. $resArray = explode(PHP_EOL, $result);
  24416. foreach ($resArray as $line) {
  24417. $index = strpos($line, 'Depot');
  24418. if (!($index === false)) {
  24419. $fields = explode(' ', $line);
  24420. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  24421. $this->p4DepotType = $fields[3];
  24422. return $this->isStream();
  24423. }
  24424. }
  24425. }
  24426. return false;
  24427. }
  24428. protected function getChangeList($reference)
  24429. {
  24430. $index = strpos($reference, '@');
  24431. if ($index === false) {
  24432. return null;
  24433. }
  24434. $label = substr($reference, $index);
  24435. $command = $this->generateP4Command(' changes -m1 ' . $label);
  24436. $this->executeCommand($command);
  24437. $changes = $this->commandResult;
  24438. if (strpos($changes, 'Change') !== 0) {
  24439. return null;
  24440. }
  24441. $fields = explode(' ', $changes);
  24442. $changeList = $fields[1];
  24443. return $changeList;
  24444. }
  24445. public function getCommitLogs($fromReference, $toReference)
  24446. {
  24447. $fromChangeList = $this->getChangeList($fromReference);
  24448. if ($fromChangeList === null) {
  24449. return null;
  24450. }
  24451. $toChangeList = $this->getChangeList($toReference);
  24452. if ($toChangeList === null) {
  24453. return null;
  24454. }
  24455. $index = strpos($fromReference, '@');
  24456. $main = substr($fromReference, 0, $index) . '/...';
  24457. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  24458. $this->executeCommand($command);
  24459. $result = $this->commandResult;
  24460. return $result;
  24461. }
  24462. public function getFilesystem()
  24463. {
  24464. if (empty($this->filesystem)) {
  24465. $this->filesystem = new Filesystem($this->process);
  24466. }
  24467. return $this->filesystem;
  24468. }
  24469. public function setFilesystem(Filesystem $fs)
  24470. {
  24471. $this->filesystem = $fs;
  24472. }
  24473. }
  24474. <?php
  24475. namespace Composer\Util;
  24476. class Platform
  24477. {
  24478. public static function expandPath($path)
  24479. {
  24480. if (preg_match('#^~[\\/]#', $path)) {
  24481. return self::getUserDirectory() . substr($path, 1);
  24482. }
  24483. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function($matches) {
  24484. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  24485. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  24486. }
  24487. return getenv($matches['var']) . $matches['path'];
  24488. }, $path);
  24489. }
  24490. public static function getUserDirectory()
  24491. {
  24492. if (false !== ($home = getenv('HOME'))) {
  24493. return $home;
  24494. }
  24495. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  24496. return $home;
  24497. }
  24498. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  24499. $info = posix_getpwuid(posix_getuid());
  24500. return $info['dir'];
  24501. }
  24502. throw new \RuntimeException('Could not determine user directory');
  24503. }
  24504. public static function isWindows()
  24505. {
  24506. return defined('PHP_WINDOWS_VERSION_BUILD');
  24507. }
  24508. public static function strlen($str)
  24509. {
  24510. static $useMbString = null;
  24511. if (null === $useMbString) {
  24512. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  24513. }
  24514. if ($useMbString) {
  24515. return mb_strlen($str, '8bit');
  24516. }
  24517. return strlen($str);
  24518. }
  24519. }
  24520. <?php
  24521. namespace Composer\Util;
  24522. use Symfony\Component\Process\Process;
  24523. use Symfony\Component\Process\ProcessUtils;
  24524. use Composer\IO\IOInterface;
  24525. class ProcessExecutor
  24526. {
  24527. protected static $timeout = 300;
  24528. protected $captureOutput;
  24529. protected $errorOutput;
  24530. protected $io;
  24531. public function __construct(IOInterface $io = null)
  24532. {
  24533. $this->io = $io;
  24534. }
  24535. public function execute($command, &$output = null, $cwd = null)
  24536. {
  24537. if ($this->io && $this->io->isDebug()) {
  24538. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  24539. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  24540. return '://***:***@';
  24541. }
  24542. return '://'.$m['user'].':***@';
  24543. }, $command);
  24544. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  24545. }
  24546. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  24547. $cwd = realpath(getcwd());
  24548. }
  24549. $this->captureOutput = count(func_get_args()) > 1;
  24550. $this->errorOutput = null;
  24551. $process = new Process($command, $cwd, null, null, static::getTimeout());
  24552. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  24553. $process->run($callback);
  24554. if ($this->captureOutput && !is_callable($output)) {
  24555. $output = $process->getOutput();
  24556. }
  24557. $this->errorOutput = $process->getErrorOutput();
  24558. return $process->getExitCode();
  24559. }
  24560. public function splitLines($output)
  24561. {
  24562. $output = trim($output);
  24563. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  24564. }
  24565. public function getErrorOutput()
  24566. {
  24567. return $this->errorOutput;
  24568. }
  24569. public function outputHandler($type, $buffer)
  24570. {
  24571. if ($this->captureOutput) {
  24572. return;
  24573. }
  24574. if (null === $this->io) {
  24575. echo $buffer;
  24576. return;
  24577. }
  24578. if (Process::ERR === $type) {
  24579. $this->io->writeError($buffer, false);
  24580. } else {
  24581. $this->io->write($buffer, false);
  24582. }
  24583. }
  24584. public static function getTimeout()
  24585. {
  24586. return static::$timeout;
  24587. }
  24588. public static function setTimeout($timeout)
  24589. {
  24590. static::$timeout = $timeout;
  24591. }
  24592. public static function escape($argument)
  24593. {
  24594. return ProcessUtils::escapeArgument($argument);
  24595. }
  24596. }
  24597. <?php
  24598. namespace Composer\Util;
  24599. use Composer\Config;
  24600. use Composer\IO\IOInterface;
  24601. use Composer\Downloader\TransportException;
  24602. use Composer\CaBundle\CaBundle;
  24603. use Psr\Log\LoggerInterface;
  24604. class RemoteFilesystem
  24605. {
  24606. private $io;
  24607. private $config;
  24608. private $scheme;
  24609. private $bytesMax;
  24610. private $originUrl;
  24611. private $fileUrl;
  24612. private $fileName;
  24613. private $retry;
  24614. private $progress;
  24615. private $lastProgress;
  24616. private $options = array();
  24617. private $peerCertificateMap = array();
  24618. private $disableTls = false;
  24619. private $retryAuthFailure;
  24620. private $lastHeaders;
  24621. private $storeAuth;
  24622. private $degradedMode = false;
  24623. private $redirects;
  24624. private $maxRedirects = 20;
  24625. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  24626. {
  24627. $this->io = $io;
  24628. if ($disableTls === false) {
  24629. $this->options = $this->getTlsDefaults($options);
  24630. } else {
  24631. $this->disableTls = true;
  24632. }
  24633. $this->options = array_replace_recursive($this->options, $options);
  24634. $this->config = $config;
  24635. }
  24636. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  24637. {
  24638. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  24639. }
  24640. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  24641. {
  24642. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  24643. }
  24644. public function getOptions()
  24645. {
  24646. return $this->options;
  24647. }
  24648. public function setOptions(array $options)
  24649. {
  24650. $this->options = array_replace_recursive($this->options, $options);
  24651. }
  24652. public function isTlsDisabled()
  24653. {
  24654. return $this->disableTls === true;
  24655. }
  24656. public function getLastHeaders()
  24657. {
  24658. return $this->lastHeaders;
  24659. }
  24660. public function findHeaderValue(array $headers, $name)
  24661. {
  24662. $value = null;
  24663. foreach ($headers as $header) {
  24664. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  24665. $value = $match[1];
  24666. } elseif (preg_match('{^HTTP/}i', $header)) {
  24667. $value = null;
  24668. }
  24669. }
  24670. return $value;
  24671. }
  24672. public function findStatusCode(array $headers)
  24673. {
  24674. $value = null;
  24675. foreach ($headers as $header) {
  24676. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  24677. $value = (int) $match[1];
  24678. }
  24679. }
  24680. return $value;
  24681. }
  24682. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  24683. {
  24684. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  24685. $originUrl = 'github.com';
  24686. }
  24687. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  24688. $this->bytesMax = 0;
  24689. $this->originUrl = $originUrl;
  24690. $this->fileUrl = $fileUrl;
  24691. $this->fileName = $fileName;
  24692. $this->progress = $progress;
  24693. $this->lastProgress = null;
  24694. $this->retryAuthFailure = true;
  24695. $this->lastHeaders = array();
  24696. $this->redirects = 1;
  24697. if (preg_match('{^https?://(.+):(.+)@([^/]+)}i', $fileUrl, $match)) {
  24698. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  24699. }
  24700. $tempAdditionalOptions = $additionalOptions;
  24701. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  24702. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  24703. unset($tempAdditionalOptions['retry-auth-failure']);
  24704. }
  24705. $isRedirect = false;
  24706. if (isset($tempAdditionalOptions['redirects'])) {
  24707. $this->redirects = $tempAdditionalOptions['redirects'];
  24708. $isRedirect = true;
  24709. unset($tempAdditionalOptions['redirects']);
  24710. }
  24711. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  24712. unset($tempAdditionalOptions);
  24713. $userlandFollow = isset($options['http']['follow_location']) && !$options['http']['follow_location'];
  24714. $origFileUrl = $fileUrl;
  24715. if (isset($options['github-token'])) {
  24716. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  24717. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  24718. }
  24719. unset($options['github-token']);
  24720. }
  24721. if (isset($options['gitlab-token'])) {
  24722. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  24723. unset($options['gitlab-token']);
  24724. }
  24725. if (isset($options['bitbucket-token'])) {
  24726. if (!$this->isPublicBitBucketDownload($origFileUrl)) {
  24727. $fileUrl .= (false === strpos($fileUrl,'?') ? '?' : '&') . 'access_token=' . $options['bitbucket-token'];
  24728. }
  24729. unset($options['bitbucket-token']);
  24730. }
  24731. if (isset($options['http'])) {
  24732. $options['http']['ignore_errors'] = true;
  24733. }
  24734. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  24735. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  24736. $degradedPackagist = true;
  24737. }
  24738. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  24739. $actualContextOptions = stream_context_get_options($ctx);
  24740. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  24741. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  24742. unset($origFileUrl, $actualContextOptions);
  24743. if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  24744. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  24745. }
  24746. if ($this->progress && !$isRedirect) {
  24747. $this->io->writeError(" Downloading: <comment>Connecting...</comment>", false);
  24748. }
  24749. $errorMessage = '';
  24750. $errorCode = 0;
  24751. $result = false;
  24752. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  24753. if ($errorMessage) {
  24754. $errorMessage .= "\n";
  24755. }
  24756. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  24757. });
  24758. try {
  24759. $result = file_get_contents($fileUrl, false, $ctx);
  24760. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  24761. if ($contentLength && Platform::strlen($result) < $contentLength) {
  24762. throw new TransportException('Content-Length mismatch');
  24763. }
  24764. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  24765. $params = stream_context_get_params($ctx);
  24766. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  24767. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  24768. if ($expectedPeerFingerprint !== $peerFingerprint) {
  24769. throw new TransportException('Peer fingerprint did not match');
  24770. }
  24771. }
  24772. } catch (\Exception $e) {
  24773. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  24774. $e->setHeaders($http_response_header);
  24775. $e->setStatusCode($this->findStatusCode($http_response_header));
  24776. }
  24777. if ($e instanceof TransportException && $result !== false) {
  24778. $e->setResponse($result);
  24779. }
  24780. $result = false;
  24781. }
  24782. if ($errorMessage && !ini_get('allow_url_fopen')) {
  24783. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  24784. }
  24785. restore_error_handler();
  24786. if (isset($e) && !$this->retry) {
  24787. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  24788. $this->degradedMode = true;
  24789. $this->io->writeError('');
  24790. $this->io->writeError(array(
  24791. '<error>'.$e->getMessage().'</error>',
  24792. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  24793. ));
  24794. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24795. }
  24796. throw $e;
  24797. }
  24798. $statusCode = null;
  24799. $contentType = null;
  24800. if (!empty($http_response_header[0])) {
  24801. $statusCode = $this->findStatusCode($http_response_header);
  24802. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  24803. }
  24804. if ($originUrl === 'bitbucket.org'
  24805. && !$this->isPublicBitBucketDownload($fileUrl)
  24806. && substr($fileUrl, -4) === '.zip'
  24807. && preg_match('{^text/html\b}i', $contentType)
  24808. ) {
  24809. $result = false;
  24810. if ($this->retryAuthFailure) {
  24811. $this->promptAuthAndRetry(401);
  24812. }
  24813. }
  24814. $hasFollowedRedirect = false;
  24815. if ($userlandFollow && $statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  24816. $hasFollowedRedirect = true;
  24817. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  24818. }
  24819. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  24820. if (!$this->retry) {
  24821. if ($this->progress && !$this->retry && !$isRedirect) {
  24822. $this->io->overwriteError(" Downloading: <error>Failed</error>", false);
  24823. }
  24824. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  24825. $e->setHeaders($http_response_header);
  24826. $e->setResponse($result);
  24827. $e->setStatusCode($statusCode);
  24828. throw $e;
  24829. }
  24830. $result = false;
  24831. }
  24832. if ($this->progress && !$this->retry && !$isRedirect) {
  24833. $this->io->overwriteError(" Downloading: ".($result === false ? '<error>Failed</error>' : '<comment>100%</comment>'), false);
  24834. }
  24835. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  24836. $decode = 'gzip' === strtolower($this->findHeaderValue($http_response_header, 'content-encoding'));
  24837. if ($decode) {
  24838. try {
  24839. if (PHP_VERSION_ID >= 50400) {
  24840. $result = zlib_decode($result);
  24841. } else {
  24842. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  24843. }
  24844. if (!$result) {
  24845. throw new TransportException('Failed to decode zlib stream');
  24846. }
  24847. } catch (\Exception $e) {
  24848. if ($this->degradedMode) {
  24849. throw $e;
  24850. }
  24851. $this->degradedMode = true;
  24852. $this->io->writeError(array(
  24853. '',
  24854. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  24855. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  24856. ));
  24857. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24858. }
  24859. }
  24860. }
  24861. if (false !== $result && null !== $fileName && !$isRedirect) {
  24862. if ('' === $result) {
  24863. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  24864. }
  24865. $errorMessage = '';
  24866. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  24867. if ($errorMessage) {
  24868. $errorMessage .= "\n";
  24869. }
  24870. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  24871. });
  24872. $result = (bool) file_put_contents($fileName, $result);
  24873. restore_error_handler();
  24874. if (false === $result) {
  24875. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  24876. }
  24877. }
  24878. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  24879. if (CaBundle::isOpensslParseSafe()) {
  24880. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  24881. if ($certDetails) {
  24882. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  24883. $this->retry = true;
  24884. }
  24885. } else {
  24886. $this->io->writeError('');
  24887. $this->io->writeError(sprintf(
  24888. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  24889. PHP_VERSION
  24890. ));
  24891. }
  24892. }
  24893. if ($this->retry) {
  24894. $this->retry = false;
  24895. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24896. if ($this->storeAuth && $this->config) {
  24897. $authHelper = new AuthHelper($this->io, $this->config);
  24898. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  24899. $this->storeAuth = false;
  24900. }
  24901. return $result;
  24902. }
  24903. if (false === $result) {
  24904. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  24905. if (!empty($http_response_header[0])) {
  24906. $e->setHeaders($http_response_header);
  24907. }
  24908. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  24909. $this->degradedMode = true;
  24910. $this->io->writeError('');
  24911. $this->io->writeError(array(
  24912. '<error>'.$e->getMessage().'</error>',
  24913. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  24914. ));
  24915. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24916. }
  24917. throw $e;
  24918. }
  24919. if (!empty($http_response_header[0])) {
  24920. $this->lastHeaders = $http_response_header;
  24921. }
  24922. return $result;
  24923. }
  24924. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  24925. {
  24926. switch ($notificationCode) {
  24927. case STREAM_NOTIFY_FAILURE:
  24928. if (400 === $messageCode) {
  24929. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  24930. }
  24931. case STREAM_NOTIFY_AUTH_REQUIRED:
  24932. if (401 === $messageCode) {
  24933. if (!$this->retryAuthFailure) {
  24934. break;
  24935. }
  24936. $this->promptAuthAndRetry($messageCode);
  24937. }
  24938. break;
  24939. case STREAM_NOTIFY_AUTH_RESULT:
  24940. if (403 === $messageCode) {
  24941. if (!$this->retryAuthFailure) {
  24942. break;
  24943. }
  24944. $this->promptAuthAndRetry($messageCode, $message);
  24945. }
  24946. break;
  24947. case STREAM_NOTIFY_FILE_SIZE_IS:
  24948. $this->bytesMax = $bytesMax;
  24949. break;
  24950. case STREAM_NOTIFY_PROGRESS:
  24951. if ($this->bytesMax > 0 && $this->progress) {
  24952. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  24953. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  24954. $this->lastProgress = $progression;
  24955. $this->io->overwriteError(" Downloading: <comment>$progression%</comment>", false);
  24956. }
  24957. }
  24958. break;
  24959. default:
  24960. break;
  24961. }
  24962. }
  24963. protected function promptAuthAndRetry($httpStatus, $reason = null)
  24964. {
  24965. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  24966. $message = "\n".'Could not fetch '.$this->fileUrl.', please create a GitHub OAuth token '.($httpStatus === 404 ? 'to access private repos' : 'to go over the API rate limit');
  24967. $gitHubUtil = new GitHub($this->io, $this->config, null);
  24968. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  24969. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  24970. ) {
  24971. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  24972. }
  24973. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  24974. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  24975. $gitLabUtil = new GitLab($this->io, $this->config, null);
  24976. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  24977. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  24978. ) {
  24979. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  24980. }
  24981. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  24982. $askForOAuthToken = true;
  24983. if ($this->io->hasAuthentication($this->originUrl)) {
  24984. $auth = $this->io->getAuthentication($this->originUrl);
  24985. if ($auth['username'] !== 'x-token-auth') {
  24986. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  24987. $token = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  24988. if (! empty($token)) {
  24989. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $token['access_token']);
  24990. $askForOAuthToken = false;
  24991. }
  24992. } else {
  24993. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  24994. }
  24995. }
  24996. if ($askForOAuthToken) {
  24997. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . ($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  24998. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  24999. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  25000. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  25001. ) {
  25002. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  25003. }
  25004. }
  25005. } else {
  25006. if ($httpStatus === 404) {
  25007. return;
  25008. }
  25009. if (!$this->io->isInteractive()) {
  25010. if ($httpStatus === 401) {
  25011. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  25012. }
  25013. if ($httpStatus === 403) {
  25014. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  25015. }
  25016. throw new TransportException($message, $httpStatus);
  25017. }
  25018. if ($this->io->hasAuthentication($this->originUrl)) {
  25019. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  25020. }
  25021. $this->io->overwriteError('');
  25022. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  25023. $username = $this->io->ask(' Username: ');
  25024. $password = $this->io->askAndHideAnswer(' Password: ');
  25025. $this->io->setAuthentication($this->originUrl, $username, $password);
  25026. $this->storeAuth = $this->config->get('store-auths');
  25027. }
  25028. $this->retry = true;
  25029. throw new TransportException('RETRY');
  25030. }
  25031. protected function getOptionsForUrl($originUrl, $additionalOptions)
  25032. {
  25033. $tlsOptions = array();
  25034. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  25035. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  25036. if (PHP_VERSION_ID >= 50304) {
  25037. $userlandFollow = true;
  25038. } else {
  25039. if ($host === 'github.com' || $host === 'api.github.com') {
  25040. $host = '*.github.com';
  25041. }
  25042. }
  25043. $tlsOptions['ssl']['CN_match'] = $host;
  25044. $tlsOptions['ssl']['SNI_server_name'] = $host;
  25045. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  25046. if (isset($this->peerCertificateMap[$urlAuthority])) {
  25047. $certMap = $this->peerCertificateMap[$urlAuthority];
  25048. $this->io->writeError('', true, IOInterface::DEBUG);
  25049. $this->io->writeError(sprintf(
  25050. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  25051. $certMap['cn'],
  25052. $urlAuthority
  25053. ), true, IOInterface::DEBUG);
  25054. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  25055. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  25056. }
  25057. }
  25058. $headers = array();
  25059. if (extension_loaded('zlib')) {
  25060. $headers[] = 'Accept-Encoding: gzip';
  25061. }
  25062. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  25063. if (!$this->degradedMode) {
  25064. $options['http']['protocol_version'] = 1.1;
  25065. $headers[] = 'Connection: close';
  25066. }
  25067. if (isset($userlandFollow)) {
  25068. $options['http']['follow_location'] = 0;
  25069. }
  25070. if ($this->io->hasAuthentication($originUrl)) {
  25071. $auth = $this->io->getAuthentication($originUrl);
  25072. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  25073. $options['github-token'] = $auth['username'];
  25074. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  25075. if ($auth['password'] === 'oauth2') {
  25076. $headers[] = 'Authorization: Bearer '.$auth['username'];
  25077. }
  25078. else if ($auth['password'] === 'private-token') {
  25079. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  25080. }
  25081. } elseif ('bitbucket.org' === $originUrl
  25082. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  25083. ) {
  25084. $options['bitbucket-token'] = $auth['password'];
  25085. } else {
  25086. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  25087. $headers[] = 'Authorization: Basic '.$authStr;
  25088. }
  25089. }
  25090. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  25091. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  25092. }
  25093. foreach ($headers as $header) {
  25094. $options['http']['header'][] = $header;
  25095. }
  25096. return $options;
  25097. }
  25098. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  25099. {
  25100. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  25101. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  25102. $targetUrl = $locationHeader;
  25103. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  25104. $targetUrl = $this->scheme.':'.$locationHeader;
  25105. } elseif ('/' === $locationHeader[0]) {
  25106. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  25107. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  25108. } else {
  25109. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  25110. }
  25111. }
  25112. if (!empty($targetUrl)) {
  25113. $this->redirects++;
  25114. $this->io->writeError('', true, IOInterface::DEBUG);
  25115. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  25116. $additionalOptions['redirects'] = $this->redirects;
  25117. return $this->get($this->originUrl, $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  25118. }
  25119. if (!$this->retry) {
  25120. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  25121. $e->setHeaders($http_response_header);
  25122. $e->setResponse($result);
  25123. throw $e;
  25124. }
  25125. return false;
  25126. }
  25127. private function getTlsDefaults(array $options)
  25128. {
  25129. $ciphers = implode(':', array(
  25130. 'ECDHE-RSA-AES128-GCM-SHA256',
  25131. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  25132. 'ECDHE-RSA-AES256-GCM-SHA384',
  25133. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  25134. 'DHE-RSA-AES128-GCM-SHA256',
  25135. 'DHE-DSS-AES128-GCM-SHA256',
  25136. 'kEDH+AESGCM',
  25137. 'ECDHE-RSA-AES128-SHA256',
  25138. 'ECDHE-ECDSA-AES128-SHA256',
  25139. 'ECDHE-RSA-AES128-SHA',
  25140. 'ECDHE-ECDSA-AES128-SHA',
  25141. 'ECDHE-RSA-AES256-SHA384',
  25142. 'ECDHE-ECDSA-AES256-SHA384',
  25143. 'ECDHE-RSA-AES256-SHA',
  25144. 'ECDHE-ECDSA-AES256-SHA',
  25145. 'DHE-RSA-AES128-SHA256',
  25146. 'DHE-RSA-AES128-SHA',
  25147. 'DHE-DSS-AES128-SHA256',
  25148. 'DHE-RSA-AES256-SHA256',
  25149. 'DHE-DSS-AES256-SHA',
  25150. 'DHE-RSA-AES256-SHA',
  25151. 'AES128-GCM-SHA256',
  25152. 'AES256-GCM-SHA384',
  25153. 'AES128-SHA256',
  25154. 'AES256-SHA256',
  25155. 'AES128-SHA',
  25156. 'AES256-SHA',
  25157. 'AES',
  25158. 'CAMELLIA',
  25159. 'DES-CBC3-SHA',
  25160. '!aNULL',
  25161. '!eNULL',
  25162. '!EXPORT',
  25163. '!DES',
  25164. '!RC4',
  25165. '!MD5',
  25166. '!PSK',
  25167. '!aECDH',
  25168. '!EDH-DSS-DES-CBC3-SHA',
  25169. '!EDH-RSA-DES-CBC3-SHA',
  25170. '!KRB5-DES-CBC3-SHA',
  25171. ));
  25172. $defaults = array(
  25173. 'ssl' => array(
  25174. 'ciphers' => $ciphers,
  25175. 'verify_peer' => true,
  25176. 'verify_depth' => 7,
  25177. 'SNI_enabled' => true,
  25178. 'capture_peer_cert' => true,
  25179. ),
  25180. );
  25181. if (isset($options['ssl'])) {
  25182. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  25183. }
  25184. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  25185. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  25186. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  25187. if (preg_match('{^phar://}', $result)) {
  25188. $hash = hash_file('sha256', $result);
  25189. $targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem';
  25190. if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) {
  25191. $this->streamCopy($result, $targetPath);
  25192. chmod($targetPath, 0666);
  25193. }
  25194. $defaults['ssl']['cafile'] = $targetPath;
  25195. } elseif (is_dir($result)) {
  25196. $defaults['ssl']['capath'] = $result;
  25197. } else {
  25198. $defaults['ssl']['cafile'] = $result;
  25199. }
  25200. }
  25201. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  25202. throw new TransportException('The configured cafile was not valid or could not be read.');
  25203. }
  25204. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  25205. throw new TransportException('The configured capath was not valid or could not be read.');
  25206. }
  25207. if (PHP_VERSION_ID >= 50413) {
  25208. $defaults['ssl']['disable_compression'] = true;
  25209. }
  25210. return $defaults;
  25211. }
  25212. private function streamCopy($source, $target)
  25213. {
  25214. $source = fopen($source, 'r');
  25215. $target = fopen($target, 'w+');
  25216. stream_copy_to_stream($source, $target);
  25217. fclose($source);
  25218. fclose($target);
  25219. unset($source, $target);
  25220. }
  25221. private function getCertificateCnAndFp($url, $options)
  25222. {
  25223. if (PHP_VERSION_ID >= 50600) {
  25224. throw new \BadMethodCallException(sprintf(
  25225. '%s must not be used on PHP >= 5.6',
  25226. __METHOD__
  25227. ));
  25228. }
  25229. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  25230. 'ssl' => array(
  25231. 'capture_peer_cert' => true,
  25232. 'verify_peer' => false,
  25233. ), ),
  25234. ));
  25235. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  25236. return;
  25237. }
  25238. fclose($handle);
  25239. $handle = null;
  25240. $params = stream_context_get_params($context);
  25241. if (!empty($params['options']['ssl']['peer_certificate'])) {
  25242. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  25243. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  25244. return array(
  25245. 'cn' => $commonName,
  25246. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  25247. );
  25248. }
  25249. }
  25250. }
  25251. private function getUrlAuthority($url)
  25252. {
  25253. $defaultPorts = array(
  25254. 'ftp' => 21,
  25255. 'http' => 80,
  25256. 'https' => 443,
  25257. 'ssh2.sftp' => 22,
  25258. 'ssh2.scp' => 22,
  25259. );
  25260. $scheme = parse_url($url, PHP_URL_SCHEME);
  25261. if (!isset($defaultPorts[$scheme])) {
  25262. throw new \InvalidArgumentException(sprintf(
  25263. 'Could not get default port for unknown scheme: %s',
  25264. $scheme
  25265. ));
  25266. }
  25267. $defaultPort = $defaultPorts[$scheme];
  25268. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  25269. return parse_url($url, PHP_URL_HOST).':'.$port;
  25270. }
  25271. private function isPublicBitBucketDownload($urlToBitBucketFile)
  25272. {
  25273. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  25274. $pathParts = explode('/', $path);
  25275. if (count($pathParts) >= 4 && $pathParts[3] == 'downloads') {
  25276. return true;
  25277. }
  25278. return false;
  25279. }
  25280. }
  25281. <?php
  25282. namespace Composer\Util;
  25283. class Silencer
  25284. {
  25285. private static $stack = array();
  25286. public static function suppress($mask = null)
  25287. {
  25288. if (!isset($mask)) {
  25289. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  25290. }
  25291. $old = error_reporting();
  25292. array_push(self::$stack, $old);
  25293. error_reporting($old & ~$mask);
  25294. return $old;
  25295. }
  25296. public static function restore()
  25297. {
  25298. if (!empty(self::$stack)) {
  25299. error_reporting(array_pop(self::$stack));
  25300. }
  25301. }
  25302. public static function call($callable )
  25303. {
  25304. try {
  25305. self::suppress();
  25306. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  25307. self::restore();
  25308. return $result;
  25309. } catch (\Exception $e) {
  25310. self::restore();
  25311. throw $e;
  25312. }
  25313. }
  25314. }
  25315. <?php
  25316. namespace Composer\Util;
  25317. use Composer\Spdx\SpdxLicenses;
  25318. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  25319. class SpdxLicense extends SpdxLicenses
  25320. {
  25321. }
  25322. <?php
  25323. namespace Composer\Util;
  25324. use Composer\Composer;
  25325. final class StreamContextFactory
  25326. {
  25327. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  25328. {
  25329. $options = array('http' => array(
  25330. 'follow_location' => 1,
  25331. 'max_redirects' => 20,
  25332. ));
  25333. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  25334. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  25335. }
  25336. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  25337. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  25338. }
  25339. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  25340. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  25341. }
  25342. if (!empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  25343. $pattern = new NoProxyPattern($_SERVER['no_proxy']);
  25344. if ($pattern->test($url)) {
  25345. unset($proxy);
  25346. }
  25347. }
  25348. if (!empty($proxy)) {
  25349. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  25350. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  25351. if (isset($proxy['port'])) {
  25352. $proxyURL .= ":" . $proxy['port'];
  25353. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  25354. $proxyURL .= ":80";
  25355. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  25356. $proxyURL .= ":443";
  25357. }
  25358. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  25359. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  25360. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  25361. }
  25362. $options['http']['proxy'] = $proxyURL;
  25363. switch (parse_url($url, PHP_URL_SCHEME)) {
  25364. case 'http':
  25365. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  25366. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  25367. $options['http']['request_fulluri'] = true;
  25368. }
  25369. break;
  25370. case 'https':
  25371. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  25372. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  25373. $options['http']['request_fulluri'] = true;
  25374. }
  25375. break;
  25376. }
  25377. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  25378. $options['ssl']['SNI_enabled'] = true;
  25379. if (PHP_VERSION_ID < 50600) {
  25380. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  25381. }
  25382. }
  25383. if (isset($proxy['user'])) {
  25384. $auth = urldecode($proxy['user']);
  25385. if (isset($proxy['pass'])) {
  25386. $auth .= ':' . urldecode($proxy['pass']);
  25387. }
  25388. $auth = base64_encode($auth);
  25389. if (isset($defaultOptions['http']['header'])) {
  25390. if (is_string($defaultOptions['http']['header'])) {
  25391. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  25392. }
  25393. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  25394. } else {
  25395. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  25396. }
  25397. }
  25398. }
  25399. $options = array_replace_recursive($options, $defaultOptions);
  25400. if (isset($options['http']['header'])) {
  25401. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  25402. }
  25403. if (defined('HHVM_VERSION')) {
  25404. $phpVersion = 'HHVM ' . HHVM_VERSION;
  25405. } else {
  25406. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  25407. }
  25408. if (!isset($options['http']['header']) || false === strpos(strtolower(implode('', $options['http']['header'])), 'user-agent')) {
  25409. $options['http']['header'][] = sprintf(
  25410. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  25411. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  25412. php_uname('s'),
  25413. php_uname('r'),
  25414. $phpVersion,
  25415. getenv('CI') ? '; CI' : ''
  25416. );
  25417. }
  25418. return stream_context_create($options, $defaultParams);
  25419. }
  25420. private static function fixHttpHeaderField($header)
  25421. {
  25422. if (!is_array($header)) {
  25423. $header = explode("\r\n", $header);
  25424. }
  25425. uasort($header, function ($el) {
  25426. return preg_match('{^content-type}i', $el) ? 1 : -1;
  25427. });
  25428. return $header;
  25429. }
  25430. }
  25431. <?php
  25432. namespace Composer\Util;
  25433. use Composer\Config;
  25434. use Composer\IO\IOInterface;
  25435. class Svn
  25436. {
  25437. const MAX_QTY_AUTH_TRIES = 5;
  25438. protected $credentials;
  25439. protected $hasAuth;
  25440. protected $io;
  25441. protected $url;
  25442. protected $cacheCredentials = true;
  25443. protected $process;
  25444. protected $qtyAuthTries = 0;
  25445. protected $config;
  25446. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  25447. {
  25448. $this->url = $url;
  25449. $this->io = $io;
  25450. $this->config = $config;
  25451. $this->process = $process ?: new ProcessExecutor;
  25452. }
  25453. public static function cleanEnv()
  25454. {
  25455. putenv("DYLD_LIBRARY_PATH");
  25456. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25457. }
  25458. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  25459. {
  25460. $this->config->prohibitUrlByConfig($url, $this->io);
  25461. $svnCommand = $this->getCommand($command, $url, $path);
  25462. $output = null;
  25463. $io = $this->io;
  25464. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  25465. if ($type !== 'out') {
  25466. return;
  25467. }
  25468. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  25469. return;
  25470. }
  25471. $output .= $buffer;
  25472. if ($verbose) {
  25473. $io->writeError($buffer, false);
  25474. }
  25475. };
  25476. $status = $this->process->execute($svnCommand, $handler, $cwd);
  25477. if (0 === $status) {
  25478. return $output;
  25479. }
  25480. $errorOutput = $this->process->getErrorOutput();
  25481. $fullOutput = implode("\n", array($output, $errorOutput));
  25482. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  25483. && false === stripos($fullOutput, 'authorization failed')
  25484. && false === stripos($fullOutput, 'svn: E170001:')
  25485. && false === stripos($fullOutput, 'svn: E215004:')) {
  25486. throw new \RuntimeException($fullOutput);
  25487. }
  25488. if (!$this->hasAuth()) {
  25489. $this->doAuthDance();
  25490. }
  25491. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  25492. return $this->execute($command, $url, $cwd, $path, $verbose);
  25493. }
  25494. throw new \RuntimeException(
  25495. 'wrong credentials provided ('.$fullOutput.')'
  25496. );
  25497. }
  25498. public function setCacheCredentials($cacheCredentials)
  25499. {
  25500. $this->cacheCredentials = $cacheCredentials;
  25501. }
  25502. protected function doAuthDance()
  25503. {
  25504. if (!$this->io->isInteractive()) {
  25505. throw new \RuntimeException(
  25506. 'can not ask for authentication in non interactive mode'
  25507. );
  25508. }
  25509. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  25510. $this->hasAuth = true;
  25511. $this->credentials['username'] = $this->io->ask("Username: ");
  25512. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  25513. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  25514. return $this;
  25515. }
  25516. protected function getCommand($cmd, $url, $path = null)
  25517. {
  25518. $cmd = sprintf('%s %s%s %s',
  25519. $cmd,
  25520. '--non-interactive ',
  25521. $this->getCredentialString(),
  25522. ProcessExecutor::escape($url)
  25523. );
  25524. if ($path) {
  25525. $cmd .= ' ' . ProcessExecutor::escape($path);
  25526. }
  25527. return $cmd;
  25528. }
  25529. protected function getCredentialString()
  25530. {
  25531. if (!$this->hasAuth()) {
  25532. return '';
  25533. }
  25534. return sprintf(
  25535. ' %s--username %s --password %s ',
  25536. $this->getAuthCache(),
  25537. ProcessExecutor::escape($this->getUsername()),
  25538. ProcessExecutor::escape($this->getPassword())
  25539. );
  25540. }
  25541. protected function getPassword()
  25542. {
  25543. if ($this->credentials === null) {
  25544. throw new \LogicException("No svn auth detected.");
  25545. }
  25546. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  25547. }
  25548. protected function getUsername()
  25549. {
  25550. if ($this->credentials === null) {
  25551. throw new \LogicException("No svn auth detected.");
  25552. }
  25553. return $this->credentials['username'];
  25554. }
  25555. protected function hasAuth()
  25556. {
  25557. if (null !== $this->hasAuth) {
  25558. return $this->hasAuth;
  25559. }
  25560. if (false === $this->createAuthFromConfig()) {
  25561. $this->createAuthFromUrl();
  25562. }
  25563. return $this->hasAuth;
  25564. }
  25565. protected function getAuthCache()
  25566. {
  25567. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  25568. }
  25569. private function createAuthFromConfig()
  25570. {
  25571. if (!$this->config->has('http-basic')) {
  25572. return $this->hasAuth = false;
  25573. }
  25574. $authConfig = $this->config->get('http-basic');
  25575. $host = parse_url($this->url, PHP_URL_HOST);
  25576. if (isset($authConfig[$host])) {
  25577. $this->credentials['username'] = $authConfig[$host]['username'];
  25578. $this->credentials['password'] = $authConfig[$host]['password'];
  25579. return $this->hasAuth = true;
  25580. }
  25581. return $this->hasAuth = false;
  25582. }
  25583. private function createAuthFromUrl()
  25584. {
  25585. $uri = parse_url($this->url);
  25586. if (empty($uri['user'])) {
  25587. return $this->hasAuth = false;
  25588. }
  25589. $this->credentials['username'] = $uri['user'];
  25590. if (!empty($uri['pass'])) {
  25591. $this->credentials['password'] = $uri['pass'];
  25592. }
  25593. return $this->hasAuth = true;
  25594. }
  25595. }
  25596. <?php
  25597. namespace Composer\Util;
  25598. use Symfony\Component\Process\PhpProcess;
  25599. use Composer\CaBundle\CaBundle;
  25600. final class TlsHelper
  25601. {
  25602. private static $useOpensslParse;
  25603. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  25604. {
  25605. $names = self::getCertificateNames($certificate);
  25606. if (empty($names)) {
  25607. return false;
  25608. }
  25609. $combinedNames = array_merge($names['san'], array($names['cn']));
  25610. $hostname = strtolower($hostname);
  25611. foreach ($combinedNames as $certName) {
  25612. $matcher = self::certNameMatcher($certName);
  25613. if ($matcher && $matcher($hostname)) {
  25614. $cn = $names['cn'];
  25615. return true;
  25616. }
  25617. }
  25618. return false;
  25619. }
  25620. public static function getCertificateNames($certificate)
  25621. {
  25622. if (is_array($certificate)) {
  25623. $info = $certificate;
  25624. } elseif (CaBundle::isOpensslParseSafe()) {
  25625. $info = openssl_x509_parse($certificate, false);
  25626. }
  25627. if (!isset($info['subject']['commonName'])) {
  25628. return null;
  25629. }
  25630. $commonName = strtolower($info['subject']['commonName']);
  25631. $subjectAltNames = array();
  25632. if (isset($info['extensions']['subjectAltName'])) {
  25633. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  25634. $subjectAltNames = array_filter(array_map(function ($name) {
  25635. if (0 === strpos($name, 'DNS:')) {
  25636. return strtolower(ltrim(substr($name, 4)));
  25637. }
  25638. return null;
  25639. }, $subjectAltNames));
  25640. $subjectAltNames = array_values($subjectAltNames);
  25641. }
  25642. return array(
  25643. 'cn' => $commonName,
  25644. 'san' => $subjectAltNames,
  25645. );
  25646. }
  25647. public static function getCertificateFingerprint($certificate)
  25648. {
  25649. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  25650. $pubkeypem = $pubkeydetails['key'];
  25651. $start = '-----BEGIN PUBLIC KEY-----';
  25652. $end = '-----END PUBLIC KEY-----';
  25653. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  25654. $der = base64_decode($pemtrim);
  25655. return sha1($der);
  25656. }
  25657. public static function isOpensslParseSafe()
  25658. {
  25659. return CaBundle::isOpensslParseSafe();
  25660. }
  25661. private static function certNameMatcher($certName)
  25662. {
  25663. $wildcards = substr_count($certName, '*');
  25664. if (0 === $wildcards) {
  25665. return function ($hostname) use ($certName) {
  25666. return $hostname === $certName;
  25667. };
  25668. }
  25669. if (1 === $wildcards) {
  25670. $components = explode('.', $certName);
  25671. if (3 > count($components)) {
  25672. return;
  25673. }
  25674. $firstComponent = $components[0];
  25675. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  25676. return;
  25677. }
  25678. $wildcardRegex = preg_quote($certName);
  25679. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  25680. $wildcardRegex = "{^{$wildcardRegex}$}";
  25681. return function ($hostname) use ($wildcardRegex) {
  25682. return 1 === preg_match($wildcardRegex, $hostname);
  25683. };
  25684. }
  25685. }
  25686. }
  25687. <?php
  25688. namespace Composer;
  25689. use Composer\Util\IniHelper;
  25690. use Symfony\Component\Console\Output\OutputInterface;
  25691. class XdebugHandler
  25692. {
  25693. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  25694. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  25695. const RESTART_ID = 'internal';
  25696. private $output;
  25697. private $loaded;
  25698. private $envScanDir;
  25699. private $version;
  25700. private $tmpIni;
  25701. public function __construct(OutputInterface $output)
  25702. {
  25703. $this->output = $output;
  25704. $this->loaded = extension_loaded('xdebug');
  25705. $this->envScanDir = getenv('PHP_INI_SCAN_DIR');
  25706. if ($this->loaded) {
  25707. $ext = new \ReflectionExtension('xdebug');
  25708. $this->version = strval($ext->getVersion());
  25709. }
  25710. }
  25711. public function check()
  25712. {
  25713. $args = explode('|', strval(getenv(self::ENV_ALLOW)), 2);
  25714. if ($this->needsRestart($args[0])) {
  25715. if ($this->prepareRestart()) {
  25716. $command = $this->getCommand();
  25717. $this->restart($command);
  25718. }
  25719. return;
  25720. }
  25721. if (self::RESTART_ID === $args[0]) {
  25722. putenv(self::ENV_ALLOW);
  25723. if (false !== $this->envScanDir) {
  25724. if (isset($args[1])) {
  25725. putenv('PHP_INI_SCAN_DIR='.$args[1]);
  25726. } else {
  25727. putenv('PHP_INI_SCAN_DIR');
  25728. }
  25729. }
  25730. if ($this->loaded) {
  25731. putenv(self::ENV_VERSION);
  25732. }
  25733. }
  25734. }
  25735. protected function restart($command)
  25736. {
  25737. passthru($command, $exitCode);
  25738. if (!empty($this->tmpIni)) {
  25739. @unlink($this->tmpIni);
  25740. }
  25741. exit($exitCode);
  25742. }
  25743. private function needsRestart($allow)
  25744. {
  25745. if (PHP_SAPI !== 'cli' || !defined('PHP_BINARY')) {
  25746. return false;
  25747. }
  25748. return empty($allow) && $this->loaded;
  25749. }
  25750. private function prepareRestart()
  25751. {
  25752. $this->tmpIni = '';
  25753. $iniPaths = IniHelper::getAll();
  25754. $additional = count($iniPaths) > 1;
  25755. if (empty($iniPaths[0])) {
  25756. array_shift($iniPaths);
  25757. }
  25758. if ($this->writeTmpIni($iniPaths)) {
  25759. return $this->setEnvironment($additional, $iniPaths);
  25760. }
  25761. return false;
  25762. }
  25763. private function writeTmpIni(array $iniFiles)
  25764. {
  25765. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  25766. return false;
  25767. }
  25768. $content = '';
  25769. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  25770. foreach ($iniFiles as $file) {
  25771. $data = preg_replace($regex, ';$1', file_get_contents($file));
  25772. $content .= $data.PHP_EOL;
  25773. }
  25774. $content .= PHP_EOL.'memory_limit='.ini_get('memory_limit').PHP_EOL;
  25775. return @file_put_contents($this->tmpIni, $content);
  25776. }
  25777. private function getCommand()
  25778. {
  25779. $phpArgs = array(PHP_BINARY, '-c', $this->tmpIni);
  25780. $params = array_merge($phpArgs, $this->getScriptArgs($_SERVER['argv']));
  25781. return implode(' ', array_map(array($this, 'escape'), $params));
  25782. }
  25783. private function setEnvironment($additional, array $iniPaths)
  25784. {
  25785. if ($additional && !putenv('PHP_INI_SCAN_DIR=')) {
  25786. return false;
  25787. }
  25788. if (!putenv(IniHelper::ENV_ORIGINAL.'='.implode(PATH_SEPARATOR, $iniPaths))) {
  25789. return false;
  25790. }
  25791. if (!putenv(self::ENV_VERSION.'='.$this->version)) {
  25792. return false;
  25793. }
  25794. $args = array(self::RESTART_ID);
  25795. if (false !== $this->envScanDir) {
  25796. $args[] = $this->envScanDir;
  25797. }
  25798. return putenv(self::ENV_ALLOW.'='.implode('|', $args));
  25799. }
  25800. private function getScriptArgs(array $args)
  25801. {
  25802. if (in_array('--no-ansi', $args) || in_array('--ansi', $args)) {
  25803. return $args;
  25804. }
  25805. if ($this->output->isDecorated()) {
  25806. $offset = count($args) > 1 ? 2: 1;
  25807. array_splice($args, $offset, 0, '--ansi');
  25808. }
  25809. return $args;
  25810. }
  25811. private function escape($arg, $meta = true)
  25812. {
  25813. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  25814. return escapeshellarg($arg);
  25815. }
  25816. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  25817. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  25818. if ($meta) {
  25819. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  25820. if (!$meta && !$quote) {
  25821. $quote = strpbrk($arg, '^&|<>()') !== false;
  25822. }
  25823. }
  25824. if ($quote) {
  25825. $arg = preg_replace('/(\\\\*)$/', '$1$1', $arg);
  25826. $arg = '"'.$arg.'"';
  25827. }
  25828. if ($meta) {
  25829. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  25830. }
  25831. return $arg;
  25832. }
  25833. }
  25834. <?php
  25835. function includeIfExists($file)
  25836. {
  25837. return file_exists($file) ? include $file : false;
  25838. }
  25839. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  25840. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  25841. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  25842. exit(1);
  25843. }
  25844. return $loader;
  25845. <?php
  25846. /*
  25847. * This file is part of Composer.
  25848. *
  25849. * (c) Nils Adermann <naderman@naderman.de>
  25850. * Jordi Boggiano <j.boggiano@seld.be>
  25851. *
  25852. * For the full copyright and license information, please view the LICENSE
  25853. * file that was distributed with this source code.
  25854. */
  25855. namespace Composer\Autoload;
  25856. /**
  25857. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  25858. *
  25859. * $loader = new \Composer\Autoload\ClassLoader();
  25860. *
  25861. * // register classes with namespaces
  25862. * $loader->add('Symfony\Component', __DIR__.'/component');
  25863. * $loader->add('Symfony', __DIR__.'/framework');
  25864. *
  25865. * // activate the autoloader
  25866. * $loader->register();
  25867. *
  25868. * // to enable searching the include path (eg. for PEAR packages)
  25869. * $loader->setUseIncludePath(true);
  25870. *
  25871. * In this example, if you try to use a class in the Symfony\Component
  25872. * namespace or one of its children (Symfony\Component\Console for instance),
  25873. * the autoloader will first look for the class under the component/
  25874. * directory, and it will then fallback to the framework/ directory if not
  25875. * found before giving up.
  25876. *
  25877. * This class is loosely based on the Symfony UniversalClassLoader.
  25878. *
  25879. * @author Fabien Potencier <fabien@symfony.com>
  25880. * @author Jordi Boggiano <j.boggiano@seld.be>
  25881. * @see http://www.php-fig.org/psr/psr-0/
  25882. * @see http://www.php-fig.org/psr/psr-4/
  25883. */
  25884. class ClassLoader
  25885. {
  25886. // PSR-4
  25887. private $prefixLengthsPsr4 = array();
  25888. private $prefixDirsPsr4 = array();
  25889. private $fallbackDirsPsr4 = array();
  25890. // PSR-0
  25891. private $prefixesPsr0 = array();
  25892. private $fallbackDirsPsr0 = array();
  25893. private $useIncludePath = false;
  25894. private $classMap = array();
  25895. private $classMapAuthoritative = false;
  25896. private $missingClasses = array();
  25897. private $apcuPrefix;
  25898. public function getPrefixes()
  25899. {
  25900. if (!empty($this->prefixesPsr0)) {
  25901. return call_user_func_array('array_merge', $this->prefixesPsr0);
  25902. }
  25903. return array();
  25904. }
  25905. public function getPrefixesPsr4()
  25906. {
  25907. return $this->prefixDirsPsr4;
  25908. }
  25909. public function getFallbackDirs()
  25910. {
  25911. return $this->fallbackDirsPsr0;
  25912. }
  25913. public function getFallbackDirsPsr4()
  25914. {
  25915. return $this->fallbackDirsPsr4;
  25916. }
  25917. public function getClassMap()
  25918. {
  25919. return $this->classMap;
  25920. }
  25921. /**
  25922. * @param array $classMap Class to filename map
  25923. */
  25924. public function addClassMap(array $classMap)
  25925. {
  25926. if ($this->classMap) {
  25927. $this->classMap = array_merge($this->classMap, $classMap);
  25928. } else {
  25929. $this->classMap = $classMap;
  25930. }
  25931. }
  25932. /**
  25933. * Registers a set of PSR-0 directories for a given prefix, either
  25934. * appending or prepending to the ones previously set for this prefix.
  25935. *
  25936. * @param string $prefix The prefix
  25937. * @param array|string $paths The PSR-0 root directories
  25938. * @param bool $prepend Whether to prepend the directories
  25939. */
  25940. public function add($prefix, $paths, $prepend = false)
  25941. {
  25942. if (!$prefix) {
  25943. if ($prepend) {
  25944. $this->fallbackDirsPsr0 = array_merge(
  25945. (array) $paths,
  25946. $this->fallbackDirsPsr0
  25947. );
  25948. } else {
  25949. $this->fallbackDirsPsr0 = array_merge(
  25950. $this->fallbackDirsPsr0,
  25951. (array) $paths
  25952. );
  25953. }
  25954. return;
  25955. }
  25956. $first = $prefix[0];
  25957. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  25958. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  25959. return;
  25960. }
  25961. if ($prepend) {
  25962. $this->prefixesPsr0[$first][$prefix] = array_merge(
  25963. (array) $paths,
  25964. $this->prefixesPsr0[$first][$prefix]
  25965. );
  25966. } else {
  25967. $this->prefixesPsr0[$first][$prefix] = array_merge(
  25968. $this->prefixesPsr0[$first][$prefix],
  25969. (array) $paths
  25970. );
  25971. }
  25972. }
  25973. /**
  25974. * Registers a set of PSR-4 directories for a given namespace, either
  25975. * appending or prepending to the ones previously set for this namespace.
  25976. *
  25977. * @param string $prefix The prefix/namespace, with trailing '\\'
  25978. * @param array|string $paths The PSR-4 base directories
  25979. * @param bool $prepend Whether to prepend the directories
  25980. *
  25981. * @throws \InvalidArgumentException
  25982. */
  25983. public function addPsr4($prefix, $paths, $prepend = false)
  25984. {
  25985. if (!$prefix) {
  25986. // Register directories for the root namespace.
  25987. if ($prepend) {
  25988. $this->fallbackDirsPsr4 = array_merge(
  25989. (array) $paths,
  25990. $this->fallbackDirsPsr4
  25991. );
  25992. } else {
  25993. $this->fallbackDirsPsr4 = array_merge(
  25994. $this->fallbackDirsPsr4,
  25995. (array) $paths
  25996. );
  25997. }
  25998. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  25999. // Register directories for a new namespace.
  26000. $length = strlen($prefix);
  26001. if ('\\' !== $prefix[$length - 1]) {
  26002. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  26003. }
  26004. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  26005. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  26006. } elseif ($prepend) {
  26007. // Prepend directories for an already registered namespace.
  26008. $this->prefixDirsPsr4[$prefix] = array_merge(
  26009. (array) $paths,
  26010. $this->prefixDirsPsr4[$prefix]
  26011. );
  26012. } else {
  26013. // Append directories for an already registered namespace.
  26014. $this->prefixDirsPsr4[$prefix] = array_merge(
  26015. $this->prefixDirsPsr4[$prefix],
  26016. (array) $paths
  26017. );
  26018. }
  26019. }
  26020. /**
  26021. * Registers a set of PSR-0 directories for a given prefix,
  26022. * replacing any others previously set for this prefix.
  26023. *
  26024. * @param string $prefix The prefix
  26025. * @param array|string $paths The PSR-0 base directories
  26026. */
  26027. public function set($prefix, $paths)
  26028. {
  26029. if (!$prefix) {
  26030. $this->fallbackDirsPsr0 = (array) $paths;
  26031. } else {
  26032. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  26033. }
  26034. }
  26035. /**
  26036. * Registers a set of PSR-4 directories for a given namespace,
  26037. * replacing any others previously set for this namespace.
  26038. *
  26039. * @param string $prefix The prefix/namespace, with trailing '\\'
  26040. * @param array|string $paths The PSR-4 base directories
  26041. *
  26042. * @throws \InvalidArgumentException
  26043. */
  26044. public function setPsr4($prefix, $paths)
  26045. {
  26046. if (!$prefix) {
  26047. $this->fallbackDirsPsr4 = (array) $paths;
  26048. } else {
  26049. $length = strlen($prefix);
  26050. if ('\\' !== $prefix[$length - 1]) {
  26051. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  26052. }
  26053. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  26054. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  26055. }
  26056. }
  26057. /**
  26058. * Turns on searching the include path for class files.
  26059. *
  26060. * @param bool $useIncludePath
  26061. */
  26062. public function setUseIncludePath($useIncludePath)
  26063. {
  26064. $this->useIncludePath = $useIncludePath;
  26065. }
  26066. /**
  26067. * Can be used to check if the autoloader uses the include path to check
  26068. * for classes.
  26069. *
  26070. * @return bool
  26071. */
  26072. public function getUseIncludePath()
  26073. {
  26074. return $this->useIncludePath;
  26075. }
  26076. /**
  26077. * Turns off searching the prefix and fallback directories for classes
  26078. * that have not been registered with the class map.
  26079. *
  26080. * @param bool $classMapAuthoritative
  26081. */
  26082. public function setClassMapAuthoritative($classMapAuthoritative)
  26083. {
  26084. $this->classMapAuthoritative = $classMapAuthoritative;
  26085. }
  26086. /**
  26087. * Should class lookup fail if not found in the current class map?
  26088. *
  26089. * @return bool
  26090. */
  26091. public function isClassMapAuthoritative()
  26092. {
  26093. return $this->classMapAuthoritative;
  26094. }
  26095. /**
  26096. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  26097. *
  26098. * @param string|null $apcuPrefix
  26099. */
  26100. public function setApcuPrefix($apcuPrefix)
  26101. {
  26102. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  26103. }
  26104. /**
  26105. * The APCu prefix in use, or null if APCu caching is not enabled.
  26106. *
  26107. * @return string|null
  26108. */
  26109. public function getApcuPrefix()
  26110. {
  26111. return $this->apcuPrefix;
  26112. }
  26113. /**
  26114. * Registers this instance as an autoloader.
  26115. *
  26116. * @param bool $prepend Whether to prepend the autoloader or not
  26117. */
  26118. public function register($prepend = false)
  26119. {
  26120. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  26121. }
  26122. /**
  26123. * Unregisters this instance as an autoloader.
  26124. */
  26125. public function unregister()
  26126. {
  26127. spl_autoload_unregister(array($this, 'loadClass'));
  26128. }
  26129. /**
  26130. * Loads the given class or interface.
  26131. *
  26132. * @param string $class The name of the class
  26133. * @return bool|null True if loaded, null otherwise
  26134. */
  26135. public function loadClass($class)
  26136. {
  26137. if ($file = $this->findFile($class)) {
  26138. includeFile($file);
  26139. return true;
  26140. }
  26141. }
  26142. /**
  26143. * Finds the path to the file where the class is defined.
  26144. *
  26145. * @param string $class The name of the class
  26146. *
  26147. * @return string|false The path if found, false otherwise
  26148. */
  26149. public function findFile($class)
  26150. {
  26151. // class map lookup
  26152. if (isset($this->classMap[$class])) {
  26153. return $this->classMap[$class];
  26154. }
  26155. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  26156. return false;
  26157. }
  26158. if (null !== $this->apcuPrefix) {
  26159. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  26160. if ($hit) {
  26161. return $file;
  26162. }
  26163. }
  26164. $file = $this->findFileWithExtension($class, '.php');
  26165. // Search for Hack files if we are running on HHVM
  26166. if (false === $file && defined('HHVM_VERSION')) {
  26167. $file = $this->findFileWithExtension($class, '.hh');
  26168. }
  26169. if (null !== $this->apcuPrefix) {
  26170. apcu_add($this->apcuPrefix.$class, $file);
  26171. }
  26172. if (false === $file) {
  26173. // Remember that this class does not exist.
  26174. $this->missingClasses[$class] = true;
  26175. }
  26176. return $file;
  26177. }
  26178. private function findFileWithExtension($class, $ext)
  26179. {
  26180. // PSR-4 lookup
  26181. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  26182. $first = $class[0];
  26183. if (isset($this->prefixLengthsPsr4[$first])) {
  26184. foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
  26185. if (0 === strpos($class, $prefix)) {
  26186. foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
  26187. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  26188. return $file;
  26189. }
  26190. }
  26191. }
  26192. }
  26193. }
  26194. // PSR-4 fallback dirs
  26195. foreach ($this->fallbackDirsPsr4 as $dir) {
  26196. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  26197. return $file;
  26198. }
  26199. }
  26200. // PSR-0 lookup
  26201. if (false !== $pos = strrpos($class, '\\')) {
  26202. // namespaced class name
  26203. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  26204. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  26205. } else {
  26206. // PEAR-like class name
  26207. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  26208. }
  26209. if (isset($this->prefixesPsr0[$first])) {
  26210. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  26211. if (0 === strpos($class, $prefix)) {
  26212. foreach ($dirs as $dir) {
  26213. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  26214. return $file;
  26215. }
  26216. }
  26217. }
  26218. }
  26219. }
  26220. // PSR-0 fallback dirs
  26221. foreach ($this->fallbackDirsPsr0 as $dir) {
  26222. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  26223. return $file;
  26224. }
  26225. }
  26226. // PSR-0 include paths.
  26227. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  26228. return $file;
  26229. }
  26230. return false;
  26231. }
  26232. }
  26233. /**
  26234. * Scope isolated include.
  26235. *
  26236. * Prevents access to $this/self from included files.
  26237. */
  26238. function includeFile($file)
  26239. {
  26240. include $file;
  26241. }
  26242. {
  26243. "$schema": "http://json-schema.org/draft-04/schema#",
  26244. "description": "A representation of packages metadata.",
  26245. "type": "object",
  26246. "oneOf": [
  26247. { "required": [ "packages" ] },
  26248. { "required": [ "providers" ] },
  26249. { "required": [ "provider-includes", "providers-url" ] }
  26250. ],
  26251. "properties": {
  26252. "packages": {
  26253. "type": ["object", "array"],
  26254. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  26255. "additionalProperties": { "$ref": "#/definitions/versions" }
  26256. },
  26257. "providers-url": {
  26258. "type": "string",
  26259. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  26260. },
  26261. "provider-includes": {
  26262. "type": "object",
  26263. "description": "A hashmap of provider listings.",
  26264. "additionalProperties": { "$ref": "#/definitions/provider" }
  26265. },
  26266. "providers": {
  26267. "type": "object",
  26268. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  26269. "additionalProperties": { "$ref": "#/definitions/provider" }
  26270. },
  26271. "notify-batch": {
  26272. "type": "string",
  26273. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  26274. },
  26275. "search": {
  26276. "type": "string",
  26277. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  26278. },
  26279. "warning": {
  26280. "type": "string",
  26281. "description": "A message that will be output by Composer as a warning when this source is consulted."
  26282. }
  26283. },
  26284. "definitions": {
  26285. "versions": {
  26286. "type": "object",
  26287. "description": "A hashmap of versions and their metadata.",
  26288. "additionalProperties": { "$ref": "#/definitions/version" }
  26289. },
  26290. "version": {
  26291. "type": "object",
  26292. "oneOf": [
  26293. { "$ref": "#/definitions/package" },
  26294. { "$ref": "#/definitions/metapackage" }
  26295. ]
  26296. },
  26297. "package-base": {
  26298. "properties": {
  26299. "name": { "type": "string" },
  26300. "type": { "type": "string" },
  26301. "version": { "type": "string" },
  26302. "version_normalized": {
  26303. "type": "string",
  26304. "description": "Normalized version, optional but can save computational time on client side."
  26305. },
  26306. "autoload": { "type": "object" },
  26307. "require": { "type": "object" },
  26308. "replace": { "type": "object" },
  26309. "conflict": { "type": "object" },
  26310. "provide": { "type": "object" },
  26311. "time": { "type": "string" }
  26312. },
  26313. "additionalProperties": true
  26314. },
  26315. "package": {
  26316. "allOf": [
  26317. { "$ref": "#/definitions/package-base" },
  26318. {
  26319. "properties": {
  26320. "dist": { "type": "object" },
  26321. "source": { "type": "object" }
  26322. }
  26323. },
  26324. { "oneOf": [
  26325. { "required": [ "name", "version", "source" ] },
  26326. { "required": [ "name", "version", "dist" ] }
  26327. ] }
  26328. ]
  26329. },
  26330. "metapackage": {
  26331. "allOf": [
  26332. { "$ref": "#/definitions/package-base" },
  26333. {
  26334. "properties": {
  26335. "type": { "type": "string", "enum": [ "metapackage" ] }
  26336. },
  26337. "required": [ "name", "version", "type" ]
  26338. }
  26339. ]
  26340. },
  26341. "provider": {
  26342. "type": "object",
  26343. "properties": {
  26344. "sha256": {
  26345. "type": "string",
  26346. "description": "Hash value that can be used to validate the resource."
  26347. }
  26348. }
  26349. }
  26350. }
  26351. }
  26352. {
  26353. "$schema": "http://json-schema.org/draft-04/schema#",
  26354. "name": "Package",
  26355. "type": "object",
  26356. "additionalProperties": false,
  26357. "required": [ "name", "description" ],
  26358. "properties": {
  26359. "name": {
  26360. "type": "string",
  26361. "description": "Package name, including 'vendor-name/' prefix."
  26362. },
  26363. "type": {
  26364. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  26365. "type": "string"
  26366. },
  26367. "target-dir": {
  26368. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  26369. "type": "string"
  26370. },
  26371. "description": {
  26372. "type": "string",
  26373. "description": "Short package description."
  26374. },
  26375. "keywords": {
  26376. "type": "array",
  26377. "items": {
  26378. "type": "string",
  26379. "description": "A tag/keyword that this package relates to."
  26380. }
  26381. },
  26382. "homepage": {
  26383. "type": "string",
  26384. "description": "Homepage URL for the project.",
  26385. "format": "uri"
  26386. },
  26387. "version": {
  26388. "type": "string",
  26389. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  26390. },
  26391. "time": {
  26392. "type": "string",
  26393. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  26394. },
  26395. "license": {
  26396. "type": ["string", "array"],
  26397. "description": "License name. Or an array of license names."
  26398. },
  26399. "authors": {
  26400. "type": "array",
  26401. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  26402. "items": {
  26403. "type": "object",
  26404. "additionalProperties": false,
  26405. "required": [ "name"],
  26406. "properties": {
  26407. "name": {
  26408. "type": "string",
  26409. "description": "Full name of the author."
  26410. },
  26411. "email": {
  26412. "type": "string",
  26413. "description": "Email address of the author.",
  26414. "format": "email"
  26415. },
  26416. "homepage": {
  26417. "type": "string",
  26418. "description": "Homepage URL for the author.",
  26419. "format": "uri"
  26420. },
  26421. "role": {
  26422. "type": "string",
  26423. "description": "Author's role in the project."
  26424. }
  26425. }
  26426. }
  26427. },
  26428. "require": {
  26429. "type": "object",
  26430. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  26431. "additionalProperties": {
  26432. "type": "string"
  26433. }
  26434. },
  26435. "replace": {
  26436. "type": "object",
  26437. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  26438. "additionalProperties": {
  26439. "type": "string"
  26440. }
  26441. },
  26442. "conflict": {
  26443. "type": "object",
  26444. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  26445. "additionalProperties": {
  26446. "type": "string"
  26447. }
  26448. },
  26449. "provide": {
  26450. "type": "object",
  26451. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  26452. "additionalProperties": {
  26453. "type": "string"
  26454. }
  26455. },
  26456. "require-dev": {
  26457. "type": "object",
  26458. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  26459. "additionalProperties": {
  26460. "type": "string"
  26461. }
  26462. },
  26463. "suggest": {
  26464. "type": "object",
  26465. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  26466. "additionalProperties": {
  26467. "type": "string"
  26468. }
  26469. },
  26470. "config": {
  26471. "type": "object",
  26472. "description": "Composer options.",
  26473. "properties": {
  26474. "process-timeout": {
  26475. "type": "integer",
  26476. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  26477. },
  26478. "use-include-path": {
  26479. "type": "boolean",
  26480. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  26481. },
  26482. "preferred-install": {
  26483. "type": ["string", "object"],
  26484. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  26485. },
  26486. "notify-on-install": {
  26487. "type": "boolean",
  26488. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  26489. },
  26490. "github-protocols": {
  26491. "type": "array",
  26492. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  26493. "items": {
  26494. "type": "string"
  26495. }
  26496. },
  26497. "github-oauth": {
  26498. "type": "object",
  26499. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  26500. "additionalProperties": {
  26501. "type": "string"
  26502. }
  26503. },
  26504. "gitlab-oauth": {
  26505. "type": "object",
  26506. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  26507. "additionalProperties": {
  26508. "type": "string"
  26509. }
  26510. },
  26511. "gitlab-token": {
  26512. "type": "object",
  26513. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  26514. "additionalProperties": true
  26515. },
  26516. "disable-tls": {
  26517. "type": "boolean",
  26518. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  26519. },
  26520. "secure-http": {
  26521. "type": "boolean",
  26522. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  26523. },
  26524. "cafile": {
  26525. "type": "string",
  26526. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  26527. },
  26528. "capath": {
  26529. "type": "string",
  26530. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  26531. },
  26532. "http-basic": {
  26533. "type": "object",
  26534. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  26535. "additionalProperties": {
  26536. "type": "object",
  26537. "required": ["username", "password"],
  26538. "properties": {
  26539. "username": {
  26540. "type": "string",
  26541. "description": "The username used for HTTP Basic authentication"
  26542. },
  26543. "password": {
  26544. "type": "string",
  26545. "description": "The password used for HTTP Basic authentication"
  26546. }
  26547. }
  26548. }
  26549. },
  26550. "store-auths": {
  26551. "type": ["string", "boolean"],
  26552. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  26553. },
  26554. "platform": {
  26555. "type": "object",
  26556. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  26557. "additionalProperties": {
  26558. "type": "string"
  26559. }
  26560. },
  26561. "vendor-dir": {
  26562. "type": "string",
  26563. "description": "The location where all packages are installed, defaults to \"vendor\"."
  26564. },
  26565. "bin-dir": {
  26566. "type": "string",
  26567. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  26568. },
  26569. "data-dir": {
  26570. "type": "string",
  26571. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  26572. },
  26573. "cache-dir": {
  26574. "type": "string",
  26575. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  26576. },
  26577. "cache-files-dir": {
  26578. "type": "string",
  26579. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  26580. },
  26581. "cache-repo-dir": {
  26582. "type": "string",
  26583. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  26584. },
  26585. "cache-vcs-dir": {
  26586. "type": "string",
  26587. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  26588. },
  26589. "cache-ttl": {
  26590. "type": "integer",
  26591. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  26592. },
  26593. "cache-files-ttl": {
  26594. "type": "integer",
  26595. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  26596. },
  26597. "cache-files-maxsize": {
  26598. "type": ["string", "integer"],
  26599. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  26600. },
  26601. "bin-compat": {
  26602. "enum": ["auto", "full"],
  26603. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  26604. },
  26605. "discard-changes": {
  26606. "type": ["string", "boolean"],
  26607. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  26608. },
  26609. "autoloader-suffix": {
  26610. "type": "string",
  26611. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  26612. },
  26613. "optimize-autoloader": {
  26614. "type": "boolean",
  26615. "description": "Always optimize when dumping the autoloader."
  26616. },
  26617. "prepend-autoloader": {
  26618. "type": "boolean",
  26619. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  26620. },
  26621. "classmap-authoritative": {
  26622. "type": "boolean",
  26623. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  26624. },
  26625. "apcu-autoloader": {
  26626. "type": "boolean",
  26627. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  26628. },
  26629. "github-domains": {
  26630. "type": "array",
  26631. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  26632. "items": {
  26633. "type": "string"
  26634. }
  26635. },
  26636. "github-expose-hostname": {
  26637. "type": "boolean",
  26638. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  26639. },
  26640. "gitlab-domains": {
  26641. "type": "array",
  26642. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  26643. "items": {
  26644. "type": "string"
  26645. }
  26646. },
  26647. "archive-format": {
  26648. "type": "string",
  26649. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  26650. },
  26651. "archive-dir": {
  26652. "type": "string",
  26653. "description": "The default archive path when not provided on cli, defaults to \".\"."
  26654. }
  26655. }
  26656. },
  26657. "extra": {
  26658. "type": ["object", "array"],
  26659. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  26660. "additionalProperties": true
  26661. },
  26662. "autoload": {
  26663. "type": "object",
  26664. "description": "Description of how the package can be autoloaded.",
  26665. "properties": {
  26666. "psr-0": {
  26667. "type": "object",
  26668. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  26669. "additionalProperties": {
  26670. "type": ["string", "array"],
  26671. "items": {
  26672. "type": "string"
  26673. }
  26674. }
  26675. },
  26676. "psr-4": {
  26677. "type": "object",
  26678. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  26679. "additionalProperties": {
  26680. "type": ["string", "array"],
  26681. "items": {
  26682. "type": "string"
  26683. }
  26684. }
  26685. },
  26686. "classmap": {
  26687. "type": "array",
  26688. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  26689. },
  26690. "files": {
  26691. "type": "array",
  26692. "description": "This is an array of files that are always required on every request."
  26693. },
  26694. "exclude-from-classmap": {
  26695. "type": "array",
  26696. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  26697. }
  26698. }
  26699. },
  26700. "autoload-dev": {
  26701. "type": "object",
  26702. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  26703. "properties": {
  26704. "psr-0": {
  26705. "type": "object",
  26706. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  26707. "additionalProperties": {
  26708. "type": ["string", "array"],
  26709. "items": {
  26710. "type": "string"
  26711. }
  26712. }
  26713. },
  26714. "psr-4": {
  26715. "type": "object",
  26716. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  26717. "additionalProperties": {
  26718. "type": ["string", "array"],
  26719. "items": {
  26720. "type": "string"
  26721. }
  26722. }
  26723. },
  26724. "classmap": {
  26725. "type": "array",
  26726. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  26727. },
  26728. "files": {
  26729. "type": "array",
  26730. "description": "This is an array of files that are always required on every request."
  26731. }
  26732. }
  26733. },
  26734. "archive": {
  26735. "type": ["object"],
  26736. "description": "Options for creating package archives for distribution.",
  26737. "properties": {
  26738. "exclude": {
  26739. "type": "array",
  26740. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  26741. }
  26742. }
  26743. },
  26744. "repositories": {
  26745. "type": ["object", "array"],
  26746. "description": "A set of additional repositories where packages can be found.",
  26747. "additionalProperties": true
  26748. },
  26749. "minimum-stability": {
  26750. "type": ["string"],
  26751. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  26752. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  26753. },
  26754. "prefer-stable": {
  26755. "type": ["boolean"],
  26756. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  26757. },
  26758. "bin": {
  26759. "type": ["array"],
  26760. "description": "A set of files that should be treated as binaries and symlinked into bin-dir (from config).",
  26761. "items": {
  26762. "type": "string"
  26763. }
  26764. },
  26765. "include-path": {
  26766. "type": ["array"],
  26767. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  26768. "items": {
  26769. "type": "string"
  26770. }
  26771. },
  26772. "scripts": {
  26773. "type": ["object"],
  26774. "description": "Scripts listeners that will be executed before/after some events.",
  26775. "properties": {
  26776. "pre-install-cmd": {
  26777. "type": ["array", "string"],
  26778. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  26779. },
  26780. "post-install-cmd": {
  26781. "type": ["array", "string"],
  26782. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  26783. },
  26784. "pre-update-cmd": {
  26785. "type": ["array", "string"],
  26786. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  26787. },
  26788. "post-update-cmd": {
  26789. "type": ["array", "string"],
  26790. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  26791. },
  26792. "pre-status-cmd": {
  26793. "type": ["array", "string"],
  26794. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  26795. },
  26796. "post-status-cmd": {
  26797. "type": ["array", "string"],
  26798. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  26799. },
  26800. "pre-package-install": {
  26801. "type": ["array", "string"],
  26802. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  26803. },
  26804. "post-package-install": {
  26805. "type": ["array", "string"],
  26806. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  26807. },
  26808. "pre-package-update": {
  26809. "type": ["array", "string"],
  26810. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  26811. },
  26812. "post-package-update": {
  26813. "type": ["array", "string"],
  26814. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  26815. },
  26816. "pre-package-uninstall": {
  26817. "type": ["array", "string"],
  26818. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  26819. },
  26820. "post-package-uninstall": {
  26821. "type": ["array", "string"],
  26822. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  26823. },
  26824. "pre-autoload-dump": {
  26825. "type": ["array", "string"],
  26826. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  26827. },
  26828. "post-autoload-dump": {
  26829. "type": ["array", "string"],
  26830. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  26831. },
  26832. "post-root-package-install": {
  26833. "type": ["array", "string"],
  26834. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  26835. },
  26836. "post-create-project-cmd": {
  26837. "type": ["array", "string"],
  26838. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  26839. }
  26840. }
  26841. },
  26842. "support": {
  26843. "type": "object",
  26844. "properties": {
  26845. "email": {
  26846. "type": "string",
  26847. "description": "Email address for support.",
  26848. "format": "email"
  26849. },
  26850. "issues": {
  26851. "type": "string",
  26852. "description": "URL to the issue tracker.",
  26853. "format": "uri"
  26854. },
  26855. "forum": {
  26856. "type": "string",
  26857. "description": "URL to the forum.",
  26858. "format": "uri"
  26859. },
  26860. "wiki": {
  26861. "type": "string",
  26862. "description": "URL to the wiki.",
  26863. "format": "uri"
  26864. },
  26865. "irc": {
  26866. "type": "string",
  26867. "description": "IRC channel for support, as irc://server/channel.",
  26868. "format": "uri"
  26869. },
  26870. "source": {
  26871. "type": "string",
  26872. "description": "URL to browse or download the sources.",
  26873. "format": "uri"
  26874. },
  26875. "docs": {
  26876. "type": "string",
  26877. "description": "URL to the documentation.",
  26878. "format": "uri"
  26879. },
  26880. "rss": {
  26881. "type": "string",
  26882. "description": "URL to the RSS feed.",
  26883. "format": "uri"
  26884. }
  26885. }
  26886. },
  26887. "non-feature-branches": {
  26888. "type": ["array"],
  26889. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  26890. "items": {
  26891. "type": "string"
  26892. }
  26893. },
  26894. "abandoned": {
  26895. "type": ["boolean", "string"],
  26896. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  26897. },
  26898. "_comment": {
  26899. "type": ["array", "string"],
  26900. "description": "A key to store comments in"
  26901. }
  26902. }
  26903. }
  26904. {
  26905. "389-exception": [
  26906. "389 Directory Server\nException"
  26907. ],
  26908. "Autoconf-exception-2.0": [
  26909. "Autoconf exception 2.0"
  26910. ],
  26911. "Autoconf-exception-3.0": [
  26912. "Autoconf exception 3.0"
  26913. ],
  26914. "Bison-exception-2.2": [
  26915. "Bison exception 2.2"
  26916. ],
  26917. "Classpath-exception-2.0": [
  26918. "Classpath exception 2.0"
  26919. ],
  26920. "CLISP-exception-2.0": [
  26921. "CLISP exception 2.0"
  26922. ],
  26923. "DigiRule-FOSS-exception": [
  26924. "DigiRule FOSS License Exception"
  26925. ],
  26926. "eCos-exception-2.0": [
  26927. "eCos exception 2.0"
  26928. ],
  26929. "Fawkes-Runtime-exception": [
  26930. "Fawkes Runtime Exception"
  26931. ],
  26932. "FLTK-exception": [
  26933. "FLTK exception"
  26934. ],
  26935. "Font-exception-2.0": [
  26936. "Font exception 2.0"
  26937. ],
  26938. "freertos-exception-2.0": [
  26939. "FreeRTOS Exception 2.0"
  26940. ],
  26941. "GCC-exception-2.0": [
  26942. "GCC Runtime Library exception 2.0"
  26943. ],
  26944. "GCC-exception-3.1": [
  26945. "GCC Runtime Library exception 3.1"
  26946. ],
  26947. "gnu-javamail-exception": [
  26948. "GNU JavaMail exception"
  26949. ],
  26950. "i2p-gpl-java-exception": [
  26951. "i2p GPL+Java Exception"
  26952. ],
  26953. "Libtool-exception": [
  26954. "Libtool Exception"
  26955. ],
  26956. "LZMA-exception": [
  26957. "LZMA exception"
  26958. ],
  26959. "mif-exception": [
  26960. "Macros and Inline Functions Exception"
  26961. ],
  26962. "Nokia-Qt-exception-1.1": [
  26963. "Nokia Qt LGPL exception 1.1"
  26964. ],
  26965. "OCCT-exception-1.0": [
  26966. "Open CASCADE Exception 1.0"
  26967. ],
  26968. "openvpn-openssl-exception": [
  26969. "OpenVPN OpenSSL Exception"
  26970. ],
  26971. "Qwt-exception-1.0": [
  26972. "Qwt exception 1.0"
  26973. ],
  26974. "u-boot-exception-2.0": [
  26975. "U-Boot exception 2.0"
  26976. ],
  26977. "WxWindows-exception-3.1": [
  26978. "WxWindows Library Exception 3.1"
  26979. ]
  26980. }{
  26981. "0BSD": [
  26982. "BSD Zero Clause License",
  26983. true
  26984. ],
  26985. "AAL": [
  26986. "Attribution Assurance License",
  26987. true
  26988. ],
  26989. "Abstyles": [
  26990. "Abstyles License",
  26991. false
  26992. ],
  26993. "Adobe-2006": [
  26994. "Adobe Systems Incorporated Source Code License Agreement",
  26995. false
  26996. ],
  26997. "Adobe-Glyph": [
  26998. "Adobe Glyph List License",
  26999. false
  27000. ],
  27001. "ADSL": [
  27002. "Amazon Digital Services License",
  27003. false
  27004. ],
  27005. "AFL-1.1": [
  27006. "Academic Free License v1.1",
  27007. true
  27008. ],
  27009. "AFL-1.2": [
  27010. "Academic Free License v1.2",
  27011. true
  27012. ],
  27013. "AFL-2.0": [
  27014. "Academic Free License v2.0",
  27015. true
  27016. ],
  27017. "AFL-2.1": [
  27018. "Academic Free License v2.1",
  27019. true
  27020. ],
  27021. "AFL-3.0": [
  27022. "Academic Free License v3.0",
  27023. true
  27024. ],
  27025. "Afmparse": [
  27026. "Afmparse License",
  27027. false
  27028. ],
  27029. "AGPL-1.0": [
  27030. "Affero General Public License v1.0",
  27031. false
  27032. ],
  27033. "AGPL-3.0": [
  27034. "GNU Affero General Public License v3.0",
  27035. true
  27036. ],
  27037. "Aladdin": [
  27038. "Aladdin Free Public License",
  27039. false
  27040. ],
  27041. "AMDPLPA": [
  27042. "AMD's plpa_map.c License",
  27043. false
  27044. ],
  27045. "AML": [
  27046. "Apple MIT License",
  27047. false
  27048. ],
  27049. "AMPAS": [
  27050. "Academy of Motion Picture Arts and Sciences BSD",
  27051. false
  27052. ],
  27053. "ANTLR-PD": [
  27054. "ANTLR Software Rights Notice",
  27055. false
  27056. ],
  27057. "Apache-1.0": [
  27058. "Apache License 1.0",
  27059. false
  27060. ],
  27061. "Apache-1.1": [
  27062. "Apache License 1.1",
  27063. true
  27064. ],
  27065. "Apache-2.0": [
  27066. "Apache License 2.0",
  27067. true
  27068. ],
  27069. "APAFML": [
  27070. "Adobe Postscript AFM License",
  27071. false
  27072. ],
  27073. "APL-1.0": [
  27074. "Adaptive Public License 1.0",
  27075. true
  27076. ],
  27077. "APSL-1.0": [
  27078. "Apple Public Source License 1.0",
  27079. true
  27080. ],
  27081. "APSL-1.1": [
  27082. "Apple Public Source License 1.1",
  27083. true
  27084. ],
  27085. "APSL-1.2": [
  27086. "Apple Public Source License 1.2",
  27087. true
  27088. ],
  27089. "APSL-2.0": [
  27090. "Apple Public Source License 2.0",
  27091. true
  27092. ],
  27093. "Artistic-1.0": [
  27094. "Artistic License 1.0",
  27095. true
  27096. ],
  27097. "Artistic-1.0-cl8": [
  27098. "Artistic License 1.0 w/clause 8",
  27099. true
  27100. ],
  27101. "Artistic-1.0-Perl": [
  27102. "Artistic License 1.0 (Perl)",
  27103. true
  27104. ],
  27105. "Artistic-2.0": [
  27106. "Artistic License 2.0",
  27107. true
  27108. ],
  27109. "Bahyph": [
  27110. "Bahyph License",
  27111. false
  27112. ],
  27113. "Barr": [
  27114. "Barr License",
  27115. false
  27116. ],
  27117. "Beerware": [
  27118. "Beerware License",
  27119. false
  27120. ],
  27121. "BitTorrent-1.0": [
  27122. "BitTorrent Open Source License v1.0",
  27123. false
  27124. ],
  27125. "BitTorrent-1.1": [
  27126. "BitTorrent Open Source License v1.1",
  27127. false
  27128. ],
  27129. "Borceux": [
  27130. "Borceux license",
  27131. false
  27132. ],
  27133. "BSD-2-Clause": [
  27134. "BSD 2-clause \"Simplified\" License",
  27135. true
  27136. ],
  27137. "BSD-2-Clause-FreeBSD": [
  27138. "BSD 2-clause FreeBSD License",
  27139. false
  27140. ],
  27141. "BSD-2-Clause-NetBSD": [
  27142. "BSD 2-clause NetBSD License",
  27143. false
  27144. ],
  27145. "BSD-3-Clause": [
  27146. "BSD 3-clause \"New\" or \"Revised\" License",
  27147. true
  27148. ],
  27149. "BSD-3-Clause-Attribution": [
  27150. "BSD with attribution",
  27151. false
  27152. ],
  27153. "BSD-3-Clause-Clear": [
  27154. "BSD 3-clause Clear License",
  27155. false
  27156. ],
  27157. "BSD-3-Clause-LBNL": [
  27158. "Lawrence Berkeley National Labs BSD variant license",
  27159. false
  27160. ],
  27161. "BSD-3-Clause-No-Nuclear-License": [
  27162. "BSD 3-Clause No Nuclear License",
  27163. false
  27164. ],
  27165. "BSD-3-Clause-No-Nuclear-License-2014": [
  27166. "BSD 3-Clause No Nuclear License 2014",
  27167. false
  27168. ],
  27169. "BSD-3-Clause-No-Nuclear-Warranty": [
  27170. "BSD 3-Clause No Nuclear Warranty",
  27171. false
  27172. ],
  27173. "BSD-4-Clause": [
  27174. "BSD 4-clause \"Original\" or \"Old\" License",
  27175. false
  27176. ],
  27177. "BSD-4-Clause-UC": [
  27178. "BSD-4-Clause (University of California-Specific)",
  27179. false
  27180. ],
  27181. "BSD-Protection": [
  27182. "BSD Protection License",
  27183. false
  27184. ],
  27185. "BSD-Source-Code": [
  27186. "BSD Source Code Attribution",
  27187. false
  27188. ],
  27189. "BSL-1.0": [
  27190. "Boost Software License 1.0",
  27191. true
  27192. ],
  27193. "bzip2-1.0.5": [
  27194. "bzip2 and libbzip2 License v1.0.5",
  27195. false
  27196. ],
  27197. "bzip2-1.0.6": [
  27198. "bzip2 and libbzip2 License v1.0.6",
  27199. false
  27200. ],
  27201. "Caldera": [
  27202. "Caldera License",
  27203. false
  27204. ],
  27205. "CATOSL-1.1": [
  27206. "Computer Associates Trusted Open Source License 1.1",
  27207. true
  27208. ],
  27209. "CC-BY-1.0": [
  27210. "Creative Commons Attribution 1.0",
  27211. false
  27212. ],
  27213. "CC-BY-2.0": [
  27214. "Creative Commons Attribution 2.0",
  27215. false
  27216. ],
  27217. "CC-BY-2.5": [
  27218. "Creative Commons Attribution 2.5",
  27219. false
  27220. ],
  27221. "CC-BY-3.0": [
  27222. "Creative Commons Attribution 3.0",
  27223. false
  27224. ],
  27225. "CC-BY-4.0": [
  27226. "Creative Commons Attribution 4.0",
  27227. false
  27228. ],
  27229. "CC-BY-NC-1.0": [
  27230. "Creative Commons Attribution Non Commercial 1.0",
  27231. false
  27232. ],
  27233. "CC-BY-NC-2.0": [
  27234. "Creative Commons Attribution Non Commercial 2.0",
  27235. false
  27236. ],
  27237. "CC-BY-NC-2.5": [
  27238. "Creative Commons Attribution Non Commercial 2.5",
  27239. false
  27240. ],
  27241. "CC-BY-NC-3.0": [
  27242. "Creative Commons Attribution Non Commercial 3.0",
  27243. false
  27244. ],
  27245. "CC-BY-NC-4.0": [
  27246. "Creative Commons Attribution Non Commercial 4.0",
  27247. false
  27248. ],
  27249. "CC-BY-NC-ND-1.0": [
  27250. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  27251. false
  27252. ],
  27253. "CC-BY-NC-ND-2.0": [
  27254. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  27255. false
  27256. ],
  27257. "CC-BY-NC-ND-2.5": [
  27258. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  27259. false
  27260. ],
  27261. "CC-BY-NC-ND-3.0": [
  27262. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  27263. false
  27264. ],
  27265. "CC-BY-NC-ND-4.0": [
  27266. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  27267. false
  27268. ],
  27269. "CC-BY-NC-SA-1.0": [
  27270. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  27271. false
  27272. ],
  27273. "CC-BY-NC-SA-2.0": [
  27274. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  27275. false
  27276. ],
  27277. "CC-BY-NC-SA-2.5": [
  27278. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  27279. false
  27280. ],
  27281. "CC-BY-NC-SA-3.0": [
  27282. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  27283. false
  27284. ],
  27285. "CC-BY-NC-SA-4.0": [
  27286. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  27287. false
  27288. ],
  27289. "CC-BY-ND-1.0": [
  27290. "Creative Commons Attribution No Derivatives 1.0",
  27291. false
  27292. ],
  27293. "CC-BY-ND-2.0": [
  27294. "Creative Commons Attribution No Derivatives 2.0",
  27295. false
  27296. ],
  27297. "CC-BY-ND-2.5": [
  27298. "Creative Commons Attribution No Derivatives 2.5",
  27299. false
  27300. ],
  27301. "CC-BY-ND-3.0": [
  27302. "Creative Commons Attribution No Derivatives 3.0",
  27303. false
  27304. ],
  27305. "CC-BY-ND-4.0": [
  27306. "Creative Commons Attribution No Derivatives 4.0",
  27307. false
  27308. ],
  27309. "CC-BY-SA-1.0": [
  27310. "Creative Commons Attribution Share Alike 1.0",
  27311. false
  27312. ],
  27313. "CC-BY-SA-2.0": [
  27314. "Creative Commons Attribution Share Alike 2.0",
  27315. false
  27316. ],
  27317. "CC-BY-SA-2.5": [
  27318. "Creative Commons Attribution Share Alike 2.5",
  27319. false
  27320. ],
  27321. "CC-BY-SA-3.0": [
  27322. "Creative Commons Attribution Share Alike 3.0",
  27323. false
  27324. ],
  27325. "CC-BY-SA-4.0": [
  27326. "Creative Commons Attribution Share Alike 4.0",
  27327. false
  27328. ],
  27329. "CC0-1.0": [
  27330. "Creative Commons Zero v1.0 Universal",
  27331. false
  27332. ],
  27333. "CDDL-1.0": [
  27334. "Common Development and Distribution License 1.0",
  27335. true
  27336. ],
  27337. "CDDL-1.1": [
  27338. "Common Development and Distribution License 1.1",
  27339. false
  27340. ],
  27341. "CECILL-1.0": [
  27342. "CeCILL Free Software License Agreement v1.0",
  27343. false
  27344. ],
  27345. "CECILL-1.1": [
  27346. "CeCILL Free Software License Agreement v1.1",
  27347. false
  27348. ],
  27349. "CECILL-2.0": [
  27350. "CeCILL Free Software License Agreement v2.0",
  27351. false
  27352. ],
  27353. "CECILL-2.1": [
  27354. "CeCILL Free Software License Agreement v2.1",
  27355. true
  27356. ],
  27357. "CECILL-B": [
  27358. "CeCILL-B Free Software License Agreement",
  27359. false
  27360. ],
  27361. "CECILL-C": [
  27362. "CeCILL-C Free Software License Agreement",
  27363. false
  27364. ],
  27365. "ClArtistic": [
  27366. "Clarified Artistic License",
  27367. false
  27368. ],
  27369. "CNRI-Jython": [
  27370. "CNRI Jython License",
  27371. false
  27372. ],
  27373. "CNRI-Python": [
  27374. "CNRI Python License",
  27375. true
  27376. ],
  27377. "CNRI-Python-GPL-Compatible": [
  27378. "CNRI Python Open Source GPL Compatible License Agreement",
  27379. false
  27380. ],
  27381. "Condor-1.1": [
  27382. "Condor Public License v1.1",
  27383. false
  27384. ],
  27385. "CPAL-1.0": [
  27386. "Common Public Attribution License 1.0",
  27387. true
  27388. ],
  27389. "CPL-1.0": [
  27390. "Common Public License 1.0",
  27391. true
  27392. ],
  27393. "CPOL-1.02": [
  27394. "Code Project Open License 1.02",
  27395. false
  27396. ],
  27397. "Crossword": [
  27398. "Crossword License",
  27399. false
  27400. ],
  27401. "CrystalStacker": [
  27402. "CrystalStacker License",
  27403. false
  27404. ],
  27405. "CUA-OPL-1.0": [
  27406. "CUA Office Public License v1.0",
  27407. true
  27408. ],
  27409. "Cube": [
  27410. "Cube License",
  27411. false
  27412. ],
  27413. "curl": [
  27414. "curl License",
  27415. false
  27416. ],
  27417. "D-FSL-1.0": [
  27418. "Deutsche Freie Software Lizenz",
  27419. false
  27420. ],
  27421. "diffmark": [
  27422. "diffmark license",
  27423. false
  27424. ],
  27425. "DOC": [
  27426. "DOC License",
  27427. false
  27428. ],
  27429. "Dotseqn": [
  27430. "Dotseqn License",
  27431. false
  27432. ],
  27433. "DSDP": [
  27434. "DSDP License",
  27435. false
  27436. ],
  27437. "dvipdfm": [
  27438. "dvipdfm License",
  27439. false
  27440. ],
  27441. "ECL-1.0": [
  27442. "Educational Community License v1.0",
  27443. true
  27444. ],
  27445. "ECL-2.0": [
  27446. "Educational Community License v2.0",
  27447. true
  27448. ],
  27449. "EFL-1.0": [
  27450. "Eiffel Forum License v1.0",
  27451. true
  27452. ],
  27453. "EFL-2.0": [
  27454. "Eiffel Forum License v2.0",
  27455. true
  27456. ],
  27457. "eGenix": [
  27458. "eGenix.com Public License 1.1.0",
  27459. false
  27460. ],
  27461. "Entessa": [
  27462. "Entessa Public License v1.0",
  27463. true
  27464. ],
  27465. "EPL-1.0": [
  27466. "Eclipse Public License 1.0",
  27467. true
  27468. ],
  27469. "ErlPL-1.1": [
  27470. "Erlang Public License v1.1",
  27471. false
  27472. ],
  27473. "EUDatagrid": [
  27474. "EU DataGrid Software License",
  27475. true
  27476. ],
  27477. "EUPL-1.0": [
  27478. "European Union Public License 1.0",
  27479. false
  27480. ],
  27481. "EUPL-1.1": [
  27482. "European Union Public License 1.1",
  27483. true
  27484. ],
  27485. "Eurosym": [
  27486. "Eurosym License",
  27487. false
  27488. ],
  27489. "Fair": [
  27490. "Fair License",
  27491. true
  27492. ],
  27493. "Frameworx-1.0": [
  27494. "Frameworx Open License 1.0",
  27495. true
  27496. ],
  27497. "FreeImage": [
  27498. "FreeImage Public License v1.0",
  27499. false
  27500. ],
  27501. "FSFAP": [
  27502. "FSF All Permissive License",
  27503. false
  27504. ],
  27505. "FSFUL": [
  27506. "FSF Unlimited License",
  27507. false
  27508. ],
  27509. "FSFULLR": [
  27510. "FSF Unlimited License (with License Retention)",
  27511. false
  27512. ],
  27513. "FTL": [
  27514. "Freetype Project License",
  27515. false
  27516. ],
  27517. "GFDL-1.1": [
  27518. "GNU Free Documentation License v1.1",
  27519. false
  27520. ],
  27521. "GFDL-1.2": [
  27522. "GNU Free Documentation License v1.2",
  27523. false
  27524. ],
  27525. "GFDL-1.3": [
  27526. "GNU Free Documentation License v1.3",
  27527. false
  27528. ],
  27529. "Giftware": [
  27530. "Giftware License",
  27531. false
  27532. ],
  27533. "GL2PS": [
  27534. "GL2PS License",
  27535. false
  27536. ],
  27537. "Glide": [
  27538. "3dfx Glide License",
  27539. false
  27540. ],
  27541. "Glulxe": [
  27542. "Glulxe License",
  27543. false
  27544. ],
  27545. "gnuplot": [
  27546. "gnuplot License",
  27547. false
  27548. ],
  27549. "GPL-1.0": [
  27550. "GNU General Public License v1.0 only",
  27551. false
  27552. ],
  27553. "GPL-2.0": [
  27554. "GNU General Public License v2.0 only",
  27555. true
  27556. ],
  27557. "GPL-3.0": [
  27558. "GNU General Public License v3.0 only",
  27559. true
  27560. ],
  27561. "gSOAP-1.3b": [
  27562. "gSOAP Public License v1.3b",
  27563. false
  27564. ],
  27565. "HaskellReport": [
  27566. "Haskell Language Report License",
  27567. false
  27568. ],
  27569. "HPND": [
  27570. "Historic Permission Notice and Disclaimer",
  27571. true
  27572. ],
  27573. "IBM-pibs": [
  27574. "IBM PowerPC Initialization and Boot Software",
  27575. false
  27576. ],
  27577. "ICU": [
  27578. "ICU License",
  27579. false
  27580. ],
  27581. "IJG": [
  27582. "Independent JPEG Group License",
  27583. false
  27584. ],
  27585. "ImageMagick": [
  27586. "ImageMagick License",
  27587. false
  27588. ],
  27589. "iMatix": [
  27590. "iMatix Standard Function Library Agreement",
  27591. false
  27592. ],
  27593. "Imlib2": [
  27594. "Imlib2 License",
  27595. false
  27596. ],
  27597. "Info-ZIP": [
  27598. "Info-ZIP License",
  27599. false
  27600. ],
  27601. "Intel": [
  27602. "Intel Open Source License",
  27603. true
  27604. ],
  27605. "Intel-ACPI": [
  27606. "Intel ACPI Software License Agreement",
  27607. false
  27608. ],
  27609. "Interbase-1.0": [
  27610. "Interbase Public License v1.0",
  27611. false
  27612. ],
  27613. "IPA": [
  27614. "IPA Font License",
  27615. true
  27616. ],
  27617. "IPL-1.0": [
  27618. "IBM Public License v1.0",
  27619. true
  27620. ],
  27621. "ISC": [
  27622. "ISC License",
  27623. true
  27624. ],
  27625. "JasPer-2.0": [
  27626. "JasPer License",
  27627. false
  27628. ],
  27629. "JSON": [
  27630. "JSON License",
  27631. false
  27632. ],
  27633. "LAL-1.2": [
  27634. "Licence Art Libre 1.2",
  27635. false
  27636. ],
  27637. "LAL-1.3": [
  27638. "Licence Art Libre 1.3",
  27639. false
  27640. ],
  27641. "Latex2e": [
  27642. "Latex2e License",
  27643. false
  27644. ],
  27645. "Leptonica": [
  27646. "Leptonica License",
  27647. false
  27648. ],
  27649. "LGPL-2.0": [
  27650. "GNU Library General Public License v2 only",
  27651. true
  27652. ],
  27653. "LGPL-2.1": [
  27654. "GNU Lesser General Public License v2.1 only",
  27655. true
  27656. ],
  27657. "LGPL-3.0": [
  27658. "GNU Lesser General Public License v3.0 only",
  27659. true
  27660. ],
  27661. "LGPLLR": [
  27662. "Lesser General Public License For Linguistic Resources",
  27663. false
  27664. ],
  27665. "Libpng": [
  27666. "libpng License",
  27667. false
  27668. ],
  27669. "libtiff": [
  27670. "libtiff License",
  27671. false
  27672. ],
  27673. "LiLiQ-P-1.1": [
  27674. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  27675. true
  27676. ],
  27677. "LiLiQ-R-1.1": [
  27678. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  27679. true
  27680. ],
  27681. "LiLiQ-Rplus-1.1": [
  27682. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  27683. true
  27684. ],
  27685. "LPL-1.0": [
  27686. "Lucent Public License Version 1.0",
  27687. true
  27688. ],
  27689. "LPL-1.02": [
  27690. "Lucent Public License v1.02",
  27691. true
  27692. ],
  27693. "LPPL-1.0": [
  27694. "LaTeX Project Public License v1.0",
  27695. false
  27696. ],
  27697. "LPPL-1.1": [
  27698. "LaTeX Project Public License v1.1",
  27699. false
  27700. ],
  27701. "LPPL-1.2": [
  27702. "LaTeX Project Public License v1.2",
  27703. false
  27704. ],
  27705. "LPPL-1.3a": [
  27706. "LaTeX Project Public License v1.3a",
  27707. false
  27708. ],
  27709. "LPPL-1.3c": [
  27710. "LaTeX Project Public License v1.3c",
  27711. true
  27712. ],
  27713. "MakeIndex": [
  27714. "MakeIndex License",
  27715. false
  27716. ],
  27717. "MirOS": [
  27718. "MirOS Licence",
  27719. true
  27720. ],
  27721. "MIT": [
  27722. "MIT License",
  27723. true
  27724. ],
  27725. "MIT-advertising": [
  27726. "Enlightenment License (e16)",
  27727. false
  27728. ],
  27729. "MIT-CMU": [
  27730. "CMU License",
  27731. false
  27732. ],
  27733. "MIT-enna": [
  27734. "enna License",
  27735. false
  27736. ],
  27737. "MIT-feh": [
  27738. "feh License",
  27739. false
  27740. ],
  27741. "MITNFA": [
  27742. "MIT +no-false-attribs license",
  27743. false
  27744. ],
  27745. "Motosoto": [
  27746. "Motosoto License",
  27747. true
  27748. ],
  27749. "mpich2": [
  27750. "mpich2 License",
  27751. false
  27752. ],
  27753. "MPL-1.0": [
  27754. "Mozilla Public License 1.0",
  27755. true
  27756. ],
  27757. "MPL-1.1": [
  27758. "Mozilla Public License 1.1",
  27759. true
  27760. ],
  27761. "MPL-2.0": [
  27762. "Mozilla Public License 2.0",
  27763. true
  27764. ],
  27765. "MPL-2.0-no-copyleft-exception": [
  27766. "Mozilla Public License 2.0 (no copyleft exception)",
  27767. true
  27768. ],
  27769. "MS-PL": [
  27770. "Microsoft Public License",
  27771. true
  27772. ],
  27773. "MS-RL": [
  27774. "Microsoft Reciprocal License",
  27775. true
  27776. ],
  27777. "MTLL": [
  27778. "Matrix Template Library License",
  27779. false
  27780. ],
  27781. "Multics": [
  27782. "Multics License",
  27783. true
  27784. ],
  27785. "Mup": [
  27786. "Mup License",
  27787. false
  27788. ],
  27789. "NASA-1.3": [
  27790. "NASA Open Source Agreement 1.3",
  27791. true
  27792. ],
  27793. "Naumen": [
  27794. "Naumen Public License",
  27795. true
  27796. ],
  27797. "NBPL-1.0": [
  27798. "Net Boolean Public License v1",
  27799. false
  27800. ],
  27801. "NCSA": [
  27802. "University of Illinois/NCSA Open Source License",
  27803. true
  27804. ],
  27805. "NetCDF": [
  27806. "NetCDF license",
  27807. false
  27808. ],
  27809. "Newsletr": [
  27810. "Newsletr License",
  27811. false
  27812. ],
  27813. "NGPL": [
  27814. "Nethack General Public License",
  27815. true
  27816. ],
  27817. "NLOD-1.0": [
  27818. "Norwegian Licence for Open Government Data",
  27819. false
  27820. ],
  27821. "NLPL": [
  27822. "No Limit Public License",
  27823. false
  27824. ],
  27825. "Nokia": [
  27826. "Nokia Open Source License",
  27827. true
  27828. ],
  27829. "NOSL": [
  27830. "Netizen Open Source License",
  27831. false
  27832. ],
  27833. "Noweb": [
  27834. "Noweb License",
  27835. false
  27836. ],
  27837. "NPL-1.0": [
  27838. "Netscape Public License v1.0",
  27839. false
  27840. ],
  27841. "NPL-1.1": [
  27842. "Netscape Public License v1.1",
  27843. false
  27844. ],
  27845. "NPOSL-3.0": [
  27846. "Non-Profit Open Software License 3.0",
  27847. true
  27848. ],
  27849. "NRL": [
  27850. "NRL License",
  27851. false
  27852. ],
  27853. "NTP": [
  27854. "NTP License",
  27855. true
  27856. ],
  27857. "Nunit": [
  27858. "Nunit License",
  27859. false
  27860. ],
  27861. "OCCT-PL": [
  27862. "Open CASCADE Technology Public License",
  27863. false
  27864. ],
  27865. "OCLC-2.0": [
  27866. "OCLC Research Public License 2.0",
  27867. true
  27868. ],
  27869. "ODbL-1.0": [
  27870. "ODC Open Database License v1.0",
  27871. false
  27872. ],
  27873. "OFL-1.0": [
  27874. "SIL Open Font License 1.0",
  27875. false
  27876. ],
  27877. "OFL-1.1": [
  27878. "SIL Open Font License 1.1",
  27879. true
  27880. ],
  27881. "OGTSL": [
  27882. "Open Group Test Suite License",
  27883. true
  27884. ],
  27885. "OLDAP-1.1": [
  27886. "Open LDAP Public License v1.1",
  27887. false
  27888. ],
  27889. "OLDAP-1.2": [
  27890. "Open LDAP Public License v1.2",
  27891. false
  27892. ],
  27893. "OLDAP-1.3": [
  27894. "Open LDAP Public License v1.3",
  27895. false
  27896. ],
  27897. "OLDAP-1.4": [
  27898. "Open LDAP Public License v1.4",
  27899. false
  27900. ],
  27901. "OLDAP-2.0": [
  27902. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  27903. false
  27904. ],
  27905. "OLDAP-2.0.1": [
  27906. "Open LDAP Public License v2.0.1",
  27907. false
  27908. ],
  27909. "OLDAP-2.1": [
  27910. "Open LDAP Public License v2.1",
  27911. false
  27912. ],
  27913. "OLDAP-2.2": [
  27914. "Open LDAP Public License v2.2",
  27915. false
  27916. ],
  27917. "OLDAP-2.2.1": [
  27918. "Open LDAP Public License v2.2.1",
  27919. false
  27920. ],
  27921. "OLDAP-2.2.2": [
  27922. "Open LDAP Public License 2.2.2",
  27923. false
  27924. ],
  27925. "OLDAP-2.3": [
  27926. "Open LDAP Public License v2.3",
  27927. false
  27928. ],
  27929. "OLDAP-2.4": [
  27930. "Open LDAP Public License v2.4",
  27931. false
  27932. ],
  27933. "OLDAP-2.5": [
  27934. "Open LDAP Public License v2.5",
  27935. false
  27936. ],
  27937. "OLDAP-2.6": [
  27938. "Open LDAP Public License v2.6",
  27939. false
  27940. ],
  27941. "OLDAP-2.7": [
  27942. "Open LDAP Public License v2.7",
  27943. false
  27944. ],
  27945. "OLDAP-2.8": [
  27946. "Open LDAP Public License v2.8",
  27947. false
  27948. ],
  27949. "OML": [
  27950. "Open Market License",
  27951. false
  27952. ],
  27953. "OpenSSL": [
  27954. "OpenSSL License",
  27955. false
  27956. ],
  27957. "OPL-1.0": [
  27958. "Open Public License v1.0",
  27959. false
  27960. ],
  27961. "OSET-PL-2.1": [
  27962. "OSET Public License version 2.1",
  27963. true
  27964. ],
  27965. "OSL-1.0": [
  27966. "Open Software License 1.0",
  27967. true
  27968. ],
  27969. "OSL-1.1": [
  27970. "Open Software License 1.1",
  27971. false
  27972. ],
  27973. "OSL-2.0": [
  27974. "Open Software License 2.0",
  27975. true
  27976. ],
  27977. "OSL-2.1": [
  27978. "Open Software License 2.1",
  27979. true
  27980. ],
  27981. "OSL-3.0": [
  27982. "Open Software License 3.0",
  27983. true
  27984. ],
  27985. "PDDL-1.0": [
  27986. "ODC Public Domain Dedication & License 1.0",
  27987. false
  27988. ],
  27989. "PHP-3.0": [
  27990. "PHP License v3.0",
  27991. true
  27992. ],
  27993. "PHP-3.01": [
  27994. "PHP License v3.01",
  27995. false
  27996. ],
  27997. "Plexus": [
  27998. "Plexus Classworlds License",
  27999. false
  28000. ],
  28001. "PostgreSQL": [
  28002. "PostgreSQL License",
  28003. true
  28004. ],
  28005. "psfrag": [
  28006. "psfrag License",
  28007. false
  28008. ],
  28009. "psutils": [
  28010. "psutils License",
  28011. false
  28012. ],
  28013. "Python-2.0": [
  28014. "Python License 2.0",
  28015. true
  28016. ],
  28017. "Qhull": [
  28018. "Qhull License",
  28019. false
  28020. ],
  28021. "QPL-1.0": [
  28022. "Q Public License 1.0",
  28023. true
  28024. ],
  28025. "Rdisc": [
  28026. "Rdisc License",
  28027. false
  28028. ],
  28029. "RHeCos-1.1": [
  28030. "Red Hat eCos Public License v1.1",
  28031. false
  28032. ],
  28033. "RPL-1.1": [
  28034. "Reciprocal Public License 1.1",
  28035. true
  28036. ],
  28037. "RPL-1.5": [
  28038. "Reciprocal Public License 1.5",
  28039. true
  28040. ],
  28041. "RPSL-1.0": [
  28042. "RealNetworks Public Source License v1.0",
  28043. true
  28044. ],
  28045. "RSA-MD": [
  28046. "RSA Message-Digest License",
  28047. false
  28048. ],
  28049. "RSCPL": [
  28050. "Ricoh Source Code Public License",
  28051. true
  28052. ],
  28053. "Ruby": [
  28054. "Ruby License",
  28055. false
  28056. ],
  28057. "SAX-PD": [
  28058. "Sax Public Domain Notice",
  28059. false
  28060. ],
  28061. "Saxpath": [
  28062. "Saxpath License",
  28063. false
  28064. ],
  28065. "SCEA": [
  28066. "SCEA Shared Source License",
  28067. false
  28068. ],
  28069. "Sendmail": [
  28070. "Sendmail License",
  28071. false
  28072. ],
  28073. "SGI-B-1.0": [
  28074. "SGI Free Software License B v1.0",
  28075. false
  28076. ],
  28077. "SGI-B-1.1": [
  28078. "SGI Free Software License B v1.1",
  28079. false
  28080. ],
  28081. "SGI-B-2.0": [
  28082. "SGI Free Software License B v2.0",
  28083. false
  28084. ],
  28085. "SimPL-2.0": [
  28086. "Simple Public License 2.0",
  28087. true
  28088. ],
  28089. "SISSL": [
  28090. "Sun Industry Standards Source License v1.1",
  28091. true
  28092. ],
  28093. "SISSL-1.2": [
  28094. "Sun Industry Standards Source License v1.2",
  28095. false
  28096. ],
  28097. "Sleepycat": [
  28098. "Sleepycat License",
  28099. true
  28100. ],
  28101. "SMLNJ": [
  28102. "Standard ML of New Jersey License",
  28103. false
  28104. ],
  28105. "SMPPL": [
  28106. "Secure Messaging Protocol Public License",
  28107. false
  28108. ],
  28109. "SNIA": [
  28110. "SNIA Public License 1.1",
  28111. false
  28112. ],
  28113. "Spencer-86": [
  28114. "Spencer License 86",
  28115. false
  28116. ],
  28117. "Spencer-94": [
  28118. "Spencer License 94",
  28119. false
  28120. ],
  28121. "Spencer-99": [
  28122. "Spencer License 99",
  28123. false
  28124. ],
  28125. "SPL-1.0": [
  28126. "Sun Public License v1.0",
  28127. true
  28128. ],
  28129. "SugarCRM-1.1.3": [
  28130. "SugarCRM Public License v1.1.3",
  28131. false
  28132. ],
  28133. "SWL": [
  28134. "Scheme Widget Library (SWL) Software License Agreement",
  28135. false
  28136. ],
  28137. "TCL": [
  28138. "TCL/TK License",
  28139. false
  28140. ],
  28141. "TMate": [
  28142. "TMate Open Source License",
  28143. false
  28144. ],
  28145. "TORQUE-1.1": [
  28146. "TORQUE v2.5+ Software License v1.1",
  28147. false
  28148. ],
  28149. "TOSL": [
  28150. "Trusster Open Source License",
  28151. false
  28152. ],
  28153. "Unicode-TOU": [
  28154. "Unicode Terms of Use",
  28155. false
  28156. ],
  28157. "Unlicense": [
  28158. "The Unlicense",
  28159. false
  28160. ],
  28161. "UPL-1.0": [
  28162. "Universal Permissive License v1.0",
  28163. true
  28164. ],
  28165. "Vim": [
  28166. "Vim License",
  28167. false
  28168. ],
  28169. "VOSTROM": [
  28170. "VOSTROM Public License for Open Source",
  28171. false
  28172. ],
  28173. "VSL-1.0": [
  28174. "Vovida Software License v1.0",
  28175. true
  28176. ],
  28177. "W3C": [
  28178. "W3C Software Notice and License (2002-12-31)",
  28179. true
  28180. ],
  28181. "W3C-19980720": [
  28182. "W3C Software Notice and License (1998-07-20)",
  28183. false
  28184. ],
  28185. "Watcom-1.0": [
  28186. "Sybase Open Watcom Public License 1.0",
  28187. true
  28188. ],
  28189. "Wsuipa": [
  28190. "Wsuipa License",
  28191. false
  28192. ],
  28193. "WTFPL": [
  28194. "Do What The F*ck You Want To Public License",
  28195. false
  28196. ],
  28197. "X11": [
  28198. "X11 License",
  28199. false
  28200. ],
  28201. "Xerox": [
  28202. "Xerox License",
  28203. false
  28204. ],
  28205. "XFree86-1.1": [
  28206. "XFree86 License 1.1",
  28207. false
  28208. ],
  28209. "xinetd": [
  28210. "xinetd License",
  28211. false
  28212. ],
  28213. "Xnet": [
  28214. "X.Net License",
  28215. true
  28216. ],
  28217. "xpp": [
  28218. "XPP License",
  28219. false
  28220. ],
  28221. "XSkat": [
  28222. "XSkat License",
  28223. false
  28224. ],
  28225. "YPL-1.0": [
  28226. "Yahoo! Public License v1.0",
  28227. false
  28228. ],
  28229. "YPL-1.1": [
  28230. "Yahoo! Public License v1.1",
  28231. false
  28232. ],
  28233. "Zed": [
  28234. "Zed License",
  28235. false
  28236. ],
  28237. "Zend-2.0": [
  28238. "Zend License v2.0",
  28239. false
  28240. ],
  28241. "Zimbra-1.3": [
  28242. "Zimbra Public License v1.3",
  28243. false
  28244. ],
  28245. "Zimbra-1.4": [
  28246. "Zimbra Public License v1.4",
  28247. false
  28248. ],
  28249. "Zlib": [
  28250. "zlib License",
  28251. true
  28252. ],
  28253. "zlib-acknowledgement": [
  28254. "zlib/libpng License with Acknowledgement",
  28255. false
  28256. ],
  28257. "ZPL-1.1": [
  28258. "Zope Public License 1.1",
  28259. false
  28260. ],
  28261. "ZPL-2.0": [
  28262. "Zope Public License 2.0",
  28263. true
  28264. ],
  28265. "ZPL-2.1": [
  28266. "Zope Public License 2.1",
  28267. false
  28268. ]
  28269. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  28270. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  28271. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  28272. ����������������� ��`.rdata����� ���
  28273. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  28274. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  28275. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  28276. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  28277. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  28278. <security>
  28279. <requestedPrivileges>
  28280. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  28281. </requestedPrivileges>
  28282. </security>
  28283. </trustInfo>
  28284. <dependency>
  28285. <dependentAssembly>
  28286. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  28287. </dependentAssembly>
  28288. </dependency>
  28289. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  28290. namespace Symfony\Component\Console;
  28291. use Symfony\Component\Console\Descriptor\TextDescriptor;
  28292. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  28293. use Symfony\Component\Console\Exception\ExceptionInterface;
  28294. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  28295. use Symfony\Component\Console\Helper\ProcessHelper;
  28296. use Symfony\Component\Console\Helper\QuestionHelper;
  28297. use Symfony\Component\Console\Input\InputInterface;
  28298. use Symfony\Component\Console\Input\ArgvInput;
  28299. use Symfony\Component\Console\Input\ArrayInput;
  28300. use Symfony\Component\Console\Input\InputDefinition;
  28301. use Symfony\Component\Console\Input\InputOption;
  28302. use Symfony\Component\Console\Input\InputArgument;
  28303. use Symfony\Component\Console\Input\InputAwareInterface;
  28304. use Symfony\Component\Console\Output\BufferedOutput;
  28305. use Symfony\Component\Console\Output\OutputInterface;
  28306. use Symfony\Component\Console\Output\ConsoleOutput;
  28307. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  28308. use Symfony\Component\Console\Command\Command;
  28309. use Symfony\Component\Console\Command\HelpCommand;
  28310. use Symfony\Component\Console\Command\ListCommand;
  28311. use Symfony\Component\Console\Helper\HelperSet;
  28312. use Symfony\Component\Console\Helper\FormatterHelper;
  28313. use Symfony\Component\Console\Helper\DialogHelper;
  28314. use Symfony\Component\Console\Helper\ProgressHelper;
  28315. use Symfony\Component\Console\Helper\TableHelper;
  28316. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  28317. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  28318. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  28319. use Symfony\Component\Console\Exception\CommandNotFoundException;
  28320. use Symfony\Component\Console\Exception\LogicException;
  28321. use Symfony\Component\Debug\Exception\FatalThrowableError;
  28322. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  28323. class Application
  28324. {
  28325. private $commands = array();
  28326. private $wantHelps = false;
  28327. private $runningCommand;
  28328. private $name;
  28329. private $version;
  28330. private $catchExceptions = true;
  28331. private $autoExit = true;
  28332. private $definition;
  28333. private $helperSet;
  28334. private $dispatcher;
  28335. private $terminalDimensions;
  28336. private $defaultCommand;
  28337. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  28338. {
  28339. $this->name = $name;
  28340. $this->version = $version;
  28341. $this->defaultCommand = 'list';
  28342. $this->helperSet = $this->getDefaultHelperSet();
  28343. $this->definition = $this->getDefaultInputDefinition();
  28344. foreach ($this->getDefaultCommands() as $command) {
  28345. $this->add($command);
  28346. }
  28347. }
  28348. public function setDispatcher(EventDispatcherInterface $dispatcher)
  28349. {
  28350. $this->dispatcher = $dispatcher;
  28351. }
  28352. public function run(InputInterface $input = null, OutputInterface $output = null)
  28353. {
  28354. if (null === $input) {
  28355. $input = new ArgvInput();
  28356. }
  28357. if (null === $output) {
  28358. $output = new ConsoleOutput();
  28359. }
  28360. $this->configureIO($input, $output);
  28361. try {
  28362. $exitCode = $this->doRun($input, $output);
  28363. } catch (\Exception $e) {
  28364. if (!$this->catchExceptions) {
  28365. throw $e;
  28366. }
  28367. if ($output instanceof ConsoleOutputInterface) {
  28368. $this->renderException($e, $output->getErrorOutput());
  28369. } else {
  28370. $this->renderException($e, $output);
  28371. }
  28372. $exitCode = $e->getCode();
  28373. if (is_numeric($exitCode)) {
  28374. $exitCode = (int) $exitCode;
  28375. if (0 === $exitCode) {
  28376. $exitCode = 1;
  28377. }
  28378. } else {
  28379. $exitCode = 1;
  28380. }
  28381. }
  28382. if ($this->autoExit) {
  28383. if ($exitCode > 255) {
  28384. $exitCode = 255;
  28385. }
  28386. exit($exitCode);
  28387. }
  28388. return $exitCode;
  28389. }
  28390. public function doRun(InputInterface $input, OutputInterface $output)
  28391. {
  28392. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  28393. $output->writeln($this->getLongVersion());
  28394. return 0;
  28395. }
  28396. $name = $this->getCommandName($input);
  28397. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  28398. if (!$name) {
  28399. $name = 'help';
  28400. $input = new ArrayInput(array('command' => 'help'));
  28401. } else {
  28402. $this->wantHelps = true;
  28403. }
  28404. }
  28405. if (!$name) {
  28406. $name = $this->defaultCommand;
  28407. $input = new ArrayInput(array('command' => $this->defaultCommand));
  28408. }
  28409. $command = $this->find($name);
  28410. $this->runningCommand = $command;
  28411. $exitCode = $this->doRunCommand($command, $input, $output);
  28412. $this->runningCommand = null;
  28413. return $exitCode;
  28414. }
  28415. public function setHelperSet(HelperSet $helperSet)
  28416. {
  28417. $this->helperSet = $helperSet;
  28418. }
  28419. public function getHelperSet()
  28420. {
  28421. return $this->helperSet;
  28422. }
  28423. public function setDefinition(InputDefinition $definition)
  28424. {
  28425. $this->definition = $definition;
  28426. }
  28427. public function getDefinition()
  28428. {
  28429. return $this->definition;
  28430. }
  28431. public function getHelp()
  28432. {
  28433. return $this->getLongVersion();
  28434. }
  28435. public function setCatchExceptions($boolean)
  28436. {
  28437. $this->catchExceptions = (bool) $boolean;
  28438. }
  28439. public function setAutoExit($boolean)
  28440. {
  28441. $this->autoExit = (bool) $boolean;
  28442. }
  28443. public function getName()
  28444. {
  28445. return $this->name;
  28446. }
  28447. public function setName($name)
  28448. {
  28449. $this->name = $name;
  28450. }
  28451. public function getVersion()
  28452. {
  28453. return $this->version;
  28454. }
  28455. public function setVersion($version)
  28456. {
  28457. $this->version = $version;
  28458. }
  28459. public function getLongVersion()
  28460. {
  28461. if ('UNKNOWN' !== $this->getName()) {
  28462. if ('UNKNOWN' !== $this->getVersion()) {
  28463. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  28464. }
  28465. return sprintf('<info>%s</info>', $this->getName());
  28466. }
  28467. return '<info>Console Tool</info>';
  28468. }
  28469. public function register($name)
  28470. {
  28471. return $this->add(new Command($name));
  28472. }
  28473. public function addCommands(array $commands)
  28474. {
  28475. foreach ($commands as $command) {
  28476. $this->add($command);
  28477. }
  28478. }
  28479. public function add(Command $command)
  28480. {
  28481. $command->setApplication($this);
  28482. if (!$command->isEnabled()) {
  28483. $command->setApplication(null);
  28484. return;
  28485. }
  28486. if (null === $command->getDefinition()) {
  28487. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  28488. }
  28489. $this->commands[$command->getName()] = $command;
  28490. foreach ($command->getAliases() as $alias) {
  28491. $this->commands[$alias] = $command;
  28492. }
  28493. return $command;
  28494. }
  28495. public function get($name)
  28496. {
  28497. if (!isset($this->commands[$name])) {
  28498. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  28499. }
  28500. $command = $this->commands[$name];
  28501. if ($this->wantHelps) {
  28502. $this->wantHelps = false;
  28503. $helpCommand = $this->get('help');
  28504. $helpCommand->setCommand($command);
  28505. return $helpCommand;
  28506. }
  28507. return $command;
  28508. }
  28509. public function has($name)
  28510. {
  28511. return isset($this->commands[$name]);
  28512. }
  28513. public function getNamespaces()
  28514. {
  28515. $namespaces = array();
  28516. foreach ($this->all() as $command) {
  28517. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  28518. foreach ($command->getAliases() as $alias) {
  28519. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  28520. }
  28521. }
  28522. return array_values(array_unique(array_filter($namespaces)));
  28523. }
  28524. public function findNamespace($namespace)
  28525. {
  28526. $allNamespaces = $this->getNamespaces();
  28527. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  28528. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  28529. if (empty($namespaces)) {
  28530. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  28531. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  28532. if (1 == count($alternatives)) {
  28533. $message .= "\n\nDid you mean this?\n ";
  28534. } else {
  28535. $message .= "\n\nDid you mean one of these?\n ";
  28536. }
  28537. $message .= implode("\n ", $alternatives);
  28538. }
  28539. throw new CommandNotFoundException($message, $alternatives);
  28540. }
  28541. $exact = in_array($namespace, $namespaces, true);
  28542. if (count($namespaces) > 1 && !$exact) {
  28543. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  28544. }
  28545. return $exact ? $namespace : reset($namespaces);
  28546. }
  28547. public function find($name)
  28548. {
  28549. $allCommands = array_keys($this->commands);
  28550. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  28551. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  28552. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  28553. if (false !== $pos = strrpos($name, ':')) {
  28554. $this->findNamespace(substr($name, 0, $pos));
  28555. }
  28556. $message = sprintf('Command "%s" is not defined.', $name);
  28557. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  28558. if (1 == count($alternatives)) {
  28559. $message .= "\n\nDid you mean this?\n ";
  28560. } else {
  28561. $message .= "\n\nDid you mean one of these?\n ";
  28562. }
  28563. $message .= implode("\n ", $alternatives);
  28564. }
  28565. throw new CommandNotFoundException($message, $alternatives);
  28566. }
  28567. if (count($commands) > 1) {
  28568. $commandList = $this->commands;
  28569. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
  28570. $commandName = $commandList[$nameOrAlias]->getName();
  28571. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  28572. });
  28573. }
  28574. $exact = in_array($name, $commands, true);
  28575. if (count($commands) > 1 && !$exact) {
  28576. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  28577. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  28578. }
  28579. return $this->get($exact ? $name : reset($commands));
  28580. }
  28581. public function all($namespace = null)
  28582. {
  28583. if (null === $namespace) {
  28584. return $this->commands;
  28585. }
  28586. $commands = array();
  28587. foreach ($this->commands as $name => $command) {
  28588. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  28589. $commands[$name] = $command;
  28590. }
  28591. }
  28592. return $commands;
  28593. }
  28594. public static function getAbbreviations($names)
  28595. {
  28596. $abbrevs = array();
  28597. foreach ($names as $name) {
  28598. for ($len = strlen($name); $len > 0; --$len) {
  28599. $abbrev = substr($name, 0, $len);
  28600. $abbrevs[$abbrev][] = $name;
  28601. }
  28602. }
  28603. return $abbrevs;
  28604. }
  28605. public function asText($namespace = null, $raw = false)
  28606. {
  28607. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  28608. $descriptor = new TextDescriptor();
  28609. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  28610. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  28611. return $output->fetch();
  28612. }
  28613. public function asXml($namespace = null, $asDom = false)
  28614. {
  28615. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  28616. $descriptor = new XmlDescriptor();
  28617. if ($asDom) {
  28618. return $descriptor->getApplicationDocument($this, $namespace);
  28619. }
  28620. $output = new BufferedOutput();
  28621. $descriptor->describe($output, $this, array('namespace' => $namespace));
  28622. return $output->fetch();
  28623. }
  28624. public function renderException($e, $output)
  28625. {
  28626. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  28627. do {
  28628. $title = sprintf(' [%s] ', get_class($e));
  28629. $len = $this->stringWidth($title);
  28630. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  28631. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  28632. $width = 1 << 31;
  28633. }
  28634. $formatter = $output->getFormatter();
  28635. $lines = array();
  28636. foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
  28637. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  28638. $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4;
  28639. $lines[] = array($line, $lineLength);
  28640. $len = max($lineLength, $len);
  28641. }
  28642. }
  28643. $messages = array();
  28644. $messages[] = $emptyLine = $formatter->format(sprintf('<error>%s</error>', str_repeat(' ', $len)));
  28645. $messages[] = $formatter->format(sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title)))));
  28646. foreach ($lines as $line) {
  28647. $messages[] = $formatter->format(sprintf('<error> %s %s</error>', $line[0], str_repeat(' ', $len - $line[1])));
  28648. }
  28649. $messages[] = $emptyLine;
  28650. $messages[] = '';
  28651. $output->writeln($messages, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET);
  28652. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  28653. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  28654. $trace = $e->getTrace();
  28655. array_unshift($trace, array(
  28656. 'function' => '',
  28657. 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a',
  28658. 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a',
  28659. 'args' => array(),
  28660. ));
  28661. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  28662. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  28663. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  28664. $function = $trace[$i]['function'];
  28665. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  28666. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  28667. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  28668. }
  28669. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  28670. }
  28671. } while ($e = $e->getPrevious());
  28672. if (null !== $this->runningCommand) {
  28673. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  28674. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  28675. }
  28676. }
  28677. protected function getTerminalWidth()
  28678. {
  28679. $dimensions = $this->getTerminalDimensions();
  28680. return $dimensions[0];
  28681. }
  28682. protected function getTerminalHeight()
  28683. {
  28684. $dimensions = $this->getTerminalDimensions();
  28685. return $dimensions[1];
  28686. }
  28687. public function getTerminalDimensions()
  28688. {
  28689. if ($this->terminalDimensions) {
  28690. return $this->terminalDimensions;
  28691. }
  28692. if ('\\' === DIRECTORY_SEPARATOR) {
  28693. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  28694. return array((int) $matches[1], (int) $matches[2]);
  28695. }
  28696. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  28697. return array((int) $matches[1], (int) $matches[2]);
  28698. }
  28699. }
  28700. if ($sttyString = $this->getSttyColumns()) {
  28701. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  28702. return array((int) $matches[2], (int) $matches[1]);
  28703. }
  28704. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  28705. return array((int) $matches[2], (int) $matches[1]);
  28706. }
  28707. }
  28708. return array(null, null);
  28709. }
  28710. public function setTerminalDimensions($width, $height)
  28711. {
  28712. $this->terminalDimensions = array($width, $height);
  28713. return $this;
  28714. }
  28715. protected function configureIO(InputInterface $input, OutputInterface $output)
  28716. {
  28717. if (true === $input->hasParameterOption(array('--ansi'))) {
  28718. $output->setDecorated(true);
  28719. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  28720. $output->setDecorated(false);
  28721. }
  28722. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  28723. $input->setInteractive(false);
  28724. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  28725. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  28726. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  28727. $input->setInteractive(false);
  28728. }
  28729. }
  28730. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  28731. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  28732. $input->setInteractive(false);
  28733. } else {
  28734. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
  28735. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  28736. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
  28737. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  28738. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  28739. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  28740. }
  28741. }
  28742. }
  28743. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  28744. {
  28745. foreach ($command->getHelperSet() as $helper) {
  28746. if ($helper instanceof InputAwareInterface) {
  28747. $helper->setInput($input);
  28748. }
  28749. }
  28750. if (null === $this->dispatcher) {
  28751. try {
  28752. return $command->run($input, $output);
  28753. } catch (\Exception $e) {
  28754. throw $e;
  28755. } catch (\Throwable $e) {
  28756. throw new FatalThrowableError($e);
  28757. }
  28758. }
  28759. try {
  28760. $command->mergeApplicationDefinition();
  28761. $input->bind($command->getDefinition());
  28762. } catch (ExceptionInterface $e) {
  28763. }
  28764. $event = new ConsoleCommandEvent($command, $input, $output);
  28765. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  28766. if ($event->commandShouldRun()) {
  28767. try {
  28768. $e = null;
  28769. $exitCode = $command->run($input, $output);
  28770. } catch (\Exception $x) {
  28771. $e = $x;
  28772. } catch (\Throwable $x) {
  28773. $e = new FatalThrowableError($x);
  28774. }
  28775. if (null !== $e) {
  28776. $event = new ConsoleExceptionEvent($command, $input, $output, $e, $e->getCode());
  28777. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  28778. if ($e !== $event->getException()) {
  28779. $x = $e = $event->getException();
  28780. }
  28781. $event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode());
  28782. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  28783. throw $x;
  28784. }
  28785. } else {
  28786. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  28787. }
  28788. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  28789. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  28790. return $event->getExitCode();
  28791. }
  28792. protected function getCommandName(InputInterface $input)
  28793. {
  28794. return $input->getFirstArgument();
  28795. }
  28796. protected function getDefaultInputDefinition()
  28797. {
  28798. return new InputDefinition(array(
  28799. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  28800. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  28801. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  28802. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  28803. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  28804. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  28805. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  28806. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  28807. ));
  28808. }
  28809. protected function getDefaultCommands()
  28810. {
  28811. return array(new HelpCommand(), new ListCommand());
  28812. }
  28813. protected function getDefaultHelperSet()
  28814. {
  28815. return new HelperSet(array(
  28816. new FormatterHelper(),
  28817. new DialogHelper(false),
  28818. new ProgressHelper(false),
  28819. new TableHelper(false),
  28820. new DebugFormatterHelper(),
  28821. new ProcessHelper(),
  28822. new QuestionHelper(),
  28823. ));
  28824. }
  28825. private function getSttyColumns()
  28826. {
  28827. if (!function_exists('proc_open')) {
  28828. return;
  28829. }
  28830. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  28831. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  28832. if (is_resource($process)) {
  28833. $info = stream_get_contents($pipes[1]);
  28834. fclose($pipes[1]);
  28835. fclose($pipes[2]);
  28836. proc_close($process);
  28837. return $info;
  28838. }
  28839. }
  28840. private function getConsoleMode()
  28841. {
  28842. if (!function_exists('proc_open')) {
  28843. return;
  28844. }
  28845. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  28846. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  28847. if (is_resource($process)) {
  28848. $info = stream_get_contents($pipes[1]);
  28849. fclose($pipes[1]);
  28850. fclose($pipes[2]);
  28851. proc_close($process);
  28852. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  28853. return $matches[2].'x'.$matches[1];
  28854. }
  28855. }
  28856. }
  28857. private function getAbbreviationSuggestions($abbrevs)
  28858. {
  28859. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  28860. }
  28861. public function extractNamespace($name, $limit = null)
  28862. {
  28863. $parts = explode(':', $name);
  28864. array_pop($parts);
  28865. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  28866. }
  28867. private function findAlternatives($name, $collection)
  28868. {
  28869. $threshold = 1e3;
  28870. $alternatives = array();
  28871. $collectionParts = array();
  28872. foreach ($collection as $item) {
  28873. $collectionParts[$item] = explode(':', $item);
  28874. }
  28875. foreach (explode(':', $name) as $i => $subname) {
  28876. foreach ($collectionParts as $collectionName => $parts) {
  28877. $exists = isset($alternatives[$collectionName]);
  28878. if (!isset($parts[$i]) && $exists) {
  28879. $alternatives[$collectionName] += $threshold;
  28880. continue;
  28881. } elseif (!isset($parts[$i])) {
  28882. continue;
  28883. }
  28884. $lev = levenshtein($subname, $parts[$i]);
  28885. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  28886. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  28887. } elseif ($exists) {
  28888. $alternatives[$collectionName] += $threshold;
  28889. }
  28890. }
  28891. }
  28892. foreach ($collection as $item) {
  28893. $lev = levenshtein($name, $item);
  28894. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  28895. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  28896. }
  28897. }
  28898. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  28899. asort($alternatives);
  28900. return array_keys($alternatives);
  28901. }
  28902. public function setDefaultCommand($commandName)
  28903. {
  28904. $this->defaultCommand = $commandName;
  28905. }
  28906. private function stringWidth($string)
  28907. {
  28908. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  28909. return strlen($string);
  28910. }
  28911. return mb_strwidth($string, $encoding);
  28912. }
  28913. private function splitStringByWidth($string, $width)
  28914. {
  28915. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  28916. return str_split($string, $width);
  28917. }
  28918. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  28919. $lines = array();
  28920. $line = '';
  28921. foreach (preg_split('//u', $utf8String) as $char) {
  28922. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  28923. $line .= $char;
  28924. continue;
  28925. }
  28926. $lines[] = str_pad($line, $width);
  28927. $line = $char;
  28928. }
  28929. if ('' !== $line) {
  28930. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  28931. }
  28932. mb_convert_variables($encoding, 'utf8', $lines);
  28933. return $lines;
  28934. }
  28935. private function extractAllNamespaces($name)
  28936. {
  28937. $parts = explode(':', $name, -1);
  28938. $namespaces = array();
  28939. foreach ($parts as $part) {
  28940. if (count($namespaces)) {
  28941. $namespaces[] = end($namespaces).':'.$part;
  28942. } else {
  28943. $namespaces[] = $part;
  28944. }
  28945. }
  28946. return $namespaces;
  28947. }
  28948. }
  28949. <?php
  28950. namespace Symfony\Component\Console\Command;
  28951. use Symfony\Component\Console\Descriptor\TextDescriptor;
  28952. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  28953. use Symfony\Component\Console\Exception\ExceptionInterface;
  28954. use Symfony\Component\Console\Input\InputDefinition;
  28955. use Symfony\Component\Console\Input\InputOption;
  28956. use Symfony\Component\Console\Input\InputArgument;
  28957. use Symfony\Component\Console\Input\InputInterface;
  28958. use Symfony\Component\Console\Output\BufferedOutput;
  28959. use Symfony\Component\Console\Output\OutputInterface;
  28960. use Symfony\Component\Console\Application;
  28961. use Symfony\Component\Console\Helper\HelperSet;
  28962. use Symfony\Component\Console\Exception\InvalidArgumentException;
  28963. use Symfony\Component\Console\Exception\LogicException;
  28964. class Command
  28965. {
  28966. private $application;
  28967. private $name;
  28968. private $processTitle;
  28969. private $aliases = array();
  28970. private $definition;
  28971. private $help;
  28972. private $description;
  28973. private $ignoreValidationErrors = false;
  28974. private $applicationDefinitionMerged = false;
  28975. private $applicationDefinitionMergedWithArgs = false;
  28976. private $code;
  28977. private $synopsis = array();
  28978. private $usages = array();
  28979. private $helperSet;
  28980. public function __construct($name = null)
  28981. {
  28982. $this->definition = new InputDefinition();
  28983. if (null !== $name) {
  28984. $this->setName($name);
  28985. }
  28986. $this->configure();
  28987. if (!$this->name) {
  28988. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  28989. }
  28990. }
  28991. public function ignoreValidationErrors()
  28992. {
  28993. $this->ignoreValidationErrors = true;
  28994. }
  28995. public function setApplication(Application $application = null)
  28996. {
  28997. $this->application = $application;
  28998. if ($application) {
  28999. $this->setHelperSet($application->getHelperSet());
  29000. } else {
  29001. $this->helperSet = null;
  29002. }
  29003. }
  29004. public function setHelperSet(HelperSet $helperSet)
  29005. {
  29006. $this->helperSet = $helperSet;
  29007. }
  29008. public function getHelperSet()
  29009. {
  29010. return $this->helperSet;
  29011. }
  29012. public function getApplication()
  29013. {
  29014. return $this->application;
  29015. }
  29016. public function isEnabled()
  29017. {
  29018. return true;
  29019. }
  29020. protected function configure()
  29021. {
  29022. }
  29023. protected function execute(InputInterface $input, OutputInterface $output)
  29024. {
  29025. throw new LogicException('You must override the execute() method in the concrete command class.');
  29026. }
  29027. protected function interact(InputInterface $input, OutputInterface $output)
  29028. {
  29029. }
  29030. protected function initialize(InputInterface $input, OutputInterface $output)
  29031. {
  29032. }
  29033. public function run(InputInterface $input, OutputInterface $output)
  29034. {
  29035. $this->getSynopsis(true);
  29036. $this->getSynopsis(false);
  29037. $this->mergeApplicationDefinition();
  29038. try {
  29039. $input->bind($this->definition);
  29040. } catch (ExceptionInterface $e) {
  29041. if (!$this->ignoreValidationErrors) {
  29042. throw $e;
  29043. }
  29044. }
  29045. $this->initialize($input, $output);
  29046. if (null !== $this->processTitle) {
  29047. if (function_exists('cli_set_process_title')) {
  29048. cli_set_process_title($this->processTitle);
  29049. } elseif (function_exists('setproctitle')) {
  29050. setproctitle($this->processTitle);
  29051. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  29052. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  29053. }
  29054. }
  29055. if ($input->isInteractive()) {
  29056. $this->interact($input, $output);
  29057. }
  29058. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  29059. $input->setArgument('command', $this->getName());
  29060. }
  29061. $input->validate();
  29062. if ($this->code) {
  29063. $statusCode = call_user_func($this->code, $input, $output);
  29064. } else {
  29065. $statusCode = $this->execute($input, $output);
  29066. }
  29067. return is_numeric($statusCode) ? (int) $statusCode : 0;
  29068. }
  29069. public function setCode($code)
  29070. {
  29071. if (!is_callable($code)) {
  29072. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  29073. }
  29074. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  29075. $r = new \ReflectionFunction($code);
  29076. if (null === $r->getClosureThis()) {
  29077. $code = \Closure::bind($code, $this);
  29078. }
  29079. }
  29080. $this->code = $code;
  29081. return $this;
  29082. }
  29083. public function mergeApplicationDefinition($mergeArgs = true)
  29084. {
  29085. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  29086. return;
  29087. }
  29088. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  29089. if ($mergeArgs) {
  29090. $currentArguments = $this->definition->getArguments();
  29091. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  29092. $this->definition->addArguments($currentArguments);
  29093. }
  29094. $this->applicationDefinitionMerged = true;
  29095. if ($mergeArgs) {
  29096. $this->applicationDefinitionMergedWithArgs = true;
  29097. }
  29098. }
  29099. public function setDefinition($definition)
  29100. {
  29101. if ($definition instanceof InputDefinition) {
  29102. $this->definition = $definition;
  29103. } else {
  29104. $this->definition->setDefinition($definition);
  29105. }
  29106. $this->applicationDefinitionMerged = false;
  29107. return $this;
  29108. }
  29109. public function getDefinition()
  29110. {
  29111. return $this->definition;
  29112. }
  29113. public function getNativeDefinition()
  29114. {
  29115. return $this->getDefinition();
  29116. }
  29117. public function addArgument($name, $mode = null, $description = '', $default = null)
  29118. {
  29119. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  29120. return $this;
  29121. }
  29122. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  29123. {
  29124. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  29125. return $this;
  29126. }
  29127. public function setName($name)
  29128. {
  29129. $this->validateName($name);
  29130. $this->name = $name;
  29131. return $this;
  29132. }
  29133. public function setProcessTitle($title)
  29134. {
  29135. $this->processTitle = $title;
  29136. return $this;
  29137. }
  29138. public function getName()
  29139. {
  29140. return $this->name;
  29141. }
  29142. public function setDescription($description)
  29143. {
  29144. $this->description = $description;
  29145. return $this;
  29146. }
  29147. public function getDescription()
  29148. {
  29149. return $this->description;
  29150. }
  29151. public function setHelp($help)
  29152. {
  29153. $this->help = $help;
  29154. return $this;
  29155. }
  29156. public function getHelp()
  29157. {
  29158. return $this->help;
  29159. }
  29160. public function getProcessedHelp()
  29161. {
  29162. $name = $this->name;
  29163. $placeholders = array(
  29164. '%command.name%',
  29165. '%command.full_name%',
  29166. );
  29167. $replacements = array(
  29168. $name,
  29169. $_SERVER['PHP_SELF'].' '.$name,
  29170. );
  29171. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  29172. }
  29173. public function setAliases($aliases)
  29174. {
  29175. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  29176. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  29177. }
  29178. foreach ($aliases as $alias) {
  29179. $this->validateName($alias);
  29180. }
  29181. $this->aliases = $aliases;
  29182. return $this;
  29183. }
  29184. public function getAliases()
  29185. {
  29186. return $this->aliases;
  29187. }
  29188. public function getSynopsis($short = false)
  29189. {
  29190. $key = $short ? 'short' : 'long';
  29191. if (!isset($this->synopsis[$key])) {
  29192. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  29193. }
  29194. return $this->synopsis[$key];
  29195. }
  29196. public function addUsage($usage)
  29197. {
  29198. if (0 !== strpos($usage, $this->name)) {
  29199. $usage = sprintf('%s %s', $this->name, $usage);
  29200. }
  29201. $this->usages[] = $usage;
  29202. return $this;
  29203. }
  29204. public function getUsages()
  29205. {
  29206. return $this->usages;
  29207. }
  29208. public function getHelper($name)
  29209. {
  29210. if (null === $this->helperSet) {
  29211. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  29212. }
  29213. return $this->helperSet->get($name);
  29214. }
  29215. public function asText()
  29216. {
  29217. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  29218. $descriptor = new TextDescriptor();
  29219. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  29220. $descriptor->describe($output, $this, array('raw_output' => true));
  29221. return $output->fetch();
  29222. }
  29223. public function asXml($asDom = false)
  29224. {
  29225. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  29226. $descriptor = new XmlDescriptor();
  29227. if ($asDom) {
  29228. return $descriptor->getCommandDocument($this);
  29229. }
  29230. $output = new BufferedOutput();
  29231. $descriptor->describe($output, $this);
  29232. return $output->fetch();
  29233. }
  29234. private function validateName($name)
  29235. {
  29236. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  29237. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  29238. }
  29239. }
  29240. }
  29241. <?php
  29242. namespace Symfony\Component\Console\Command;
  29243. use Symfony\Component\Console\Helper\DescriptorHelper;
  29244. use Symfony\Component\Console\Input\InputArgument;
  29245. use Symfony\Component\Console\Input\InputOption;
  29246. use Symfony\Component\Console\Input\InputInterface;
  29247. use Symfony\Component\Console\Output\OutputInterface;
  29248. class HelpCommand extends Command
  29249. {
  29250. private $command;
  29251. protected function configure()
  29252. {
  29253. $this->ignoreValidationErrors();
  29254. $this
  29255. ->setName('help')
  29256. ->setDefinition(array(
  29257. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  29258. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  29259. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  29260. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  29261. ))
  29262. ->setDescription('Displays help for a command')
  29263. ->setHelp(<<<'EOF'
  29264. The <info>%command.name%</info> command displays help for a given command:
  29265. <info>php %command.full_name% list</info>
  29266. You can also output the help in other formats by using the <comment>--format</comment> option:
  29267. <info>php %command.full_name% --format=xml list</info>
  29268. To display the list of available commands, please use the <info>list</info> command.
  29269. EOF
  29270. )
  29271. ;
  29272. }
  29273. public function setCommand(Command $command)
  29274. {
  29275. $this->command = $command;
  29276. }
  29277. protected function execute(InputInterface $input, OutputInterface $output)
  29278. {
  29279. if (null === $this->command) {
  29280. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  29281. }
  29282. if ($input->getOption('xml')) {
  29283. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  29284. $input->setOption('format', 'xml');
  29285. }
  29286. $helper = new DescriptorHelper();
  29287. $helper->describe($output, $this->command, array(
  29288. 'format' => $input->getOption('format'),
  29289. 'raw_text' => $input->getOption('raw'),
  29290. ));
  29291. $this->command = null;
  29292. }
  29293. }
  29294. <?php
  29295. namespace Symfony\Component\Console\Command;
  29296. use Symfony\Component\Console\Helper\DescriptorHelper;
  29297. use Symfony\Component\Console\Input\InputArgument;
  29298. use Symfony\Component\Console\Input\InputOption;
  29299. use Symfony\Component\Console\Input\InputInterface;
  29300. use Symfony\Component\Console\Output\OutputInterface;
  29301. use Symfony\Component\Console\Input\InputDefinition;
  29302. class ListCommand extends Command
  29303. {
  29304. protected function configure()
  29305. {
  29306. $this
  29307. ->setName('list')
  29308. ->setDefinition($this->createDefinition())
  29309. ->setDescription('Lists commands')
  29310. ->setHelp(<<<'EOF'
  29311. The <info>%command.name%</info> command lists all commands:
  29312. <info>php %command.full_name%</info>
  29313. You can also display the commands for a specific namespace:
  29314. <info>php %command.full_name% test</info>
  29315. You can also output the information in other formats by using the <comment>--format</comment> option:
  29316. <info>php %command.full_name% --format=xml</info>
  29317. It's also possible to get raw list of commands (useful for embedding command runner):
  29318. <info>php %command.full_name% --raw</info>
  29319. EOF
  29320. )
  29321. ;
  29322. }
  29323. public function getNativeDefinition()
  29324. {
  29325. return $this->createDefinition();
  29326. }
  29327. protected function execute(InputInterface $input, OutputInterface $output)
  29328. {
  29329. if ($input->getOption('xml')) {
  29330. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  29331. $input->setOption('format', 'xml');
  29332. }
  29333. $helper = new DescriptorHelper();
  29334. $helper->describe($output, $this->getApplication(), array(
  29335. 'format' => $input->getOption('format'),
  29336. 'raw_text' => $input->getOption('raw'),
  29337. 'namespace' => $input->getArgument('namespace'),
  29338. ));
  29339. }
  29340. private function createDefinition()
  29341. {
  29342. return new InputDefinition(array(
  29343. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  29344. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  29345. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  29346. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  29347. ));
  29348. }
  29349. }
  29350. <?php
  29351. namespace Symfony\Component\Console;
  29352. final class ConsoleEvents
  29353. {
  29354. const COMMAND = 'console.command';
  29355. const TERMINATE = 'console.terminate';
  29356. const EXCEPTION = 'console.exception';
  29357. }
  29358. <?php
  29359. namespace Symfony\Component\Console\Descriptor;
  29360. use Symfony\Component\Console\Application;
  29361. use Symfony\Component\Console\Command\Command;
  29362. use Symfony\Component\Console\Exception\CommandNotFoundException;
  29363. class ApplicationDescription
  29364. {
  29365. const GLOBAL_NAMESPACE = '_global';
  29366. private $application;
  29367. private $namespace;
  29368. private $namespaces;
  29369. private $commands;
  29370. private $aliases;
  29371. public function __construct(Application $application, $namespace = null)
  29372. {
  29373. $this->application = $application;
  29374. $this->namespace = $namespace;
  29375. }
  29376. public function getNamespaces()
  29377. {
  29378. if (null === $this->namespaces) {
  29379. $this->inspectApplication();
  29380. }
  29381. return $this->namespaces;
  29382. }
  29383. public function getCommands()
  29384. {
  29385. if (null === $this->commands) {
  29386. $this->inspectApplication();
  29387. }
  29388. return $this->commands;
  29389. }
  29390. public function getCommand($name)
  29391. {
  29392. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  29393. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  29394. }
  29395. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  29396. }
  29397. private function inspectApplication()
  29398. {
  29399. $this->commands = array();
  29400. $this->namespaces = array();
  29401. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  29402. foreach ($this->sortCommands($all) as $namespace => $commands) {
  29403. $names = array();
  29404. foreach ($commands as $name => $command) {
  29405. if (!$command->getName()) {
  29406. continue;
  29407. }
  29408. if ($command->getName() === $name) {
  29409. $this->commands[$name] = $command;
  29410. } else {
  29411. $this->aliases[$name] = $command;
  29412. }
  29413. $names[] = $name;
  29414. }
  29415. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  29416. }
  29417. }
  29418. private function sortCommands(array $commands)
  29419. {
  29420. $namespacedCommands = array();
  29421. $globalCommands = array();
  29422. foreach ($commands as $name => $command) {
  29423. $key = $this->application->extractNamespace($name, 1);
  29424. if (!$key) {
  29425. $globalCommands['_global'][$name] = $command;
  29426. } else {
  29427. $namespacedCommands[$key][$name] = $command;
  29428. }
  29429. }
  29430. ksort($namespacedCommands);
  29431. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  29432. foreach ($namespacedCommands as &$commandsSet) {
  29433. ksort($commandsSet);
  29434. }
  29435. unset($commandsSet);
  29436. return $namespacedCommands;
  29437. }
  29438. }
  29439. <?php
  29440. namespace Symfony\Component\Console\Descriptor;
  29441. use Symfony\Component\Console\Application;
  29442. use Symfony\Component\Console\Command\Command;
  29443. use Symfony\Component\Console\Input\InputArgument;
  29444. use Symfony\Component\Console\Input\InputDefinition;
  29445. use Symfony\Component\Console\Input\InputOption;
  29446. use Symfony\Component\Console\Output\OutputInterface;
  29447. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29448. abstract class Descriptor implements DescriptorInterface
  29449. {
  29450. private $output;
  29451. public function describe(OutputInterface $output, $object, array $options = array())
  29452. {
  29453. $this->output = $output;
  29454. switch (true) {
  29455. case $object instanceof InputArgument:
  29456. $this->describeInputArgument($object, $options);
  29457. break;
  29458. case $object instanceof InputOption:
  29459. $this->describeInputOption($object, $options);
  29460. break;
  29461. case $object instanceof InputDefinition:
  29462. $this->describeInputDefinition($object, $options);
  29463. break;
  29464. case $object instanceof Command:
  29465. $this->describeCommand($object, $options);
  29466. break;
  29467. case $object instanceof Application:
  29468. $this->describeApplication($object, $options);
  29469. break;
  29470. default:
  29471. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  29472. }
  29473. }
  29474. protected function write($content, $decorated = false)
  29475. {
  29476. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  29477. }
  29478. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  29479. abstract protected function describeInputOption(InputOption $option, array $options = array());
  29480. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  29481. abstract protected function describeCommand(Command $command, array $options = array());
  29482. abstract protected function describeApplication(Application $application, array $options = array());
  29483. }
  29484. <?php
  29485. namespace Symfony\Component\Console\Descriptor;
  29486. use Symfony\Component\Console\Output\OutputInterface;
  29487. interface DescriptorInterface
  29488. {
  29489. public function describe(OutputInterface $output, $object, array $options = array());
  29490. }
  29491. <?php
  29492. namespace Symfony\Component\Console\Descriptor;
  29493. use Symfony\Component\Console\Application;
  29494. use Symfony\Component\Console\Command\Command;
  29495. use Symfony\Component\Console\Input\InputArgument;
  29496. use Symfony\Component\Console\Input\InputDefinition;
  29497. use Symfony\Component\Console\Input\InputOption;
  29498. class JsonDescriptor extends Descriptor
  29499. {
  29500. protected function describeInputArgument(InputArgument $argument, array $options = array())
  29501. {
  29502. $this->writeData($this->getInputArgumentData($argument), $options);
  29503. }
  29504. protected function describeInputOption(InputOption $option, array $options = array())
  29505. {
  29506. $this->writeData($this->getInputOptionData($option), $options);
  29507. }
  29508. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  29509. {
  29510. $this->writeData($this->getInputDefinitionData($definition), $options);
  29511. }
  29512. protected function describeCommand(Command $command, array $options = array())
  29513. {
  29514. $this->writeData($this->getCommandData($command), $options);
  29515. }
  29516. protected function describeApplication(Application $application, array $options = array())
  29517. {
  29518. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  29519. $description = new ApplicationDescription($application, $describedNamespace);
  29520. $commands = array();
  29521. foreach ($description->getCommands() as $command) {
  29522. $commands[] = $this->getCommandData($command);
  29523. }
  29524. $data = $describedNamespace
  29525. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  29526. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  29527. $this->writeData($data, $options);
  29528. }
  29529. private function writeData(array $data, array $options)
  29530. {
  29531. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  29532. }
  29533. private function getInputArgumentData(InputArgument $argument)
  29534. {
  29535. return array(
  29536. 'name' => $argument->getName(),
  29537. 'is_required' => $argument->isRequired(),
  29538. 'is_array' => $argument->isArray(),
  29539. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  29540. 'default' => $argument->getDefault(),
  29541. );
  29542. }
  29543. private function getInputOptionData(InputOption $option)
  29544. {
  29545. return array(
  29546. 'name' => '--'.$option->getName(),
  29547. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  29548. 'accept_value' => $option->acceptValue(),
  29549. 'is_value_required' => $option->isValueRequired(),
  29550. 'is_multiple' => $option->isArray(),
  29551. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  29552. 'default' => $option->getDefault(),
  29553. );
  29554. }
  29555. private function getInputDefinitionData(InputDefinition $definition)
  29556. {
  29557. $inputArguments = array();
  29558. foreach ($definition->getArguments() as $name => $argument) {
  29559. $inputArguments[$name] = $this->getInputArgumentData($argument);
  29560. }
  29561. $inputOptions = array();
  29562. foreach ($definition->getOptions() as $name => $option) {
  29563. $inputOptions[$name] = $this->getInputOptionData($option);
  29564. }
  29565. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  29566. }
  29567. private function getCommandData(Command $command)
  29568. {
  29569. $command->getSynopsis();
  29570. $command->mergeApplicationDefinition(false);
  29571. return array(
  29572. 'name' => $command->getName(),
  29573. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  29574. 'description' => $command->getDescription(),
  29575. 'help' => $command->getProcessedHelp(),
  29576. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  29577. );
  29578. }
  29579. }
  29580. <?php
  29581. namespace Symfony\Component\Console\Descriptor;
  29582. use Symfony\Component\Console\Application;
  29583. use Symfony\Component\Console\Command\Command;
  29584. use Symfony\Component\Console\Input\InputArgument;
  29585. use Symfony\Component\Console\Input\InputDefinition;
  29586. use Symfony\Component\Console\Input\InputOption;
  29587. class MarkdownDescriptor extends Descriptor
  29588. {
  29589. protected function describeInputArgument(InputArgument $argument, array $options = array())
  29590. {
  29591. $this->write(
  29592. '**'.$argument->getName().':**'."\n\n"
  29593. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  29594. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  29595. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  29596. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  29597. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  29598. );
  29599. }
  29600. protected function describeInputOption(InputOption $option, array $options = array())
  29601. {
  29602. $this->write(
  29603. '**'.$option->getName().':**'."\n\n"
  29604. .'* Name: `--'.$option->getName().'`'."\n"
  29605. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  29606. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  29607. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  29608. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  29609. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  29610. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  29611. );
  29612. }
  29613. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  29614. {
  29615. if ($showArguments = count($definition->getArguments()) > 0) {
  29616. $this->write('### Arguments:');
  29617. foreach ($definition->getArguments() as $argument) {
  29618. $this->write("\n\n");
  29619. $this->write($this->describeInputArgument($argument));
  29620. }
  29621. }
  29622. if (count($definition->getOptions()) > 0) {
  29623. if ($showArguments) {
  29624. $this->write("\n\n");
  29625. }
  29626. $this->write('### Options:');
  29627. foreach ($definition->getOptions() as $option) {
  29628. $this->write("\n\n");
  29629. $this->write($this->describeInputOption($option));
  29630. }
  29631. }
  29632. }
  29633. protected function describeCommand(Command $command, array $options = array())
  29634. {
  29635. $command->getSynopsis();
  29636. $command->mergeApplicationDefinition(false);
  29637. $this->write(
  29638. $command->getName()."\n"
  29639. .str_repeat('-', strlen($command->getName()))."\n\n"
  29640. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  29641. .'* Usage:'."\n\n"
  29642. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  29643. return $carry.' * `'.$usage.'`'."\n";
  29644. })
  29645. );
  29646. if ($help = $command->getProcessedHelp()) {
  29647. $this->write("\n");
  29648. $this->write($help);
  29649. }
  29650. if ($command->getNativeDefinition()) {
  29651. $this->write("\n\n");
  29652. $this->describeInputDefinition($command->getNativeDefinition());
  29653. }
  29654. }
  29655. protected function describeApplication(Application $application, array $options = array())
  29656. {
  29657. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  29658. $description = new ApplicationDescription($application, $describedNamespace);
  29659. $this->write($application->getName()."\n".str_repeat('=', strlen($application->getName())));
  29660. foreach ($description->getNamespaces() as $namespace) {
  29661. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  29662. $this->write("\n\n");
  29663. $this->write('**'.$namespace['id'].':**');
  29664. }
  29665. $this->write("\n\n");
  29666. $this->write(implode("\n", array_map(function ($commandName) {
  29667. return '* '.$commandName;
  29668. }, $namespace['commands'])));
  29669. }
  29670. foreach ($description->getCommands() as $command) {
  29671. $this->write("\n\n");
  29672. $this->write($this->describeCommand($command));
  29673. }
  29674. }
  29675. }
  29676. <?php
  29677. namespace Symfony\Component\Console\Descriptor;
  29678. use Symfony\Component\Console\Application;
  29679. use Symfony\Component\Console\Command\Command;
  29680. use Symfony\Component\Console\Input\InputArgument;
  29681. use Symfony\Component\Console\Input\InputDefinition;
  29682. use Symfony\Component\Console\Input\InputOption;
  29683. class TextDescriptor extends Descriptor
  29684. {
  29685. protected function describeInputArgument(InputArgument $argument, array $options = array())
  29686. {
  29687. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  29688. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  29689. } else {
  29690. $default = '';
  29691. }
  29692. $totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName());
  29693. $spacingWidth = $totalWidth - strlen($argument->getName());
  29694. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  29695. $argument->getName(),
  29696. str_repeat(' ', $spacingWidth),
  29697. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  29698. $default
  29699. ), $options);
  29700. }
  29701. protected function describeInputOption(InputOption $option, array $options = array())
  29702. {
  29703. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  29704. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  29705. } else {
  29706. $default = '';
  29707. }
  29708. $value = '';
  29709. if ($option->acceptValue()) {
  29710. $value = '='.strtoupper($option->getName());
  29711. if ($option->isValueOptional()) {
  29712. $value = '['.$value.']';
  29713. }
  29714. }
  29715. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  29716. $synopsis = sprintf('%s%s',
  29717. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  29718. sprintf('--%s%s', $option->getName(), $value)
  29719. );
  29720. $spacingWidth = $totalWidth - strlen($synopsis);
  29721. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  29722. $synopsis,
  29723. str_repeat(' ', $spacingWidth),
  29724. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  29725. $default,
  29726. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  29727. ), $options);
  29728. }
  29729. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  29730. {
  29731. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  29732. foreach ($definition->getArguments() as $argument) {
  29733. $totalWidth = max($totalWidth, strlen($argument->getName()));
  29734. }
  29735. if ($definition->getArguments()) {
  29736. $this->writeText('<comment>Arguments:</comment>', $options);
  29737. $this->writeText("\n");
  29738. foreach ($definition->getArguments() as $argument) {
  29739. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  29740. $this->writeText("\n");
  29741. }
  29742. }
  29743. if ($definition->getArguments() && $definition->getOptions()) {
  29744. $this->writeText("\n");
  29745. }
  29746. if ($definition->getOptions()) {
  29747. $laterOptions = array();
  29748. $this->writeText('<comment>Options:</comment>', $options);
  29749. foreach ($definition->getOptions() as $option) {
  29750. if (strlen($option->getShortcut()) > 1) {
  29751. $laterOptions[] = $option;
  29752. continue;
  29753. }
  29754. $this->writeText("\n");
  29755. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  29756. }
  29757. foreach ($laterOptions as $option) {
  29758. $this->writeText("\n");
  29759. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  29760. }
  29761. }
  29762. }
  29763. protected function describeCommand(Command $command, array $options = array())
  29764. {
  29765. $command->getSynopsis(true);
  29766. $command->getSynopsis(false);
  29767. $command->mergeApplicationDefinition(false);
  29768. $this->writeText('<comment>Usage:</comment>', $options);
  29769. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  29770. $this->writeText("\n");
  29771. $this->writeText(' '.$usage, $options);
  29772. }
  29773. $this->writeText("\n");
  29774. $definition = $command->getNativeDefinition();
  29775. if ($definition->getOptions() || $definition->getArguments()) {
  29776. $this->writeText("\n");
  29777. $this->describeInputDefinition($definition, $options);
  29778. $this->writeText("\n");
  29779. }
  29780. if ($help = $command->getProcessedHelp()) {
  29781. $this->writeText("\n");
  29782. $this->writeText('<comment>Help:</comment>', $options);
  29783. $this->writeText("\n");
  29784. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  29785. $this->writeText("\n");
  29786. }
  29787. }
  29788. protected function describeApplication(Application $application, array $options = array())
  29789. {
  29790. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  29791. $description = new ApplicationDescription($application, $describedNamespace);
  29792. if (isset($options['raw_text']) && $options['raw_text']) {
  29793. $width = $this->getColumnWidth($description->getCommands());
  29794. foreach ($description->getCommands() as $command) {
  29795. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  29796. $this->writeText("\n");
  29797. }
  29798. } else {
  29799. if ('' != $help = $application->getHelp()) {
  29800. $this->writeText("$help\n\n", $options);
  29801. }
  29802. $this->writeText("<comment>Usage:</comment>\n", $options);
  29803. $this->writeText(" command [options] [arguments]\n\n", $options);
  29804. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  29805. $this->writeText("\n");
  29806. $this->writeText("\n");
  29807. $width = $this->getColumnWidth($description->getCommands());
  29808. if ($describedNamespace) {
  29809. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  29810. } else {
  29811. $this->writeText('<comment>Available commands:</comment>', $options);
  29812. }
  29813. foreach ($description->getNamespaces() as $namespace) {
  29814. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  29815. $this->writeText("\n");
  29816. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  29817. }
  29818. foreach ($namespace['commands'] as $name) {
  29819. $this->writeText("\n");
  29820. $spacingWidth = $width - strlen($name);
  29821. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  29822. }
  29823. }
  29824. $this->writeText("\n");
  29825. }
  29826. }
  29827. private function writeText($content, array $options = array())
  29828. {
  29829. $this->write(
  29830. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  29831. isset($options['raw_output']) ? !$options['raw_output'] : true
  29832. );
  29833. }
  29834. private function formatDefaultValue($default)
  29835. {
  29836. if (PHP_VERSION_ID < 50400) {
  29837. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  29838. }
  29839. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  29840. }
  29841. private function getColumnWidth(array $commands)
  29842. {
  29843. $widths = array();
  29844. foreach ($commands as $command) {
  29845. $widths[] = strlen($command->getName());
  29846. foreach ($command->getAliases() as $alias) {
  29847. $widths[] = strlen($alias);
  29848. }
  29849. }
  29850. return max($widths) + 2;
  29851. }
  29852. private function calculateTotalWidthForOptions($options)
  29853. {
  29854. $totalWidth = 0;
  29855. foreach ($options as $option) {
  29856. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + strlen($option->getName());
  29857. if ($option->acceptValue()) {
  29858. $valueLength = 1 + strlen($option->getName());
  29859. $valueLength += $option->isValueOptional() ? 2 : 0;
  29860. $nameLength += $valueLength;
  29861. }
  29862. $totalWidth = max($totalWidth, $nameLength);
  29863. }
  29864. return $totalWidth;
  29865. }
  29866. }
  29867. <?php
  29868. namespace Symfony\Component\Console\Descriptor;
  29869. use Symfony\Component\Console\Application;
  29870. use Symfony\Component\Console\Command\Command;
  29871. use Symfony\Component\Console\Input\InputArgument;
  29872. use Symfony\Component\Console\Input\InputDefinition;
  29873. use Symfony\Component\Console\Input\InputOption;
  29874. class XmlDescriptor extends Descriptor
  29875. {
  29876. public function getInputDefinitionDocument(InputDefinition $definition)
  29877. {
  29878. $dom = new \DOMDocument('1.0', 'UTF-8');
  29879. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  29880. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  29881. foreach ($definition->getArguments() as $argument) {
  29882. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  29883. }
  29884. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  29885. foreach ($definition->getOptions() as $option) {
  29886. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  29887. }
  29888. return $dom;
  29889. }
  29890. public function getCommandDocument(Command $command)
  29891. {
  29892. $dom = new \DOMDocument('1.0', 'UTF-8');
  29893. $dom->appendChild($commandXML = $dom->createElement('command'));
  29894. $command->getSynopsis();
  29895. $command->mergeApplicationDefinition(false);
  29896. $commandXML->setAttribute('id', $command->getName());
  29897. $commandXML->setAttribute('name', $command->getName());
  29898. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  29899. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  29900. $usagesXML->appendChild($dom->createElement('usage', $usage));
  29901. }
  29902. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  29903. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  29904. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  29905. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  29906. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  29907. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  29908. return $dom;
  29909. }
  29910. public function getApplicationDocument(Application $application, $namespace = null)
  29911. {
  29912. $dom = new \DOMDocument('1.0', 'UTF-8');
  29913. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  29914. if ($application->getName() !== 'UNKNOWN') {
  29915. $rootXml->setAttribute('name', $application->getName());
  29916. if ($application->getVersion() !== 'UNKNOWN') {
  29917. $rootXml->setAttribute('version', $application->getVersion());
  29918. }
  29919. }
  29920. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  29921. $description = new ApplicationDescription($application, $namespace);
  29922. if ($namespace) {
  29923. $commandsXML->setAttribute('namespace', $namespace);
  29924. }
  29925. foreach ($description->getCommands() as $command) {
  29926. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  29927. }
  29928. if (!$namespace) {
  29929. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  29930. foreach ($description->getNamespaces() as $namespaceDescription) {
  29931. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  29932. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  29933. foreach ($namespaceDescription['commands'] as $name) {
  29934. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  29935. $commandXML->appendChild($dom->createTextNode($name));
  29936. }
  29937. }
  29938. }
  29939. return $dom;
  29940. }
  29941. protected function describeInputArgument(InputArgument $argument, array $options = array())
  29942. {
  29943. $this->writeDocument($this->getInputArgumentDocument($argument));
  29944. }
  29945. protected function describeInputOption(InputOption $option, array $options = array())
  29946. {
  29947. $this->writeDocument($this->getInputOptionDocument($option));
  29948. }
  29949. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  29950. {
  29951. $this->writeDocument($this->getInputDefinitionDocument($definition));
  29952. }
  29953. protected function describeCommand(Command $command, array $options = array())
  29954. {
  29955. $this->writeDocument($this->getCommandDocument($command));
  29956. }
  29957. protected function describeApplication(Application $application, array $options = array())
  29958. {
  29959. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  29960. }
  29961. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  29962. {
  29963. foreach ($importedParent->childNodes as $childNode) {
  29964. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  29965. }
  29966. }
  29967. private function writeDocument(\DOMDocument $dom)
  29968. {
  29969. $dom->formatOutput = true;
  29970. $this->write($dom->saveXML());
  29971. }
  29972. private function getInputArgumentDocument(InputArgument $argument)
  29973. {
  29974. $dom = new \DOMDocument('1.0', 'UTF-8');
  29975. $dom->appendChild($objectXML = $dom->createElement('argument'));
  29976. $objectXML->setAttribute('name', $argument->getName());
  29977. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  29978. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  29979. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  29980. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  29981. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  29982. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  29983. foreach ($defaults as $default) {
  29984. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  29985. $defaultXML->appendChild($dom->createTextNode($default));
  29986. }
  29987. return $dom;
  29988. }
  29989. private function getInputOptionDocument(InputOption $option)
  29990. {
  29991. $dom = new \DOMDocument('1.0', 'UTF-8');
  29992. $dom->appendChild($objectXML = $dom->createElement('option'));
  29993. $objectXML->setAttribute('name', '--'.$option->getName());
  29994. $pos = strpos($option->getShortcut(), '|');
  29995. if (false !== $pos) {
  29996. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  29997. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  29998. } else {
  29999. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  30000. }
  30001. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  30002. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  30003. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  30004. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  30005. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  30006. if ($option->acceptValue()) {
  30007. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  30008. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  30009. if (!empty($defaults)) {
  30010. foreach ($defaults as $default) {
  30011. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  30012. $defaultXML->appendChild($dom->createTextNode($default));
  30013. }
  30014. }
  30015. }
  30016. return $dom;
  30017. }
  30018. }
  30019. <?php
  30020. namespace Symfony\Component\Console\Event;
  30021. class ConsoleCommandEvent extends ConsoleEvent
  30022. {
  30023. const RETURN_CODE_DISABLED = 113;
  30024. private $commandShouldRun = true;
  30025. public function disableCommand()
  30026. {
  30027. return $this->commandShouldRun = false;
  30028. }
  30029. public function enableCommand()
  30030. {
  30031. return $this->commandShouldRun = true;
  30032. }
  30033. public function commandShouldRun()
  30034. {
  30035. return $this->commandShouldRun;
  30036. }
  30037. }
  30038. <?php
  30039. namespace Symfony\Component\Console\Event;
  30040. use Symfony\Component\Console\Command\Command;
  30041. use Symfony\Component\Console\Input\InputInterface;
  30042. use Symfony\Component\Console\Output\OutputInterface;
  30043. use Symfony\Component\EventDispatcher\Event;
  30044. class ConsoleEvent extends Event
  30045. {
  30046. protected $command;
  30047. private $input;
  30048. private $output;
  30049. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  30050. {
  30051. $this->command = $command;
  30052. $this->input = $input;
  30053. $this->output = $output;
  30054. }
  30055. public function getCommand()
  30056. {
  30057. return $this->command;
  30058. }
  30059. public function getInput()
  30060. {
  30061. return $this->input;
  30062. }
  30063. public function getOutput()
  30064. {
  30065. return $this->output;
  30066. }
  30067. }
  30068. <?php
  30069. namespace Symfony\Component\Console\Event;
  30070. use Symfony\Component\Console\Command\Command;
  30071. use Symfony\Component\Console\Input\InputInterface;
  30072. use Symfony\Component\Console\Output\OutputInterface;
  30073. class ConsoleExceptionEvent extends ConsoleEvent
  30074. {
  30075. private $exception;
  30076. private $exitCode;
  30077. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  30078. {
  30079. parent::__construct($command, $input, $output);
  30080. $this->setException($exception);
  30081. $this->exitCode = (int) $exitCode;
  30082. }
  30083. public function getException()
  30084. {
  30085. return $this->exception;
  30086. }
  30087. public function setException(\Exception $exception)
  30088. {
  30089. $this->exception = $exception;
  30090. }
  30091. public function getExitCode()
  30092. {
  30093. return $this->exitCode;
  30094. }
  30095. }
  30096. <?php
  30097. namespace Symfony\Component\Console\Event;
  30098. use Symfony\Component\Console\Command\Command;
  30099. use Symfony\Component\Console\Input\InputInterface;
  30100. use Symfony\Component\Console\Output\OutputInterface;
  30101. class ConsoleTerminateEvent extends ConsoleEvent
  30102. {
  30103. private $exitCode;
  30104. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  30105. {
  30106. parent::__construct($command, $input, $output);
  30107. $this->setExitCode($exitCode);
  30108. }
  30109. public function setExitCode($exitCode)
  30110. {
  30111. $this->exitCode = (int) $exitCode;
  30112. }
  30113. public function getExitCode()
  30114. {
  30115. return $this->exitCode;
  30116. }
  30117. }
  30118. <?php
  30119. namespace Symfony\Component\Console\Exception;
  30120. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  30121. {
  30122. private $alternatives;
  30123. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  30124. {
  30125. parent::__construct($message, $code, $previous);
  30126. $this->alternatives = $alternatives;
  30127. }
  30128. public function getAlternatives()
  30129. {
  30130. return $this->alternatives;
  30131. }
  30132. }
  30133. <?php
  30134. namespace Symfony\Component\Console\Exception;
  30135. interface ExceptionInterface
  30136. {
  30137. }
  30138. <?php
  30139. namespace Symfony\Component\Console\Exception;
  30140. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  30141. {
  30142. }
  30143. <?php
  30144. namespace Symfony\Component\Console\Exception;
  30145. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  30146. {
  30147. }
  30148. <?php
  30149. namespace Symfony\Component\Console\Exception;
  30150. class LogicException extends \LogicException implements ExceptionInterface
  30151. {
  30152. }
  30153. <?php
  30154. namespace Symfony\Component\Console\Exception;
  30155. class RuntimeException extends \RuntimeException implements ExceptionInterface
  30156. {
  30157. }
  30158. <?php
  30159. namespace Symfony\Component\Console\Formatter;
  30160. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30161. class OutputFormatter implements OutputFormatterInterface
  30162. {
  30163. private $decorated;
  30164. private $styles = array();
  30165. private $styleStack;
  30166. public static function escape($text)
  30167. {
  30168. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  30169. if ('\\' === substr($text, -1)) {
  30170. $len = strlen($text);
  30171. $text = rtrim($text, '\\');
  30172. $text .= str_repeat('<<', $len - strlen($text));
  30173. }
  30174. return $text;
  30175. }
  30176. public function __construct($decorated = false, array $styles = array())
  30177. {
  30178. $this->decorated = (bool) $decorated;
  30179. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  30180. $this->setStyle('info', new OutputFormatterStyle('green'));
  30181. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  30182. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  30183. foreach ($styles as $name => $style) {
  30184. $this->setStyle($name, $style);
  30185. }
  30186. $this->styleStack = new OutputFormatterStyleStack();
  30187. }
  30188. public function setDecorated($decorated)
  30189. {
  30190. $this->decorated = (bool) $decorated;
  30191. }
  30192. public function isDecorated()
  30193. {
  30194. return $this->decorated;
  30195. }
  30196. public function setStyle($name, OutputFormatterStyleInterface $style)
  30197. {
  30198. $this->styles[strtolower($name)] = $style;
  30199. }
  30200. public function hasStyle($name)
  30201. {
  30202. return isset($this->styles[strtolower($name)]);
  30203. }
  30204. public function getStyle($name)
  30205. {
  30206. if (!$this->hasStyle($name)) {
  30207. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  30208. }
  30209. return $this->styles[strtolower($name)];
  30210. }
  30211. public function format($message)
  30212. {
  30213. $message = (string) $message;
  30214. $offset = 0;
  30215. $output = '';
  30216. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  30217. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  30218. foreach ($matches[0] as $i => $match) {
  30219. $pos = $match[1];
  30220. $text = $match[0];
  30221. if (0 != $pos && '\\' == $message[$pos - 1]) {
  30222. continue;
  30223. }
  30224. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  30225. $offset = $pos + strlen($text);
  30226. if ($open = '/' != $text[1]) {
  30227. $tag = $matches[1][$i][0];
  30228. } else {
  30229. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  30230. }
  30231. if (!$open && !$tag) {
  30232. $this->styleStack->pop();
  30233. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  30234. $output .= $this->applyCurrentStyle($text);
  30235. } elseif ($open) {
  30236. $this->styleStack->push($style);
  30237. } else {
  30238. $this->styleStack->pop($style);
  30239. }
  30240. }
  30241. $output .= $this->applyCurrentStyle(substr($message, $offset));
  30242. if (false !== strpos($output, '<<')) {
  30243. return strtr($output, array('\\<' => '<', '<<' => '\\'));
  30244. }
  30245. return str_replace('\\<', '<', $output);
  30246. }
  30247. public function getStyleStack()
  30248. {
  30249. return $this->styleStack;
  30250. }
  30251. private function createStyleFromString($string)
  30252. {
  30253. if (isset($this->styles[$string])) {
  30254. return $this->styles[$string];
  30255. }
  30256. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  30257. return false;
  30258. }
  30259. $style = new OutputFormatterStyle();
  30260. foreach ($matches as $match) {
  30261. array_shift($match);
  30262. if ('fg' == $match[0]) {
  30263. $style->setForeground($match[1]);
  30264. } elseif ('bg' == $match[0]) {
  30265. $style->setBackground($match[1]);
  30266. } else {
  30267. try {
  30268. $style->setOption($match[1]);
  30269. } catch (\InvalidArgumentException $e) {
  30270. return false;
  30271. }
  30272. }
  30273. }
  30274. return $style;
  30275. }
  30276. private function applyCurrentStyle($text)
  30277. {
  30278. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  30279. }
  30280. }
  30281. <?php
  30282. namespace Symfony\Component\Console\Formatter;
  30283. interface OutputFormatterInterface
  30284. {
  30285. public function setDecorated($decorated);
  30286. public function isDecorated();
  30287. public function setStyle($name, OutputFormatterStyleInterface $style);
  30288. public function hasStyle($name);
  30289. public function getStyle($name);
  30290. public function format($message);
  30291. }
  30292. <?php
  30293. namespace Symfony\Component\Console\Formatter;
  30294. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30295. class OutputFormatterStyle implements OutputFormatterStyleInterface
  30296. {
  30297. private static $availableForegroundColors = array(
  30298. 'black' => array('set' => 30, 'unset' => 39),
  30299. 'red' => array('set' => 31, 'unset' => 39),
  30300. 'green' => array('set' => 32, 'unset' => 39),
  30301. 'yellow' => array('set' => 33, 'unset' => 39),
  30302. 'blue' => array('set' => 34, 'unset' => 39),
  30303. 'magenta' => array('set' => 35, 'unset' => 39),
  30304. 'cyan' => array('set' => 36, 'unset' => 39),
  30305. 'white' => array('set' => 37, 'unset' => 39),
  30306. 'default' => array('set' => 39, 'unset' => 39),
  30307. );
  30308. private static $availableBackgroundColors = array(
  30309. 'black' => array('set' => 40, 'unset' => 49),
  30310. 'red' => array('set' => 41, 'unset' => 49),
  30311. 'green' => array('set' => 42, 'unset' => 49),
  30312. 'yellow' => array('set' => 43, 'unset' => 49),
  30313. 'blue' => array('set' => 44, 'unset' => 49),
  30314. 'magenta' => array('set' => 45, 'unset' => 49),
  30315. 'cyan' => array('set' => 46, 'unset' => 49),
  30316. 'white' => array('set' => 47, 'unset' => 49),
  30317. 'default' => array('set' => 49, 'unset' => 49),
  30318. );
  30319. private static $availableOptions = array(
  30320. 'bold' => array('set' => 1, 'unset' => 22),
  30321. 'underscore' => array('set' => 4, 'unset' => 24),
  30322. 'blink' => array('set' => 5, 'unset' => 25),
  30323. 'reverse' => array('set' => 7, 'unset' => 27),
  30324. 'conceal' => array('set' => 8, 'unset' => 28),
  30325. );
  30326. private $foreground;
  30327. private $background;
  30328. private $options = array();
  30329. public function __construct($foreground = null, $background = null, array $options = array())
  30330. {
  30331. if (null !== $foreground) {
  30332. $this->setForeground($foreground);
  30333. }
  30334. if (null !== $background) {
  30335. $this->setBackground($background);
  30336. }
  30337. if (count($options)) {
  30338. $this->setOptions($options);
  30339. }
  30340. }
  30341. public function setForeground($color = null)
  30342. {
  30343. if (null === $color) {
  30344. $this->foreground = null;
  30345. return;
  30346. }
  30347. if (!isset(static::$availableForegroundColors[$color])) {
  30348. throw new InvalidArgumentException(sprintf(
  30349. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  30350. $color,
  30351. implode(', ', array_keys(static::$availableForegroundColors))
  30352. ));
  30353. }
  30354. $this->foreground = static::$availableForegroundColors[$color];
  30355. }
  30356. public function setBackground($color = null)
  30357. {
  30358. if (null === $color) {
  30359. $this->background = null;
  30360. return;
  30361. }
  30362. if (!isset(static::$availableBackgroundColors[$color])) {
  30363. throw new InvalidArgumentException(sprintf(
  30364. 'Invalid background color specified: "%s". Expected one of (%s)',
  30365. $color,
  30366. implode(', ', array_keys(static::$availableBackgroundColors))
  30367. ));
  30368. }
  30369. $this->background = static::$availableBackgroundColors[$color];
  30370. }
  30371. public function setOption($option)
  30372. {
  30373. if (!isset(static::$availableOptions[$option])) {
  30374. throw new InvalidArgumentException(sprintf(
  30375. 'Invalid option specified: "%s". Expected one of (%s)',
  30376. $option,
  30377. implode(', ', array_keys(static::$availableOptions))
  30378. ));
  30379. }
  30380. if (!in_array(static::$availableOptions[$option], $this->options)) {
  30381. $this->options[] = static::$availableOptions[$option];
  30382. }
  30383. }
  30384. public function unsetOption($option)
  30385. {
  30386. if (!isset(static::$availableOptions[$option])) {
  30387. throw new InvalidArgumentException(sprintf(
  30388. 'Invalid option specified: "%s". Expected one of (%s)',
  30389. $option,
  30390. implode(', ', array_keys(static::$availableOptions))
  30391. ));
  30392. }
  30393. $pos = array_search(static::$availableOptions[$option], $this->options);
  30394. if (false !== $pos) {
  30395. unset($this->options[$pos]);
  30396. }
  30397. }
  30398. public function setOptions(array $options)
  30399. {
  30400. $this->options = array();
  30401. foreach ($options as $option) {
  30402. $this->setOption($option);
  30403. }
  30404. }
  30405. public function apply($text)
  30406. {
  30407. $setCodes = array();
  30408. $unsetCodes = array();
  30409. if (null !== $this->foreground) {
  30410. $setCodes[] = $this->foreground['set'];
  30411. $unsetCodes[] = $this->foreground['unset'];
  30412. }
  30413. if (null !== $this->background) {
  30414. $setCodes[] = $this->background['set'];
  30415. $unsetCodes[] = $this->background['unset'];
  30416. }
  30417. if (count($this->options)) {
  30418. foreach ($this->options as $option) {
  30419. $setCodes[] = $option['set'];
  30420. $unsetCodes[] = $option['unset'];
  30421. }
  30422. }
  30423. if (0 === count($setCodes)) {
  30424. return $text;
  30425. }
  30426. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  30427. }
  30428. }
  30429. <?php
  30430. namespace Symfony\Component\Console\Formatter;
  30431. interface OutputFormatterStyleInterface
  30432. {
  30433. public function setForeground($color = null);
  30434. public function setBackground($color = null);
  30435. public function setOption($option);
  30436. public function unsetOption($option);
  30437. public function setOptions(array $options);
  30438. public function apply($text);
  30439. }
  30440. <?php
  30441. namespace Symfony\Component\Console\Formatter;
  30442. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30443. class OutputFormatterStyleStack
  30444. {
  30445. private $styles;
  30446. private $emptyStyle;
  30447. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  30448. {
  30449. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  30450. $this->reset();
  30451. }
  30452. public function reset()
  30453. {
  30454. $this->styles = array();
  30455. }
  30456. public function push(OutputFormatterStyleInterface $style)
  30457. {
  30458. $this->styles[] = $style;
  30459. }
  30460. public function pop(OutputFormatterStyleInterface $style = null)
  30461. {
  30462. if (empty($this->styles)) {
  30463. return $this->emptyStyle;
  30464. }
  30465. if (null === $style) {
  30466. return array_pop($this->styles);
  30467. }
  30468. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  30469. if ($style->apply('') === $stackedStyle->apply('')) {
  30470. $this->styles = array_slice($this->styles, 0, $index);
  30471. return $stackedStyle;
  30472. }
  30473. }
  30474. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  30475. }
  30476. public function getCurrent()
  30477. {
  30478. if (empty($this->styles)) {
  30479. return $this->emptyStyle;
  30480. }
  30481. return $this->styles[count($this->styles) - 1];
  30482. }
  30483. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  30484. {
  30485. $this->emptyStyle = $emptyStyle;
  30486. return $this;
  30487. }
  30488. public function getEmptyStyle()
  30489. {
  30490. return $this->emptyStyle;
  30491. }
  30492. }
  30493. <?php
  30494. namespace Symfony\Component\Console\Helper;
  30495. class DebugFormatterHelper extends Helper
  30496. {
  30497. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  30498. private $started = array();
  30499. private $count = -1;
  30500. public function start($id, $message, $prefix = 'RUN')
  30501. {
  30502. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  30503. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  30504. }
  30505. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  30506. {
  30507. $message = '';
  30508. if ($error) {
  30509. if (isset($this->started[$id]['out'])) {
  30510. $message .= "\n";
  30511. unset($this->started[$id]['out']);
  30512. }
  30513. if (!isset($this->started[$id]['err'])) {
  30514. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  30515. $this->started[$id]['err'] = true;
  30516. }
  30517. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  30518. } else {
  30519. if (isset($this->started[$id]['err'])) {
  30520. $message .= "\n";
  30521. unset($this->started[$id]['err']);
  30522. }
  30523. if (!isset($this->started[$id]['out'])) {
  30524. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  30525. $this->started[$id]['out'] = true;
  30526. }
  30527. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  30528. }
  30529. return $message;
  30530. }
  30531. public function stop($id, $message, $successful, $prefix = 'RES')
  30532. {
  30533. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  30534. if ($successful) {
  30535. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  30536. }
  30537. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  30538. unset($this->started[$id]['out'], $this->started[$id]['err']);
  30539. return $message;
  30540. }
  30541. private function getBorder($id)
  30542. {
  30543. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  30544. }
  30545. public function getName()
  30546. {
  30547. return 'debug_formatter';
  30548. }
  30549. }
  30550. <?php
  30551. namespace Symfony\Component\Console\Helper;
  30552. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  30553. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  30554. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  30555. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30556. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30557. use Symfony\Component\Console\Output\OutputInterface;
  30558. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30559. class DescriptorHelper extends Helper
  30560. {
  30561. private $descriptors = array();
  30562. public function __construct()
  30563. {
  30564. $this
  30565. ->register('txt', new TextDescriptor())
  30566. ->register('xml', new XmlDescriptor())
  30567. ->register('json', new JsonDescriptor())
  30568. ->register('md', new MarkdownDescriptor())
  30569. ;
  30570. }
  30571. public function describe(OutputInterface $output, $object, array $options = array())
  30572. {
  30573. $options = array_merge(array(
  30574. 'raw_text' => false,
  30575. 'format' => 'txt',
  30576. ), $options);
  30577. if (!isset($this->descriptors[$options['format']])) {
  30578. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  30579. }
  30580. $descriptor = $this->descriptors[$options['format']];
  30581. $descriptor->describe($output, $object, $options);
  30582. }
  30583. public function register($format, DescriptorInterface $descriptor)
  30584. {
  30585. $this->descriptors[$format] = $descriptor;
  30586. return $this;
  30587. }
  30588. public function getName()
  30589. {
  30590. return 'descriptor';
  30591. }
  30592. }
  30593. <?php
  30594. namespace Symfony\Component\Console\Helper;
  30595. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30596. use Symfony\Component\Console\Exception\RuntimeException;
  30597. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30598. use Symfony\Component\Console\Output\OutputInterface;
  30599. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  30600. class DialogHelper extends InputAwareHelper
  30601. {
  30602. private $inputStream;
  30603. private static $shell;
  30604. private static $stty;
  30605. public function __construct($triggerDeprecationError = true)
  30606. {
  30607. if ($triggerDeprecationError) {
  30608. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  30609. }
  30610. }
  30611. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  30612. {
  30613. if ($output instanceof ConsoleOutputInterface) {
  30614. $output = $output->getErrorOutput();
  30615. }
  30616. $width = max(array_map('strlen', array_keys($choices)));
  30617. $messages = (array) $question;
  30618. foreach ($choices as $key => $value) {
  30619. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  30620. }
  30621. $output->writeln($messages);
  30622. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  30623. $selectedChoices = str_replace(' ', '', $picked);
  30624. if ($multiselect) {
  30625. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  30626. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  30627. }
  30628. $selectedChoices = explode(',', $selectedChoices);
  30629. } else {
  30630. $selectedChoices = array($picked);
  30631. }
  30632. $multiselectChoices = array();
  30633. foreach ($selectedChoices as $value) {
  30634. if (empty($choices[$value])) {
  30635. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  30636. }
  30637. $multiselectChoices[] = $value;
  30638. }
  30639. if ($multiselect) {
  30640. return $multiselectChoices;
  30641. }
  30642. return $picked;
  30643. }, $attempts, $default);
  30644. return $result;
  30645. }
  30646. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  30647. {
  30648. if ($this->input && !$this->input->isInteractive()) {
  30649. return $default;
  30650. }
  30651. if ($output instanceof ConsoleOutputInterface) {
  30652. $output = $output->getErrorOutput();
  30653. }
  30654. $output->write($question);
  30655. $inputStream = $this->inputStream ?: STDIN;
  30656. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  30657. $ret = fgets($inputStream, 4096);
  30658. if (false === $ret) {
  30659. throw new RuntimeException('Aborted');
  30660. }
  30661. $ret = trim($ret);
  30662. } else {
  30663. $ret = '';
  30664. $i = 0;
  30665. $ofs = -1;
  30666. $matches = $autocomplete;
  30667. $numMatches = count($matches);
  30668. $sttyMode = shell_exec('stty -g');
  30669. shell_exec('stty -icanon -echo');
  30670. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  30671. while (!feof($inputStream)) {
  30672. $c = fread($inputStream, 1);
  30673. if ("\177" === $c) {
  30674. if (0 === $numMatches && 0 !== $i) {
  30675. --$i;
  30676. $output->write("\033[1D");
  30677. }
  30678. if ($i === 0) {
  30679. $ofs = -1;
  30680. $matches = $autocomplete;
  30681. $numMatches = count($matches);
  30682. } else {
  30683. $numMatches = 0;
  30684. }
  30685. $ret = substr($ret, 0, $i);
  30686. } elseif ("\033" === $c) {
  30687. $c .= fread($inputStream, 2);
  30688. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  30689. if ('A' === $c[2] && -1 === $ofs) {
  30690. $ofs = 0;
  30691. }
  30692. if (0 === $numMatches) {
  30693. continue;
  30694. }
  30695. $ofs += ('A' === $c[2]) ? -1 : 1;
  30696. $ofs = ($numMatches + $ofs) % $numMatches;
  30697. }
  30698. } elseif (ord($c) < 32) {
  30699. if ("\t" === $c || "\n" === $c) {
  30700. if ($numMatches > 0 && -1 !== $ofs) {
  30701. $ret = $matches[$ofs];
  30702. $output->write(substr($ret, $i));
  30703. $i = strlen($ret);
  30704. }
  30705. if ("\n" === $c) {
  30706. $output->write($c);
  30707. break;
  30708. }
  30709. $numMatches = 0;
  30710. }
  30711. continue;
  30712. } else {
  30713. $output->write($c);
  30714. $ret .= $c;
  30715. ++$i;
  30716. $numMatches = 0;
  30717. $ofs = 0;
  30718. foreach ($autocomplete as $value) {
  30719. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  30720. $matches[$numMatches++] = $value;
  30721. }
  30722. }
  30723. }
  30724. $output->write("\033[K");
  30725. if ($numMatches > 0 && -1 !== $ofs) {
  30726. $output->write("\0337");
  30727. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  30728. $output->write("\0338");
  30729. }
  30730. }
  30731. shell_exec(sprintf('stty %s', $sttyMode));
  30732. }
  30733. return strlen($ret) > 0 ? $ret : $default;
  30734. }
  30735. public function askConfirmation(OutputInterface $output, $question, $default = true)
  30736. {
  30737. $answer = 'z';
  30738. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  30739. $answer = $this->ask($output, $question);
  30740. }
  30741. if (false === $default) {
  30742. return $answer && 'y' == strtolower($answer[0]);
  30743. }
  30744. return !$answer || 'y' == strtolower($answer[0]);
  30745. }
  30746. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  30747. {
  30748. if ($output instanceof ConsoleOutputInterface) {
  30749. $output = $output->getErrorOutput();
  30750. }
  30751. if ('\\' === DIRECTORY_SEPARATOR) {
  30752. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  30753. if ('phar:' === substr(__FILE__, 0, 5)) {
  30754. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  30755. copy($exe, $tmpExe);
  30756. $exe = $tmpExe;
  30757. }
  30758. $output->write($question);
  30759. $value = rtrim(shell_exec($exe));
  30760. $output->writeln('');
  30761. if (isset($tmpExe)) {
  30762. unlink($tmpExe);
  30763. }
  30764. return $value;
  30765. }
  30766. if ($this->hasSttyAvailable()) {
  30767. $output->write($question);
  30768. $sttyMode = shell_exec('stty -g');
  30769. shell_exec('stty -echo');
  30770. $value = fgets($this->inputStream ?: STDIN, 4096);
  30771. shell_exec(sprintf('stty %s', $sttyMode));
  30772. if (false === $value) {
  30773. throw new RuntimeException('Aborted');
  30774. }
  30775. $value = trim($value);
  30776. $output->writeln('');
  30777. return $value;
  30778. }
  30779. if (false !== $shell = $this->getShell()) {
  30780. $output->write($question);
  30781. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  30782. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  30783. $value = rtrim(shell_exec($command));
  30784. $output->writeln('');
  30785. return $value;
  30786. }
  30787. if ($fallback) {
  30788. return $this->ask($output, $question);
  30789. }
  30790. throw new RuntimeException('Unable to hide the response');
  30791. }
  30792. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  30793. {
  30794. $that = $this;
  30795. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  30796. return $that->ask($output, $question, $default, $autocomplete);
  30797. };
  30798. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  30799. }
  30800. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  30801. {
  30802. $that = $this;
  30803. $interviewer = function () use ($output, $question, $fallback, $that) {
  30804. return $that->askHiddenResponse($output, $question, $fallback);
  30805. };
  30806. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  30807. }
  30808. public function setInputStream($stream)
  30809. {
  30810. $this->inputStream = $stream;
  30811. }
  30812. public function getInputStream()
  30813. {
  30814. return $this->inputStream;
  30815. }
  30816. public function getName()
  30817. {
  30818. return 'dialog';
  30819. }
  30820. private function getShell()
  30821. {
  30822. if (null !== self::$shell) {
  30823. return self::$shell;
  30824. }
  30825. self::$shell = false;
  30826. if (file_exists('/usr/bin/env')) {
  30827. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  30828. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  30829. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  30830. self::$shell = $sh;
  30831. break;
  30832. }
  30833. }
  30834. }
  30835. return self::$shell;
  30836. }
  30837. private function hasSttyAvailable()
  30838. {
  30839. if (null !== self::$stty) {
  30840. return self::$stty;
  30841. }
  30842. exec('stty 2>&1', $output, $exitcode);
  30843. return self::$stty = $exitcode === 0;
  30844. }
  30845. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  30846. {
  30847. if ($output instanceof ConsoleOutputInterface) {
  30848. $output = $output->getErrorOutput();
  30849. }
  30850. $e = null;
  30851. while (false === $attempts || $attempts--) {
  30852. if (null !== $e) {
  30853. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  30854. }
  30855. try {
  30856. return call_user_func($validator, $interviewer());
  30857. } catch (\Exception $e) {
  30858. }
  30859. }
  30860. throw $e;
  30861. }
  30862. }
  30863. <?php
  30864. namespace Symfony\Component\Console\Helper;
  30865. use Symfony\Component\Console\Formatter\OutputFormatter;
  30866. class FormatterHelper extends Helper
  30867. {
  30868. public function formatSection($section, $message, $style = 'info')
  30869. {
  30870. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  30871. }
  30872. public function formatBlock($messages, $style, $large = false)
  30873. {
  30874. if (!is_array($messages)) {
  30875. $messages = array($messages);
  30876. }
  30877. $len = 0;
  30878. $lines = array();
  30879. foreach ($messages as $message) {
  30880. $message = OutputFormatter::escape($message);
  30881. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  30882. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  30883. }
  30884. $messages = $large ? array(str_repeat(' ', $len)) : array();
  30885. for ($i = 0; isset($lines[$i]); ++$i) {
  30886. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  30887. }
  30888. if ($large) {
  30889. $messages[] = str_repeat(' ', $len);
  30890. }
  30891. for ($i = 0; isset($messages[$i]); ++$i) {
  30892. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  30893. }
  30894. return implode("\n", $messages);
  30895. }
  30896. public function getName()
  30897. {
  30898. return 'formatter';
  30899. }
  30900. }
  30901. <?php
  30902. namespace Symfony\Component\Console\Helper;
  30903. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  30904. abstract class Helper implements HelperInterface
  30905. {
  30906. protected $helperSet = null;
  30907. public function setHelperSet(HelperSet $helperSet = null)
  30908. {
  30909. $this->helperSet = $helperSet;
  30910. }
  30911. public function getHelperSet()
  30912. {
  30913. return $this->helperSet;
  30914. }
  30915. public static function strlen($string)
  30916. {
  30917. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  30918. return strlen($string);
  30919. }
  30920. return mb_strwidth($string, $encoding);
  30921. }
  30922. public static function formatTime($secs)
  30923. {
  30924. static $timeFormats = array(
  30925. array(0, '< 1 sec'),
  30926. array(1, '1 sec'),
  30927. array(2, 'secs', 1),
  30928. array(60, '1 min'),
  30929. array(120, 'mins', 60),
  30930. array(3600, '1 hr'),
  30931. array(7200, 'hrs', 3600),
  30932. array(86400, '1 day'),
  30933. array(172800, 'days', 86400),
  30934. );
  30935. foreach ($timeFormats as $index => $format) {
  30936. if ($secs >= $format[0]) {
  30937. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  30938. || $index == count($timeFormats) - 1
  30939. ) {
  30940. if (2 == count($format)) {
  30941. return $format[1];
  30942. }
  30943. return floor($secs / $format[2]).' '.$format[1];
  30944. }
  30945. }
  30946. }
  30947. }
  30948. public static function formatMemory($memory)
  30949. {
  30950. if ($memory >= 1024 * 1024 * 1024) {
  30951. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  30952. }
  30953. if ($memory >= 1024 * 1024) {
  30954. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  30955. }
  30956. if ($memory >= 1024) {
  30957. return sprintf('%d KiB', $memory / 1024);
  30958. }
  30959. return sprintf('%d B', $memory);
  30960. }
  30961. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  30962. {
  30963. $isDecorated = $formatter->isDecorated();
  30964. $formatter->setDecorated(false);
  30965. $string = $formatter->format($string);
  30966. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  30967. $formatter->setDecorated($isDecorated);
  30968. return self::strlen($string);
  30969. }
  30970. }
  30971. <?php
  30972. namespace Symfony\Component\Console\Helper;
  30973. interface HelperInterface
  30974. {
  30975. public function setHelperSet(HelperSet $helperSet = null);
  30976. public function getHelperSet();
  30977. public function getName();
  30978. }
  30979. <?php
  30980. namespace Symfony\Component\Console\Helper;
  30981. use Symfony\Component\Console\Command\Command;
  30982. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30983. class HelperSet implements \IteratorAggregate
  30984. {
  30985. private $helpers = array();
  30986. private $command;
  30987. public function __construct(array $helpers = array())
  30988. {
  30989. foreach ($helpers as $alias => $helper) {
  30990. $this->set($helper, is_int($alias) ? null : $alias);
  30991. }
  30992. }
  30993. public function set(HelperInterface $helper, $alias = null)
  30994. {
  30995. $this->helpers[$helper->getName()] = $helper;
  30996. if (null !== $alias) {
  30997. $this->helpers[$alias] = $helper;
  30998. }
  30999. $helper->setHelperSet($this);
  31000. }
  31001. public function has($name)
  31002. {
  31003. return isset($this->helpers[$name]);
  31004. }
  31005. public function get($name)
  31006. {
  31007. if (!$this->has($name)) {
  31008. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  31009. }
  31010. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  31011. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  31012. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  31013. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  31014. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  31015. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  31016. }
  31017. return $this->helpers[$name];
  31018. }
  31019. public function setCommand(Command $command = null)
  31020. {
  31021. $this->command = $command;
  31022. }
  31023. public function getCommand()
  31024. {
  31025. return $this->command;
  31026. }
  31027. public function getIterator()
  31028. {
  31029. return new \ArrayIterator($this->helpers);
  31030. }
  31031. }
  31032. <?php
  31033. namespace Symfony\Component\Console\Helper;
  31034. use Symfony\Component\Console\Input\InputInterface;
  31035. use Symfony\Component\Console\Input\InputAwareInterface;
  31036. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  31037. {
  31038. protected $input;
  31039. public function setInput(InputInterface $input)
  31040. {
  31041. $this->input = $input;
  31042. }
  31043. }
  31044. <?php
  31045. namespace Symfony\Component\Console\Helper;
  31046. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31047. use Symfony\Component\Console\Output\OutputInterface;
  31048. use Symfony\Component\Process\Exception\ProcessFailedException;
  31049. use Symfony\Component\Process\Process;
  31050. use Symfony\Component\Process\ProcessBuilder;
  31051. class ProcessHelper extends Helper
  31052. {
  31053. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  31054. {
  31055. if ($output instanceof ConsoleOutputInterface) {
  31056. $output = $output->getErrorOutput();
  31057. }
  31058. $formatter = $this->getHelperSet()->get('debug_formatter');
  31059. if (is_array($cmd)) {
  31060. $process = ProcessBuilder::create($cmd)->getProcess();
  31061. } elseif ($cmd instanceof Process) {
  31062. $process = $cmd;
  31063. } else {
  31064. $process = new Process($cmd);
  31065. }
  31066. if ($verbosity <= $output->getVerbosity()) {
  31067. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  31068. }
  31069. if ($output->isDebug()) {
  31070. $callback = $this->wrapCallback($output, $process, $callback);
  31071. }
  31072. $process->run($callback);
  31073. if ($verbosity <= $output->getVerbosity()) {
  31074. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  31075. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  31076. }
  31077. if (!$process->isSuccessful() && null !== $error) {
  31078. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  31079. }
  31080. return $process;
  31081. }
  31082. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  31083. {
  31084. $process = $this->run($output, $cmd, $error, $callback);
  31085. if (!$process->isSuccessful()) {
  31086. throw new ProcessFailedException($process);
  31087. }
  31088. return $process;
  31089. }
  31090. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  31091. {
  31092. if ($output instanceof ConsoleOutputInterface) {
  31093. $output = $output->getErrorOutput();
  31094. }
  31095. $formatter = $this->getHelperSet()->get('debug_formatter');
  31096. $that = $this;
  31097. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  31098. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  31099. if (null !== $callback) {
  31100. call_user_func($callback, $type, $buffer);
  31101. }
  31102. };
  31103. }
  31104. public function escapeString($str)
  31105. {
  31106. return str_replace('<', '\\<', $str);
  31107. }
  31108. public function getName()
  31109. {
  31110. return 'process';
  31111. }
  31112. }
  31113. <?php
  31114. namespace Symfony\Component\Console\Helper;
  31115. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31116. use Symfony\Component\Console\Output\OutputInterface;
  31117. use Symfony\Component\Console\Exception\LogicException;
  31118. class ProgressBar
  31119. {
  31120. private $barWidth = 28;
  31121. private $barChar;
  31122. private $emptyBarChar = '-';
  31123. private $progressChar = '>';
  31124. private $format;
  31125. private $internalFormat;
  31126. private $redrawFreq = 1;
  31127. private $output;
  31128. private $step = 0;
  31129. private $max;
  31130. private $startTime;
  31131. private $stepWidth;
  31132. private $percent = 0.0;
  31133. private $formatLineCount;
  31134. private $messages = array();
  31135. private $overwrite = true;
  31136. private $firstRun = true;
  31137. private static $formatters;
  31138. private static $formats;
  31139. public function __construct(OutputInterface $output, $max = 0)
  31140. {
  31141. if ($output instanceof ConsoleOutputInterface) {
  31142. $output = $output->getErrorOutput();
  31143. }
  31144. $this->output = $output;
  31145. $this->setMaxSteps($max);
  31146. if (!$this->output->isDecorated()) {
  31147. $this->overwrite = false;
  31148. $this->setRedrawFrequency($max / 10);
  31149. }
  31150. $this->startTime = time();
  31151. }
  31152. public static function setPlaceholderFormatterDefinition($name, $callable)
  31153. {
  31154. if (!self::$formatters) {
  31155. self::$formatters = self::initPlaceholderFormatters();
  31156. }
  31157. self::$formatters[$name] = $callable;
  31158. }
  31159. public static function getPlaceholderFormatterDefinition($name)
  31160. {
  31161. if (!self::$formatters) {
  31162. self::$formatters = self::initPlaceholderFormatters();
  31163. }
  31164. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  31165. }
  31166. public static function setFormatDefinition($name, $format)
  31167. {
  31168. if (!self::$formats) {
  31169. self::$formats = self::initFormats();
  31170. }
  31171. self::$formats[$name] = $format;
  31172. }
  31173. public static function getFormatDefinition($name)
  31174. {
  31175. if (!self::$formats) {
  31176. self::$formats = self::initFormats();
  31177. }
  31178. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  31179. }
  31180. public function setMessage($message, $name = 'message')
  31181. {
  31182. $this->messages[$name] = $message;
  31183. }
  31184. public function getMessage($name = 'message')
  31185. {
  31186. return $this->messages[$name];
  31187. }
  31188. public function getStartTime()
  31189. {
  31190. return $this->startTime;
  31191. }
  31192. public function getMaxSteps()
  31193. {
  31194. return $this->max;
  31195. }
  31196. public function getStep()
  31197. {
  31198. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  31199. return $this->getProgress();
  31200. }
  31201. public function getProgress()
  31202. {
  31203. return $this->step;
  31204. }
  31205. public function getStepWidth()
  31206. {
  31207. return $this->stepWidth;
  31208. }
  31209. public function getProgressPercent()
  31210. {
  31211. return $this->percent;
  31212. }
  31213. public function setBarWidth($size)
  31214. {
  31215. $this->barWidth = (int) $size;
  31216. }
  31217. public function getBarWidth()
  31218. {
  31219. return $this->barWidth;
  31220. }
  31221. public function setBarCharacter($char)
  31222. {
  31223. $this->barChar = $char;
  31224. }
  31225. public function getBarCharacter()
  31226. {
  31227. if (null === $this->barChar) {
  31228. return $this->max ? '=' : $this->emptyBarChar;
  31229. }
  31230. return $this->barChar;
  31231. }
  31232. public function setEmptyBarCharacter($char)
  31233. {
  31234. $this->emptyBarChar = $char;
  31235. }
  31236. public function getEmptyBarCharacter()
  31237. {
  31238. return $this->emptyBarChar;
  31239. }
  31240. public function setProgressCharacter($char)
  31241. {
  31242. $this->progressChar = $char;
  31243. }
  31244. public function getProgressCharacter()
  31245. {
  31246. return $this->progressChar;
  31247. }
  31248. public function setFormat($format)
  31249. {
  31250. $this->format = null;
  31251. $this->internalFormat = $format;
  31252. }
  31253. public function setRedrawFrequency($freq)
  31254. {
  31255. $this->redrawFreq = max((int) $freq, 1);
  31256. }
  31257. public function start($max = null)
  31258. {
  31259. $this->startTime = time();
  31260. $this->step = 0;
  31261. $this->percent = 0.0;
  31262. if (null !== $max) {
  31263. $this->setMaxSteps($max);
  31264. }
  31265. $this->display();
  31266. }
  31267. public function advance($step = 1)
  31268. {
  31269. $this->setProgress($this->step + $step);
  31270. }
  31271. public function setCurrent($step)
  31272. {
  31273. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  31274. $this->setProgress($step);
  31275. }
  31276. public function setOverwrite($overwrite)
  31277. {
  31278. $this->overwrite = (bool) $overwrite;
  31279. }
  31280. public function setProgress($step)
  31281. {
  31282. $step = (int) $step;
  31283. if ($step < $this->step) {
  31284. throw new LogicException('You can\'t regress the progress bar.');
  31285. }
  31286. if ($this->max && $step > $this->max) {
  31287. $this->max = $step;
  31288. }
  31289. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  31290. $currPeriod = (int) ($step / $this->redrawFreq);
  31291. $this->step = $step;
  31292. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  31293. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  31294. $this->display();
  31295. }
  31296. }
  31297. public function finish()
  31298. {
  31299. if (!$this->max) {
  31300. $this->max = $this->step;
  31301. }
  31302. if ($this->step === $this->max && !$this->overwrite) {
  31303. return;
  31304. }
  31305. $this->setProgress($this->max);
  31306. }
  31307. public function display()
  31308. {
  31309. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  31310. return;
  31311. }
  31312. if (null === $this->format) {
  31313. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  31314. }
  31315. $self = $this;
  31316. $output = $this->output;
  31317. $messages = $this->messages;
  31318. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  31319. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  31320. $text = call_user_func($formatter, $self, $output);
  31321. } elseif (isset($messages[$matches[1]])) {
  31322. $text = $messages[$matches[1]];
  31323. } else {
  31324. return $matches[0];
  31325. }
  31326. if (isset($matches[2])) {
  31327. $text = sprintf('%'.$matches[2], $text);
  31328. }
  31329. return $text;
  31330. }, $this->format));
  31331. }
  31332. public function clear()
  31333. {
  31334. if (!$this->overwrite) {
  31335. return;
  31336. }
  31337. if (null === $this->format) {
  31338. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  31339. }
  31340. $this->overwrite('');
  31341. }
  31342. private function setRealFormat($format)
  31343. {
  31344. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  31345. $this->format = self::getFormatDefinition($format.'_nomax');
  31346. } elseif (null !== self::getFormatDefinition($format)) {
  31347. $this->format = self::getFormatDefinition($format);
  31348. } else {
  31349. $this->format = $format;
  31350. }
  31351. $this->formatLineCount = substr_count($this->format, "\n");
  31352. }
  31353. private function setMaxSteps($max)
  31354. {
  31355. $this->max = max(0, (int) $max);
  31356. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  31357. }
  31358. private function overwrite($message)
  31359. {
  31360. if ($this->overwrite) {
  31361. if (!$this->firstRun) {
  31362. $this->output->write("\x0D");
  31363. $this->output->write("\x1B[2K");
  31364. if ($this->formatLineCount > 0) {
  31365. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  31366. }
  31367. }
  31368. } elseif ($this->step > 0) {
  31369. $this->output->writeln('');
  31370. }
  31371. $this->firstRun = false;
  31372. $this->output->write($message);
  31373. }
  31374. private function determineBestFormat()
  31375. {
  31376. switch ($this->output->getVerbosity()) {
  31377. case OutputInterface::VERBOSITY_VERBOSE:
  31378. return $this->max ? 'verbose' : 'verbose_nomax';
  31379. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  31380. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  31381. case OutputInterface::VERBOSITY_DEBUG:
  31382. return $this->max ? 'debug' : 'debug_nomax';
  31383. default:
  31384. return $this->max ? 'normal' : 'normal_nomax';
  31385. }
  31386. }
  31387. private static function initPlaceholderFormatters()
  31388. {
  31389. return array(
  31390. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  31391. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  31392. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  31393. if ($completeBars < $bar->getBarWidth()) {
  31394. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  31395. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  31396. }
  31397. return $display;
  31398. },
  31399. 'elapsed' => function (ProgressBar $bar) {
  31400. return Helper::formatTime(time() - $bar->getStartTime());
  31401. },
  31402. 'remaining' => function (ProgressBar $bar) {
  31403. if (!$bar->getMaxSteps()) {
  31404. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  31405. }
  31406. if (!$bar->getProgress()) {
  31407. $remaining = 0;
  31408. } else {
  31409. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  31410. }
  31411. return Helper::formatTime($remaining);
  31412. },
  31413. 'estimated' => function (ProgressBar $bar) {
  31414. if (!$bar->getMaxSteps()) {
  31415. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  31416. }
  31417. if (!$bar->getProgress()) {
  31418. $estimated = 0;
  31419. } else {
  31420. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  31421. }
  31422. return Helper::formatTime($estimated);
  31423. },
  31424. 'memory' => function (ProgressBar $bar) {
  31425. return Helper::formatMemory(memory_get_usage(true));
  31426. },
  31427. 'current' => function (ProgressBar $bar) {
  31428. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  31429. },
  31430. 'max' => function (ProgressBar $bar) {
  31431. return $bar->getMaxSteps();
  31432. },
  31433. 'percent' => function (ProgressBar $bar) {
  31434. return floor($bar->getProgressPercent() * 100);
  31435. },
  31436. );
  31437. }
  31438. private static function initFormats()
  31439. {
  31440. return array(
  31441. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  31442. 'normal_nomax' => ' %current% [%bar%]',
  31443. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  31444. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  31445. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  31446. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  31447. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  31448. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  31449. );
  31450. }
  31451. }
  31452. <?php
  31453. namespace Symfony\Component\Console\Helper;
  31454. use Symfony\Component\Console\Output\NullOutput;
  31455. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31456. use Symfony\Component\Console\Output\OutputInterface;
  31457. use Symfony\Component\Console\Exception\LogicException;
  31458. class ProgressHelper extends Helper
  31459. {
  31460. const FORMAT_QUIET = ' %percent%%';
  31461. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  31462. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  31463. const FORMAT_QUIET_NOMAX = ' %current%';
  31464. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  31465. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  31466. private $barWidth = 28;
  31467. private $barChar = '=';
  31468. private $emptyBarChar = '-';
  31469. private $progressChar = '>';
  31470. private $format = null;
  31471. private $redrawFreq = 1;
  31472. private $lastMessagesLength;
  31473. private $barCharOriginal;
  31474. private $output;
  31475. private $current;
  31476. private $max;
  31477. private $startTime;
  31478. private $defaultFormatVars = array(
  31479. 'current',
  31480. 'max',
  31481. 'bar',
  31482. 'percent',
  31483. 'elapsed',
  31484. );
  31485. private $formatVars;
  31486. private $widths = array(
  31487. 'current' => 4,
  31488. 'max' => 4,
  31489. 'percent' => 3,
  31490. 'elapsed' => 6,
  31491. );
  31492. private $timeFormats = array(
  31493. array(0, '???'),
  31494. array(2, '1 sec'),
  31495. array(59, 'secs', 1),
  31496. array(60, '1 min'),
  31497. array(3600, 'mins', 60),
  31498. array(5400, '1 hr'),
  31499. array(86400, 'hrs', 3600),
  31500. array(129600, '1 day'),
  31501. array(604800, 'days', 86400),
  31502. );
  31503. public function __construct($triggerDeprecationError = true)
  31504. {
  31505. if ($triggerDeprecationError) {
  31506. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  31507. }
  31508. }
  31509. public function setBarWidth($size)
  31510. {
  31511. $this->barWidth = (int) $size;
  31512. }
  31513. public function setBarCharacter($char)
  31514. {
  31515. $this->barChar = $char;
  31516. }
  31517. public function setEmptyBarCharacter($char)
  31518. {
  31519. $this->emptyBarChar = $char;
  31520. }
  31521. public function setProgressCharacter($char)
  31522. {
  31523. $this->progressChar = $char;
  31524. }
  31525. public function setFormat($format)
  31526. {
  31527. $this->format = $format;
  31528. }
  31529. public function setRedrawFrequency($freq)
  31530. {
  31531. $this->redrawFreq = (int) $freq;
  31532. }
  31533. public function start(OutputInterface $output, $max = null)
  31534. {
  31535. if ($output instanceof ConsoleOutputInterface) {
  31536. $output = $output->getErrorOutput();
  31537. }
  31538. $this->startTime = time();
  31539. $this->current = 0;
  31540. $this->max = (int) $max;
  31541. $this->output = $output->isDecorated() ? $output : new NullOutput();
  31542. $this->lastMessagesLength = 0;
  31543. $this->barCharOriginal = '';
  31544. if (null === $this->format) {
  31545. switch ($output->getVerbosity()) {
  31546. case OutputInterface::VERBOSITY_QUIET:
  31547. $this->format = self::FORMAT_QUIET_NOMAX;
  31548. if ($this->max > 0) {
  31549. $this->format = self::FORMAT_QUIET;
  31550. }
  31551. break;
  31552. case OutputInterface::VERBOSITY_VERBOSE:
  31553. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  31554. case OutputInterface::VERBOSITY_DEBUG:
  31555. $this->format = self::FORMAT_VERBOSE_NOMAX;
  31556. if ($this->max > 0) {
  31557. $this->format = self::FORMAT_VERBOSE;
  31558. }
  31559. break;
  31560. default:
  31561. $this->format = self::FORMAT_NORMAL_NOMAX;
  31562. if ($this->max > 0) {
  31563. $this->format = self::FORMAT_NORMAL;
  31564. }
  31565. break;
  31566. }
  31567. }
  31568. $this->initialize();
  31569. }
  31570. public function advance($step = 1, $redraw = false)
  31571. {
  31572. $this->setCurrent($this->current + $step, $redraw);
  31573. }
  31574. public function setCurrent($current, $redraw = false)
  31575. {
  31576. if (null === $this->startTime) {
  31577. throw new LogicException('You must start the progress bar before calling setCurrent().');
  31578. }
  31579. $current = (int) $current;
  31580. if ($current < $this->current) {
  31581. throw new LogicException('You can\'t regress the progress bar');
  31582. }
  31583. if (0 === $this->current) {
  31584. $redraw = true;
  31585. }
  31586. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  31587. $this->current = $current;
  31588. $currPeriod = (int) ($this->current / $this->redrawFreq);
  31589. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  31590. $this->display();
  31591. }
  31592. }
  31593. public function display($finish = false)
  31594. {
  31595. if (null === $this->startTime) {
  31596. throw new LogicException('You must start the progress bar before calling display().');
  31597. }
  31598. $message = $this->format;
  31599. foreach ($this->generate($finish) as $name => $value) {
  31600. $message = str_replace("%{$name}%", $value, $message);
  31601. }
  31602. $this->overwrite($this->output, $message);
  31603. }
  31604. public function clear()
  31605. {
  31606. $this->overwrite($this->output, '');
  31607. }
  31608. public function finish()
  31609. {
  31610. if (null === $this->startTime) {
  31611. throw new LogicException('You must start the progress bar before calling finish().');
  31612. }
  31613. if (null !== $this->startTime) {
  31614. if (!$this->max) {
  31615. $this->barChar = $this->barCharOriginal;
  31616. $this->display(true);
  31617. }
  31618. $this->startTime = null;
  31619. $this->output->writeln('');
  31620. $this->output = null;
  31621. }
  31622. }
  31623. private function initialize()
  31624. {
  31625. $this->formatVars = array();
  31626. foreach ($this->defaultFormatVars as $var) {
  31627. if (false !== strpos($this->format, "%{$var}%")) {
  31628. $this->formatVars[$var] = true;
  31629. }
  31630. }
  31631. if ($this->max > 0) {
  31632. $this->widths['max'] = $this->strlen($this->max);
  31633. $this->widths['current'] = $this->widths['max'];
  31634. } else {
  31635. $this->barCharOriginal = $this->barChar;
  31636. $this->barChar = $this->emptyBarChar;
  31637. }
  31638. }
  31639. private function generate($finish = false)
  31640. {
  31641. $vars = array();
  31642. $percent = 0;
  31643. if ($this->max > 0) {
  31644. $percent = (float) $this->current / $this->max;
  31645. }
  31646. if (isset($this->formatVars['bar'])) {
  31647. if ($this->max > 0) {
  31648. $completeBars = floor($percent * $this->barWidth);
  31649. } else {
  31650. if (!$finish) {
  31651. $completeBars = floor($this->current % $this->barWidth);
  31652. } else {
  31653. $completeBars = $this->barWidth;
  31654. }
  31655. }
  31656. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  31657. $bar = str_repeat($this->barChar, $completeBars);
  31658. if ($completeBars < $this->barWidth) {
  31659. $bar .= $this->progressChar;
  31660. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  31661. }
  31662. $vars['bar'] = $bar;
  31663. }
  31664. if (isset($this->formatVars['elapsed'])) {
  31665. $elapsed = time() - $this->startTime;
  31666. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  31667. }
  31668. if (isset($this->formatVars['current'])) {
  31669. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  31670. }
  31671. if (isset($this->formatVars['max'])) {
  31672. $vars['max'] = $this->max;
  31673. }
  31674. if (isset($this->formatVars['percent'])) {
  31675. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  31676. }
  31677. return $vars;
  31678. }
  31679. private function humaneTime($secs)
  31680. {
  31681. $text = '';
  31682. foreach ($this->timeFormats as $format) {
  31683. if ($secs < $format[0]) {
  31684. if (count($format) == 2) {
  31685. $text = $format[1];
  31686. break;
  31687. } else {
  31688. $text = ceil($secs / $format[2]).' '.$format[1];
  31689. break;
  31690. }
  31691. }
  31692. }
  31693. return $text;
  31694. }
  31695. private function overwrite(OutputInterface $output, $message)
  31696. {
  31697. $length = $this->strlen($message);
  31698. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  31699. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  31700. }
  31701. $output->write("\x0D");
  31702. $output->write($message);
  31703. $this->lastMessagesLength = $this->strlen($message);
  31704. }
  31705. public function getName()
  31706. {
  31707. return 'progress';
  31708. }
  31709. }
  31710. <?php
  31711. namespace Symfony\Component\Console\Helper;
  31712. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31713. use Symfony\Component\Console\Exception\LogicException;
  31714. use Symfony\Component\Console\Output\OutputInterface;
  31715. class ProgressIndicator
  31716. {
  31717. private $output;
  31718. private $startTime;
  31719. private $format;
  31720. private $message;
  31721. private $indicatorValues;
  31722. private $indicatorCurrent;
  31723. private $indicatorChangeInterval;
  31724. private $indicatorUpdateTime;
  31725. private $started = false;
  31726. private static $formatters;
  31727. private static $formats;
  31728. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  31729. {
  31730. $this->output = $output;
  31731. if (null === $format) {
  31732. $format = $this->determineBestFormat();
  31733. }
  31734. if (null === $indicatorValues) {
  31735. $indicatorValues = array('-', '\\', '|', '/');
  31736. }
  31737. $indicatorValues = array_values($indicatorValues);
  31738. if (2 > count($indicatorValues)) {
  31739. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  31740. }
  31741. $this->format = self::getFormatDefinition($format);
  31742. $this->indicatorChangeInterval = $indicatorChangeInterval;
  31743. $this->indicatorValues = $indicatorValues;
  31744. $this->startTime = time();
  31745. }
  31746. public function setMessage($message)
  31747. {
  31748. $this->message = $message;
  31749. $this->display();
  31750. }
  31751. public function getMessage()
  31752. {
  31753. return $this->message;
  31754. }
  31755. public function getStartTime()
  31756. {
  31757. return $this->startTime;
  31758. }
  31759. public function getCurrentValue()
  31760. {
  31761. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  31762. }
  31763. public function start($message)
  31764. {
  31765. if ($this->started) {
  31766. throw new LogicException('Progress indicator already started.');
  31767. }
  31768. $this->message = $message;
  31769. $this->started = true;
  31770. $this->startTime = time();
  31771. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  31772. $this->indicatorCurrent = 0;
  31773. $this->display();
  31774. }
  31775. public function advance()
  31776. {
  31777. if (!$this->started) {
  31778. throw new LogicException('Progress indicator has not yet been started.');
  31779. }
  31780. if (!$this->output->isDecorated()) {
  31781. return;
  31782. }
  31783. $currentTime = $this->getCurrentTimeInMilliseconds();
  31784. if ($currentTime < $this->indicatorUpdateTime) {
  31785. return;
  31786. }
  31787. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  31788. ++$this->indicatorCurrent;
  31789. $this->display();
  31790. }
  31791. public function finish($message)
  31792. {
  31793. if (!$this->started) {
  31794. throw new LogicException('Progress indicator has not yet been started.');
  31795. }
  31796. $this->message = $message;
  31797. $this->display();
  31798. $this->output->writeln('');
  31799. $this->started = false;
  31800. }
  31801. public static function getFormatDefinition($name)
  31802. {
  31803. if (!self::$formats) {
  31804. self::$formats = self::initFormats();
  31805. }
  31806. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  31807. }
  31808. public static function setPlaceholderFormatterDefinition($name, $callable)
  31809. {
  31810. if (!self::$formatters) {
  31811. self::$formatters = self::initPlaceholderFormatters();
  31812. }
  31813. self::$formatters[$name] = $callable;
  31814. }
  31815. public static function getPlaceholderFormatterDefinition($name)
  31816. {
  31817. if (!self::$formatters) {
  31818. self::$formatters = self::initPlaceholderFormatters();
  31819. }
  31820. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  31821. }
  31822. private function display()
  31823. {
  31824. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  31825. return;
  31826. }
  31827. $self = $this;
  31828. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  31829. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  31830. return call_user_func($formatter, $self);
  31831. }
  31832. return $matches[0];
  31833. }, $this->format));
  31834. }
  31835. private function determineBestFormat()
  31836. {
  31837. switch ($this->output->getVerbosity()) {
  31838. case OutputInterface::VERBOSITY_VERBOSE:
  31839. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  31840. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  31841. case OutputInterface::VERBOSITY_DEBUG:
  31842. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  31843. default:
  31844. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  31845. }
  31846. }
  31847. private function overwrite($message)
  31848. {
  31849. if ($this->output->isDecorated()) {
  31850. $this->output->write("\x0D\x1B[2K");
  31851. $this->output->write($message);
  31852. } else {
  31853. $this->output->writeln($message);
  31854. }
  31855. }
  31856. private function getCurrentTimeInMilliseconds()
  31857. {
  31858. return round(microtime(true) * 1000);
  31859. }
  31860. private static function initPlaceholderFormatters()
  31861. {
  31862. return array(
  31863. 'indicator' => function (ProgressIndicator $indicator) {
  31864. return $indicator->getCurrentValue();
  31865. },
  31866. 'message' => function (ProgressIndicator $indicator) {
  31867. return $indicator->getMessage();
  31868. },
  31869. 'elapsed' => function (ProgressIndicator $indicator) {
  31870. return Helper::formatTime(time() - $indicator->getStartTime());
  31871. },
  31872. 'memory' => function () {
  31873. return Helper::formatMemory(memory_get_usage(true));
  31874. },
  31875. );
  31876. }
  31877. private static function initFormats()
  31878. {
  31879. return array(
  31880. 'normal' => ' %indicator% %message%',
  31881. 'normal_no_ansi' => ' %message%',
  31882. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  31883. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  31884. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  31885. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  31886. );
  31887. }
  31888. }
  31889. <?php
  31890. namespace Symfony\Component\Console\Helper;
  31891. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31892. use Symfony\Component\Console\Exception\RuntimeException;
  31893. use Symfony\Component\Console\Input\InputInterface;
  31894. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31895. use Symfony\Component\Console\Output\OutputInterface;
  31896. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  31897. use Symfony\Component\Console\Question\Question;
  31898. use Symfony\Component\Console\Question\ChoiceQuestion;
  31899. class QuestionHelper extends Helper
  31900. {
  31901. private $inputStream;
  31902. private static $shell;
  31903. private static $stty;
  31904. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  31905. {
  31906. if ($output instanceof ConsoleOutputInterface) {
  31907. $output = $output->getErrorOutput();
  31908. }
  31909. if (!$input->isInteractive()) {
  31910. return $question->getDefault();
  31911. }
  31912. if (!$question->getValidator()) {
  31913. return $this->doAsk($output, $question);
  31914. }
  31915. $that = $this;
  31916. $interviewer = function () use ($output, $question, $that) {
  31917. return $that->doAsk($output, $question);
  31918. };
  31919. return $this->validateAttempts($interviewer, $output, $question);
  31920. }
  31921. public function setInputStream($stream)
  31922. {
  31923. if (!is_resource($stream)) {
  31924. throw new InvalidArgumentException('Input stream must be a valid resource.');
  31925. }
  31926. $this->inputStream = $stream;
  31927. }
  31928. public function getInputStream()
  31929. {
  31930. return $this->inputStream;
  31931. }
  31932. public function getName()
  31933. {
  31934. return 'question';
  31935. }
  31936. public function doAsk(OutputInterface $output, Question $question)
  31937. {
  31938. $this->writePrompt($output, $question);
  31939. $inputStream = $this->inputStream ?: STDIN;
  31940. $autocomplete = $question->getAutocompleterValues();
  31941. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  31942. $ret = false;
  31943. if ($question->isHidden()) {
  31944. try {
  31945. $ret = trim($this->getHiddenResponse($output, $inputStream));
  31946. } catch (\RuntimeException $e) {
  31947. if (!$question->isHiddenFallback()) {
  31948. throw $e;
  31949. }
  31950. }
  31951. }
  31952. if (false === $ret) {
  31953. $ret = fgets($inputStream, 4096);
  31954. if (false === $ret) {
  31955. throw new RuntimeException('Aborted');
  31956. }
  31957. $ret = trim($ret);
  31958. }
  31959. } else {
  31960. $ret = trim($this->autocomplete($output, $question, $inputStream));
  31961. }
  31962. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  31963. if ($normalizer = $question->getNormalizer()) {
  31964. return $normalizer($ret);
  31965. }
  31966. return $ret;
  31967. }
  31968. protected function writePrompt(OutputInterface $output, Question $question)
  31969. {
  31970. $message = $question->getQuestion();
  31971. if ($question instanceof ChoiceQuestion) {
  31972. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  31973. $messages = (array) $question->getQuestion();
  31974. foreach ($question->getChoices() as $key => $value) {
  31975. $width = $maxWidth - $this->strlen($key);
  31976. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  31977. }
  31978. $output->writeln($messages);
  31979. $message = $question->getPrompt();
  31980. }
  31981. $output->write($message);
  31982. }
  31983. protected function writeError(OutputInterface $output, \Exception $error)
  31984. {
  31985. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  31986. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  31987. } else {
  31988. $message = '<error>'.$error->getMessage().'</error>';
  31989. }
  31990. $output->writeln($message);
  31991. }
  31992. private function autocomplete(OutputInterface $output, Question $question, $inputStream)
  31993. {
  31994. $autocomplete = $question->getAutocompleterValues();
  31995. $ret = '';
  31996. $i = 0;
  31997. $ofs = -1;
  31998. $matches = $autocomplete;
  31999. $numMatches = count($matches);
  32000. $sttyMode = shell_exec('stty -g');
  32001. shell_exec('stty -icanon -echo');
  32002. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  32003. while (!feof($inputStream)) {
  32004. $c = fread($inputStream, 1);
  32005. if ("\177" === $c) {
  32006. if (0 === $numMatches && 0 !== $i) {
  32007. --$i;
  32008. $output->write("\033[1D");
  32009. }
  32010. if ($i === 0) {
  32011. $ofs = -1;
  32012. $matches = $autocomplete;
  32013. $numMatches = count($matches);
  32014. } else {
  32015. $numMatches = 0;
  32016. }
  32017. $ret = substr($ret, 0, $i);
  32018. } elseif ("\033" === $c) {
  32019. $c .= fread($inputStream, 2);
  32020. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  32021. if ('A' === $c[2] && -1 === $ofs) {
  32022. $ofs = 0;
  32023. }
  32024. if (0 === $numMatches) {
  32025. continue;
  32026. }
  32027. $ofs += ('A' === $c[2]) ? -1 : 1;
  32028. $ofs = ($numMatches + $ofs) % $numMatches;
  32029. }
  32030. } elseif (ord($c) < 32) {
  32031. if ("\t" === $c || "\n" === $c) {
  32032. if ($numMatches > 0 && -1 !== $ofs) {
  32033. $ret = $matches[$ofs];
  32034. $output->write(substr($ret, $i));
  32035. $i = strlen($ret);
  32036. }
  32037. if ("\n" === $c) {
  32038. $output->write($c);
  32039. break;
  32040. }
  32041. $numMatches = 0;
  32042. }
  32043. continue;
  32044. } else {
  32045. $output->write($c);
  32046. $ret .= $c;
  32047. ++$i;
  32048. $numMatches = 0;
  32049. $ofs = 0;
  32050. foreach ($autocomplete as $value) {
  32051. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  32052. $matches[$numMatches++] = $value;
  32053. }
  32054. }
  32055. }
  32056. $output->write("\033[K");
  32057. if ($numMatches > 0 && -1 !== $ofs) {
  32058. $output->write("\0337");
  32059. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  32060. $output->write("\0338");
  32061. }
  32062. }
  32063. shell_exec(sprintf('stty %s', $sttyMode));
  32064. return $ret;
  32065. }
  32066. private function getHiddenResponse(OutputInterface $output, $inputStream)
  32067. {
  32068. if ('\\' === DIRECTORY_SEPARATOR) {
  32069. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  32070. if ('phar:' === substr(__FILE__, 0, 5)) {
  32071. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  32072. copy($exe, $tmpExe);
  32073. $exe = $tmpExe;
  32074. }
  32075. $value = rtrim(shell_exec($exe));
  32076. $output->writeln('');
  32077. if (isset($tmpExe)) {
  32078. unlink($tmpExe);
  32079. }
  32080. return $value;
  32081. }
  32082. if ($this->hasSttyAvailable()) {
  32083. $sttyMode = shell_exec('stty -g');
  32084. shell_exec('stty -echo');
  32085. $value = fgets($inputStream, 4096);
  32086. shell_exec(sprintf('stty %s', $sttyMode));
  32087. if (false === $value) {
  32088. throw new RuntimeException('Aborted');
  32089. }
  32090. $value = trim($value);
  32091. $output->writeln('');
  32092. return $value;
  32093. }
  32094. if (false !== $shell = $this->getShell()) {
  32095. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  32096. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  32097. $value = rtrim(shell_exec($command));
  32098. $output->writeln('');
  32099. return $value;
  32100. }
  32101. throw new RuntimeException('Unable to hide the response.');
  32102. }
  32103. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  32104. {
  32105. $error = null;
  32106. $attempts = $question->getMaxAttempts();
  32107. while (null === $attempts || $attempts--) {
  32108. if (null !== $error) {
  32109. $this->writeError($output, $error);
  32110. }
  32111. try {
  32112. return call_user_func($question->getValidator(), $interviewer());
  32113. } catch (RuntimeException $e) {
  32114. throw $e;
  32115. } catch (\Exception $error) {
  32116. }
  32117. }
  32118. throw $error;
  32119. }
  32120. private function getShell()
  32121. {
  32122. if (null !== self::$shell) {
  32123. return self::$shell;
  32124. }
  32125. self::$shell = false;
  32126. if (file_exists('/usr/bin/env')) {
  32127. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  32128. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  32129. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  32130. self::$shell = $sh;
  32131. break;
  32132. }
  32133. }
  32134. }
  32135. return self::$shell;
  32136. }
  32137. private function hasSttyAvailable()
  32138. {
  32139. if (null !== self::$stty) {
  32140. return self::$stty;
  32141. }
  32142. exec('stty 2>&1', $output, $exitcode);
  32143. return self::$stty = $exitcode === 0;
  32144. }
  32145. }
  32146. <?php
  32147. namespace Symfony\Component\Console\Helper;
  32148. use Symfony\Component\Console\Exception\LogicException;
  32149. use Symfony\Component\Console\Input\InputInterface;
  32150. use Symfony\Component\Console\Output\OutputInterface;
  32151. use Symfony\Component\Console\Question\ChoiceQuestion;
  32152. use Symfony\Component\Console\Question\ConfirmationQuestion;
  32153. use Symfony\Component\Console\Question\Question;
  32154. use Symfony\Component\Console\Style\SymfonyStyle;
  32155. use Symfony\Component\Console\Formatter\OutputFormatter;
  32156. class SymfonyQuestionHelper extends QuestionHelper
  32157. {
  32158. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  32159. {
  32160. $validator = $question->getValidator();
  32161. $question->setValidator(function ($value) use ($validator) {
  32162. if (null !== $validator) {
  32163. $value = $validator($value);
  32164. } else {
  32165. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  32166. throw new LogicException('A value is required.');
  32167. }
  32168. }
  32169. return $value;
  32170. });
  32171. return parent::ask($input, $output, $question);
  32172. }
  32173. protected function writePrompt(OutputInterface $output, Question $question)
  32174. {
  32175. $text = OutputFormatter::escape($question->getQuestion());
  32176. $default = $question->getDefault();
  32177. switch (true) {
  32178. case null === $default:
  32179. $text = sprintf(' <info>%s</info>:', $text);
  32180. break;
  32181. case $question instanceof ConfirmationQuestion:
  32182. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  32183. break;
  32184. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  32185. $choices = $question->getChoices();
  32186. $default = explode(',', $default);
  32187. foreach ($default as $key => $value) {
  32188. $default[$key] = $choices[trim($value)];
  32189. }
  32190. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  32191. break;
  32192. case $question instanceof ChoiceQuestion:
  32193. $choices = $question->getChoices();
  32194. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  32195. break;
  32196. default:
  32197. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  32198. }
  32199. $output->writeln($text);
  32200. if ($question instanceof ChoiceQuestion) {
  32201. $width = max(array_map('strlen', array_keys($question->getChoices())));
  32202. foreach ($question->getChoices() as $key => $value) {
  32203. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  32204. }
  32205. }
  32206. $output->write(' > ');
  32207. }
  32208. protected function writeError(OutputInterface $output, \Exception $error)
  32209. {
  32210. if ($output instanceof SymfonyStyle) {
  32211. $output->newLine();
  32212. $output->error($error->getMessage());
  32213. return;
  32214. }
  32215. parent::writeError($output, $error);
  32216. }
  32217. }
  32218. <?php
  32219. namespace Symfony\Component\Console\Helper;
  32220. use Symfony\Component\Console\Output\OutputInterface;
  32221. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32222. class Table
  32223. {
  32224. private $headers = array();
  32225. private $rows = array();
  32226. private $columnWidths = array();
  32227. private $numberOfColumns;
  32228. private $output;
  32229. private $style;
  32230. private $columnStyles = array();
  32231. private static $styles;
  32232. public function __construct(OutputInterface $output)
  32233. {
  32234. $this->output = $output;
  32235. if (!self::$styles) {
  32236. self::$styles = self::initStyles();
  32237. }
  32238. $this->setStyle('default');
  32239. }
  32240. public static function setStyleDefinition($name, TableStyle $style)
  32241. {
  32242. if (!self::$styles) {
  32243. self::$styles = self::initStyles();
  32244. }
  32245. self::$styles[$name] = $style;
  32246. }
  32247. public static function getStyleDefinition($name)
  32248. {
  32249. if (!self::$styles) {
  32250. self::$styles = self::initStyles();
  32251. }
  32252. if (isset(self::$styles[$name])) {
  32253. return self::$styles[$name];
  32254. }
  32255. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  32256. }
  32257. public function setStyle($name)
  32258. {
  32259. $this->style = $this->resolveStyle($name);
  32260. return $this;
  32261. }
  32262. public function getStyle()
  32263. {
  32264. return $this->style;
  32265. }
  32266. public function setColumnStyle($columnIndex, $name)
  32267. {
  32268. $columnIndex = intval($columnIndex);
  32269. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  32270. return $this;
  32271. }
  32272. public function getColumnStyle($columnIndex)
  32273. {
  32274. if (isset($this->columnStyles[$columnIndex])) {
  32275. return $this->columnStyles[$columnIndex];
  32276. }
  32277. return $this->getStyle();
  32278. }
  32279. public function setHeaders(array $headers)
  32280. {
  32281. $headers = array_values($headers);
  32282. if (!empty($headers) && !is_array($headers[0])) {
  32283. $headers = array($headers);
  32284. }
  32285. $this->headers = $headers;
  32286. return $this;
  32287. }
  32288. public function setRows(array $rows)
  32289. {
  32290. $this->rows = array();
  32291. return $this->addRows($rows);
  32292. }
  32293. public function addRows(array $rows)
  32294. {
  32295. foreach ($rows as $row) {
  32296. $this->addRow($row);
  32297. }
  32298. return $this;
  32299. }
  32300. public function addRow($row)
  32301. {
  32302. if ($row instanceof TableSeparator) {
  32303. $this->rows[] = $row;
  32304. return $this;
  32305. }
  32306. if (!is_array($row)) {
  32307. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  32308. }
  32309. $this->rows[] = array_values($row);
  32310. return $this;
  32311. }
  32312. public function setRow($column, array $row)
  32313. {
  32314. $this->rows[$column] = $row;
  32315. return $this;
  32316. }
  32317. public function render()
  32318. {
  32319. $this->calculateNumberOfColumns();
  32320. $rows = $this->buildTableRows($this->rows);
  32321. $headers = $this->buildTableRows($this->headers);
  32322. $this->calculateColumnsWidth(array_merge($headers, $rows));
  32323. $this->renderRowSeparator();
  32324. if (!empty($headers)) {
  32325. foreach ($headers as $header) {
  32326. $this->renderRow($header, $this->style->getCellHeaderFormat());
  32327. $this->renderRowSeparator();
  32328. }
  32329. }
  32330. foreach ($rows as $row) {
  32331. if ($row instanceof TableSeparator) {
  32332. $this->renderRowSeparator();
  32333. } else {
  32334. $this->renderRow($row, $this->style->getCellRowFormat());
  32335. }
  32336. }
  32337. if (!empty($rows)) {
  32338. $this->renderRowSeparator();
  32339. }
  32340. $this->cleanup();
  32341. }
  32342. private function renderRowSeparator()
  32343. {
  32344. if (0 === $count = $this->numberOfColumns) {
  32345. return;
  32346. }
  32347. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  32348. return;
  32349. }
  32350. $markup = $this->style->getCrossingChar();
  32351. for ($column = 0; $column < $count; ++$column) {
  32352. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  32353. }
  32354. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  32355. }
  32356. private function renderColumnSeparator()
  32357. {
  32358. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  32359. }
  32360. private function renderRow(array $row, $cellFormat)
  32361. {
  32362. if (empty($row)) {
  32363. return;
  32364. }
  32365. $rowContent = $this->renderColumnSeparator();
  32366. foreach ($this->getRowColumns($row) as $column) {
  32367. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  32368. $rowContent .= $this->renderColumnSeparator();
  32369. }
  32370. $this->output->writeln($rowContent);
  32371. }
  32372. private function renderCell(array $row, $column, $cellFormat)
  32373. {
  32374. $cell = isset($row[$column]) ? $row[$column] : '';
  32375. $width = $this->columnWidths[$column];
  32376. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  32377. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  32378. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  32379. }
  32380. }
  32381. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  32382. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  32383. }
  32384. $style = $this->getColumnStyle($column);
  32385. if ($cell instanceof TableSeparator) {
  32386. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  32387. }
  32388. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  32389. $content = sprintf($style->getCellRowContentFormat(), $cell);
  32390. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  32391. }
  32392. private function calculateNumberOfColumns()
  32393. {
  32394. if (null !== $this->numberOfColumns) {
  32395. return;
  32396. }
  32397. $columns = array(0);
  32398. foreach (array_merge($this->headers, $this->rows) as $row) {
  32399. if ($row instanceof TableSeparator) {
  32400. continue;
  32401. }
  32402. $columns[] = $this->getNumberOfColumns($row);
  32403. }
  32404. $this->numberOfColumns = max($columns);
  32405. }
  32406. private function buildTableRows($rows)
  32407. {
  32408. $unmergedRows = array();
  32409. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  32410. $rows = $this->fillNextRows($rows, $rowKey);
  32411. foreach ($rows[$rowKey] as $column => $cell) {
  32412. if (!strstr($cell, "\n")) {
  32413. continue;
  32414. }
  32415. $lines = explode("\n", $cell);
  32416. foreach ($lines as $lineKey => $line) {
  32417. if ($cell instanceof TableCell) {
  32418. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  32419. }
  32420. if (0 === $lineKey) {
  32421. $rows[$rowKey][$column] = $line;
  32422. } else {
  32423. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  32424. }
  32425. }
  32426. }
  32427. }
  32428. $tableRows = array();
  32429. foreach ($rows as $rowKey => $row) {
  32430. $tableRows[] = $this->fillCells($row);
  32431. if (isset($unmergedRows[$rowKey])) {
  32432. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  32433. }
  32434. }
  32435. return $tableRows;
  32436. }
  32437. private function fillNextRows($rows, $line)
  32438. {
  32439. $unmergedRows = array();
  32440. foreach ($rows[$line] as $column => $cell) {
  32441. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  32442. $nbLines = $cell->getRowspan() - 1;
  32443. $lines = array($cell);
  32444. if (strstr($cell, "\n")) {
  32445. $lines = explode("\n", $cell);
  32446. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  32447. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  32448. unset($lines[0]);
  32449. }
  32450. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  32451. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  32452. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  32453. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  32454. }
  32455. }
  32456. }
  32457. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  32458. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  32459. foreach ($unmergedRow as $cellKey => $cell) {
  32460. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  32461. }
  32462. } else {
  32463. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  32464. foreach ($unmergedRow as $column => $cell) {
  32465. if (!empty($cell)) {
  32466. $row[$column] = $unmergedRow[$column];
  32467. }
  32468. }
  32469. array_splice($rows, $unmergedRowKey, 0, array($row));
  32470. }
  32471. }
  32472. return $rows;
  32473. }
  32474. private function fillCells($row)
  32475. {
  32476. $newRow = array();
  32477. foreach ($row as $column => $cell) {
  32478. $newRow[] = $cell;
  32479. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  32480. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  32481. $newRow[] = '';
  32482. }
  32483. }
  32484. }
  32485. return $newRow ?: $row;
  32486. }
  32487. private function copyRow($rows, $line)
  32488. {
  32489. $row = $rows[$line];
  32490. foreach ($row as $cellKey => $cellValue) {
  32491. $row[$cellKey] = '';
  32492. if ($cellValue instanceof TableCell) {
  32493. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  32494. }
  32495. }
  32496. return $row;
  32497. }
  32498. private function getNumberOfColumns(array $row)
  32499. {
  32500. $columns = count($row);
  32501. foreach ($row as $column) {
  32502. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  32503. }
  32504. return $columns;
  32505. }
  32506. private function getRowColumns($row)
  32507. {
  32508. $columns = range(0, $this->numberOfColumns - 1);
  32509. foreach ($row as $cellKey => $cell) {
  32510. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  32511. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  32512. }
  32513. }
  32514. return $columns;
  32515. }
  32516. private function calculateColumnsWidth($rows)
  32517. {
  32518. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  32519. $lengths = array();
  32520. foreach ($rows as $row) {
  32521. if ($row instanceof TableSeparator) {
  32522. continue;
  32523. }
  32524. foreach ($row as $i => $cell) {
  32525. if ($cell instanceof TableCell) {
  32526. $textLength = strlen($cell);
  32527. if ($textLength > 0) {
  32528. $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan()));
  32529. foreach ($contentColumns as $position => $content) {
  32530. $row[$i + $position] = $content;
  32531. }
  32532. }
  32533. }
  32534. }
  32535. $lengths[] = $this->getCellWidth($row, $column);
  32536. }
  32537. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  32538. }
  32539. }
  32540. private function getColumnSeparatorWidth()
  32541. {
  32542. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  32543. }
  32544. private function getCellWidth(array $row, $column)
  32545. {
  32546. if (isset($row[$column])) {
  32547. $cell = $row[$column];
  32548. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  32549. return $cellWidth;
  32550. }
  32551. return 0;
  32552. }
  32553. private function cleanup()
  32554. {
  32555. $this->columnWidths = array();
  32556. $this->numberOfColumns = null;
  32557. }
  32558. private static function initStyles()
  32559. {
  32560. $borderless = new TableStyle();
  32561. $borderless
  32562. ->setHorizontalBorderChar('=')
  32563. ->setVerticalBorderChar(' ')
  32564. ->setCrossingChar(' ')
  32565. ;
  32566. $compact = new TableStyle();
  32567. $compact
  32568. ->setHorizontalBorderChar('')
  32569. ->setVerticalBorderChar(' ')
  32570. ->setCrossingChar('')
  32571. ->setCellRowContentFormat('%s')
  32572. ;
  32573. $styleGuide = new TableStyle();
  32574. $styleGuide
  32575. ->setHorizontalBorderChar('-')
  32576. ->setVerticalBorderChar(' ')
  32577. ->setCrossingChar(' ')
  32578. ->setCellHeaderFormat('%s')
  32579. ;
  32580. return array(
  32581. 'default' => new TableStyle(),
  32582. 'borderless' => $borderless,
  32583. 'compact' => $compact,
  32584. 'symfony-style-guide' => $styleGuide,
  32585. );
  32586. }
  32587. private function resolveStyle($name)
  32588. {
  32589. if ($name instanceof TableStyle) {
  32590. return $name;
  32591. }
  32592. if (isset(self::$styles[$name])) {
  32593. return self::$styles[$name];
  32594. }
  32595. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  32596. }
  32597. }
  32598. <?php
  32599. namespace Symfony\Component\Console\Helper;
  32600. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32601. class TableCell
  32602. {
  32603. private $value;
  32604. private $options = array(
  32605. 'rowspan' => 1,
  32606. 'colspan' => 1,
  32607. );
  32608. public function __construct($value = '', array $options = array())
  32609. {
  32610. $this->value = $value;
  32611. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  32612. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  32613. }
  32614. $this->options = array_merge($this->options, $options);
  32615. }
  32616. public function __toString()
  32617. {
  32618. return $this->value;
  32619. }
  32620. public function getColspan()
  32621. {
  32622. return (int) $this->options['colspan'];
  32623. }
  32624. public function getRowspan()
  32625. {
  32626. return (int) $this->options['rowspan'];
  32627. }
  32628. }
  32629. <?php
  32630. namespace Symfony\Component\Console\Helper;
  32631. use Symfony\Component\Console\Output\OutputInterface;
  32632. use Symfony\Component\Console\Output\NullOutput;
  32633. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32634. class TableHelper extends Helper
  32635. {
  32636. const LAYOUT_DEFAULT = 0;
  32637. const LAYOUT_BORDERLESS = 1;
  32638. const LAYOUT_COMPACT = 2;
  32639. private $table;
  32640. public function __construct($triggerDeprecationError = true)
  32641. {
  32642. if ($triggerDeprecationError) {
  32643. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  32644. }
  32645. $this->table = new Table(new NullOutput());
  32646. }
  32647. public function setLayout($layout)
  32648. {
  32649. switch ($layout) {
  32650. case self::LAYOUT_BORDERLESS:
  32651. $this->table->setStyle('borderless');
  32652. break;
  32653. case self::LAYOUT_COMPACT:
  32654. $this->table->setStyle('compact');
  32655. break;
  32656. case self::LAYOUT_DEFAULT:
  32657. $this->table->setStyle('default');
  32658. break;
  32659. default:
  32660. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  32661. }
  32662. return $this;
  32663. }
  32664. public function setHeaders(array $headers)
  32665. {
  32666. $this->table->setHeaders($headers);
  32667. return $this;
  32668. }
  32669. public function setRows(array $rows)
  32670. {
  32671. $this->table->setRows($rows);
  32672. return $this;
  32673. }
  32674. public function addRows(array $rows)
  32675. {
  32676. $this->table->addRows($rows);
  32677. return $this;
  32678. }
  32679. public function addRow(array $row)
  32680. {
  32681. $this->table->addRow($row);
  32682. return $this;
  32683. }
  32684. public function setRow($column, array $row)
  32685. {
  32686. $this->table->setRow($column, $row);
  32687. return $this;
  32688. }
  32689. public function setPaddingChar($paddingChar)
  32690. {
  32691. $this->table->getStyle()->setPaddingChar($paddingChar);
  32692. return $this;
  32693. }
  32694. public function setHorizontalBorderChar($horizontalBorderChar)
  32695. {
  32696. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  32697. return $this;
  32698. }
  32699. public function setVerticalBorderChar($verticalBorderChar)
  32700. {
  32701. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  32702. return $this;
  32703. }
  32704. public function setCrossingChar($crossingChar)
  32705. {
  32706. $this->table->getStyle()->setCrossingChar($crossingChar);
  32707. return $this;
  32708. }
  32709. public function setCellHeaderFormat($cellHeaderFormat)
  32710. {
  32711. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  32712. return $this;
  32713. }
  32714. public function setCellRowFormat($cellRowFormat)
  32715. {
  32716. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  32717. return $this;
  32718. }
  32719. public function setCellRowContentFormat($cellRowContentFormat)
  32720. {
  32721. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  32722. return $this;
  32723. }
  32724. public function setBorderFormat($borderFormat)
  32725. {
  32726. $this->table->getStyle()->setBorderFormat($borderFormat);
  32727. return $this;
  32728. }
  32729. public function setPadType($padType)
  32730. {
  32731. $this->table->getStyle()->setPadType($padType);
  32732. return $this;
  32733. }
  32734. public function render(OutputInterface $output)
  32735. {
  32736. $p = new \ReflectionProperty($this->table, 'output');
  32737. $p->setAccessible(true);
  32738. $p->setValue($this->table, $output);
  32739. $this->table->render();
  32740. }
  32741. public function getName()
  32742. {
  32743. return 'table';
  32744. }
  32745. }
  32746. <?php
  32747. namespace Symfony\Component\Console\Helper;
  32748. class TableSeparator extends TableCell
  32749. {
  32750. public function __construct(array $options = array())
  32751. {
  32752. parent::__construct('', $options);
  32753. }
  32754. }
  32755. <?php
  32756. namespace Symfony\Component\Console\Helper;
  32757. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32758. use Symfony\Component\Console\Exception\LogicException;
  32759. class TableStyle
  32760. {
  32761. private $paddingChar = ' ';
  32762. private $horizontalBorderChar = '-';
  32763. private $verticalBorderChar = '|';
  32764. private $crossingChar = '+';
  32765. private $cellHeaderFormat = '<info>%s</info>';
  32766. private $cellRowFormat = '%s';
  32767. private $cellRowContentFormat = ' %s ';
  32768. private $borderFormat = '%s';
  32769. private $padType = STR_PAD_RIGHT;
  32770. public function setPaddingChar($paddingChar)
  32771. {
  32772. if (!$paddingChar) {
  32773. throw new LogicException('The padding char must not be empty');
  32774. }
  32775. $this->paddingChar = $paddingChar;
  32776. return $this;
  32777. }
  32778. public function getPaddingChar()
  32779. {
  32780. return $this->paddingChar;
  32781. }
  32782. public function setHorizontalBorderChar($horizontalBorderChar)
  32783. {
  32784. $this->horizontalBorderChar = $horizontalBorderChar;
  32785. return $this;
  32786. }
  32787. public function getHorizontalBorderChar()
  32788. {
  32789. return $this->horizontalBorderChar;
  32790. }
  32791. public function setVerticalBorderChar($verticalBorderChar)
  32792. {
  32793. $this->verticalBorderChar = $verticalBorderChar;
  32794. return $this;
  32795. }
  32796. public function getVerticalBorderChar()
  32797. {
  32798. return $this->verticalBorderChar;
  32799. }
  32800. public function setCrossingChar($crossingChar)
  32801. {
  32802. $this->crossingChar = $crossingChar;
  32803. return $this;
  32804. }
  32805. public function getCrossingChar()
  32806. {
  32807. return $this->crossingChar;
  32808. }
  32809. public function setCellHeaderFormat($cellHeaderFormat)
  32810. {
  32811. $this->cellHeaderFormat = $cellHeaderFormat;
  32812. return $this;
  32813. }
  32814. public function getCellHeaderFormat()
  32815. {
  32816. return $this->cellHeaderFormat;
  32817. }
  32818. public function setCellRowFormat($cellRowFormat)
  32819. {
  32820. $this->cellRowFormat = $cellRowFormat;
  32821. return $this;
  32822. }
  32823. public function getCellRowFormat()
  32824. {
  32825. return $this->cellRowFormat;
  32826. }
  32827. public function setCellRowContentFormat($cellRowContentFormat)
  32828. {
  32829. $this->cellRowContentFormat = $cellRowContentFormat;
  32830. return $this;
  32831. }
  32832. public function getCellRowContentFormat()
  32833. {
  32834. return $this->cellRowContentFormat;
  32835. }
  32836. public function setBorderFormat($borderFormat)
  32837. {
  32838. $this->borderFormat = $borderFormat;
  32839. return $this;
  32840. }
  32841. public function getBorderFormat()
  32842. {
  32843. return $this->borderFormat;
  32844. }
  32845. public function setPadType($padType)
  32846. {
  32847. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  32848. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  32849. }
  32850. $this->padType = $padType;
  32851. return $this;
  32852. }
  32853. public function getPadType()
  32854. {
  32855. return $this->padType;
  32856. }
  32857. }
  32858. <?php
  32859. namespace Symfony\Component\Console\Input;
  32860. use Symfony\Component\Console\Exception\RuntimeException;
  32861. class ArgvInput extends Input
  32862. {
  32863. private $tokens;
  32864. private $parsed;
  32865. public function __construct(array $argv = null, InputDefinition $definition = null)
  32866. {
  32867. if (null === $argv) {
  32868. $argv = $_SERVER['argv'];
  32869. }
  32870. array_shift($argv);
  32871. $this->tokens = $argv;
  32872. parent::__construct($definition);
  32873. }
  32874. protected function setTokens(array $tokens)
  32875. {
  32876. $this->tokens = $tokens;
  32877. }
  32878. protected function parse()
  32879. {
  32880. $parseOptions = true;
  32881. $this->parsed = $this->tokens;
  32882. while (null !== $token = array_shift($this->parsed)) {
  32883. if ($parseOptions && '' == $token) {
  32884. $this->parseArgument($token);
  32885. } elseif ($parseOptions && '--' == $token) {
  32886. $parseOptions = false;
  32887. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  32888. $this->parseLongOption($token);
  32889. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  32890. $this->parseShortOption($token);
  32891. } else {
  32892. $this->parseArgument($token);
  32893. }
  32894. }
  32895. }
  32896. private function parseShortOption($token)
  32897. {
  32898. $name = substr($token, 1);
  32899. if (strlen($name) > 1) {
  32900. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  32901. $this->addShortOption($name[0], substr($name, 1));
  32902. } else {
  32903. $this->parseShortOptionSet($name);
  32904. }
  32905. } else {
  32906. $this->addShortOption($name, null);
  32907. }
  32908. }
  32909. private function parseShortOptionSet($name)
  32910. {
  32911. $len = strlen($name);
  32912. for ($i = 0; $i < $len; ++$i) {
  32913. if (!$this->definition->hasShortcut($name[$i])) {
  32914. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  32915. }
  32916. $option = $this->definition->getOptionForShortcut($name[$i]);
  32917. if ($option->acceptValue()) {
  32918. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  32919. break;
  32920. } else {
  32921. $this->addLongOption($option->getName(), null);
  32922. }
  32923. }
  32924. }
  32925. private function parseLongOption($token)
  32926. {
  32927. $name = substr($token, 2);
  32928. if (false !== $pos = strpos($name, '=')) {
  32929. if (0 === strlen($value = substr($name, $pos + 1))) {
  32930. array_unshift($this->parsed, null);
  32931. }
  32932. $this->addLongOption(substr($name, 0, $pos), $value);
  32933. } else {
  32934. $this->addLongOption($name, null);
  32935. }
  32936. }
  32937. private function parseArgument($token)
  32938. {
  32939. $c = count($this->arguments);
  32940. if ($this->definition->hasArgument($c)) {
  32941. $arg = $this->definition->getArgument($c);
  32942. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  32943. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  32944. $arg = $this->definition->getArgument($c - 1);
  32945. $this->arguments[$arg->getName()][] = $token;
  32946. } else {
  32947. $all = $this->definition->getArguments();
  32948. if (count($all)) {
  32949. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  32950. }
  32951. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  32952. }
  32953. }
  32954. private function addShortOption($shortcut, $value)
  32955. {
  32956. if (!$this->definition->hasShortcut($shortcut)) {
  32957. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  32958. }
  32959. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  32960. }
  32961. private function addLongOption($name, $value)
  32962. {
  32963. if (!$this->definition->hasOption($name)) {
  32964. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  32965. }
  32966. $option = $this->definition->getOption($name);
  32967. if (!isset($value[0])) {
  32968. $value = null;
  32969. }
  32970. if (null !== $value && !$option->acceptValue()) {
  32971. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  32972. }
  32973. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  32974. $next = array_shift($this->parsed);
  32975. if (isset($next[0]) && '-' !== $next[0]) {
  32976. $value = $next;
  32977. } elseif (empty($next)) {
  32978. $value = null;
  32979. } else {
  32980. array_unshift($this->parsed, $next);
  32981. }
  32982. }
  32983. if (null === $value) {
  32984. if ($option->isValueRequired()) {
  32985. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  32986. }
  32987. if (!$option->isArray()) {
  32988. $value = $option->isValueOptional() ? $option->getDefault() : true;
  32989. }
  32990. }
  32991. if ($option->isArray()) {
  32992. $this->options[$name][] = $value;
  32993. } else {
  32994. $this->options[$name] = $value;
  32995. }
  32996. }
  32997. public function getFirstArgument()
  32998. {
  32999. foreach ($this->tokens as $token) {
  33000. if ($token && '-' === $token[0]) {
  33001. continue;
  33002. }
  33003. return $token;
  33004. }
  33005. }
  33006. public function hasParameterOption($values)
  33007. {
  33008. $values = (array) $values;
  33009. foreach ($this->tokens as $token) {
  33010. foreach ($values as $value) {
  33011. if ($token === $value || 0 === strpos($token, $value.'=')) {
  33012. return true;
  33013. }
  33014. }
  33015. }
  33016. return false;
  33017. }
  33018. public function getParameterOption($values, $default = false)
  33019. {
  33020. $values = (array) $values;
  33021. $tokens = $this->tokens;
  33022. while (0 < count($tokens)) {
  33023. $token = array_shift($tokens);
  33024. foreach ($values as $value) {
  33025. if ($token === $value || 0 === strpos($token, $value.'=')) {
  33026. if (false !== $pos = strpos($token, '=')) {
  33027. return substr($token, $pos + 1);
  33028. }
  33029. return array_shift($tokens);
  33030. }
  33031. }
  33032. }
  33033. return $default;
  33034. }
  33035. public function __toString()
  33036. {
  33037. $self = $this;
  33038. $tokens = array_map(function ($token) use ($self) {
  33039. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  33040. return $match[1].$self->escapeToken($match[2]);
  33041. }
  33042. if ($token && $token[0] !== '-') {
  33043. return $self->escapeToken($token);
  33044. }
  33045. return $token;
  33046. }, $this->tokens);
  33047. return implode(' ', $tokens);
  33048. }
  33049. }
  33050. <?php
  33051. namespace Symfony\Component\Console\Input;
  33052. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33053. use Symfony\Component\Console\Exception\InvalidOptionException;
  33054. class ArrayInput extends Input
  33055. {
  33056. private $parameters;
  33057. public function __construct(array $parameters, InputDefinition $definition = null)
  33058. {
  33059. $this->parameters = $parameters;
  33060. parent::__construct($definition);
  33061. }
  33062. public function getFirstArgument()
  33063. {
  33064. foreach ($this->parameters as $key => $value) {
  33065. if ($key && '-' === $key[0]) {
  33066. continue;
  33067. }
  33068. return $value;
  33069. }
  33070. }
  33071. public function hasParameterOption($values)
  33072. {
  33073. $values = (array) $values;
  33074. foreach ($this->parameters as $k => $v) {
  33075. if (!is_int($k)) {
  33076. $v = $k;
  33077. }
  33078. if (in_array($v, $values)) {
  33079. return true;
  33080. }
  33081. }
  33082. return false;
  33083. }
  33084. public function getParameterOption($values, $default = false)
  33085. {
  33086. $values = (array) $values;
  33087. foreach ($this->parameters as $k => $v) {
  33088. if (is_int($k)) {
  33089. if (in_array($v, $values)) {
  33090. return true;
  33091. }
  33092. } elseif (in_array($k, $values)) {
  33093. return $v;
  33094. }
  33095. }
  33096. return $default;
  33097. }
  33098. public function __toString()
  33099. {
  33100. $params = array();
  33101. foreach ($this->parameters as $param => $val) {
  33102. if ($param && '-' === $param[0]) {
  33103. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  33104. } else {
  33105. $params[] = $this->escapeToken($val);
  33106. }
  33107. }
  33108. return implode(' ', $params);
  33109. }
  33110. protected function parse()
  33111. {
  33112. foreach ($this->parameters as $key => $value) {
  33113. if (0 === strpos($key, '--')) {
  33114. $this->addLongOption(substr($key, 2), $value);
  33115. } elseif ('-' === $key[0]) {
  33116. $this->addShortOption(substr($key, 1), $value);
  33117. } else {
  33118. $this->addArgument($key, $value);
  33119. }
  33120. }
  33121. }
  33122. private function addShortOption($shortcut, $value)
  33123. {
  33124. if (!$this->definition->hasShortcut($shortcut)) {
  33125. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  33126. }
  33127. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  33128. }
  33129. private function addLongOption($name, $value)
  33130. {
  33131. if (!$this->definition->hasOption($name)) {
  33132. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  33133. }
  33134. $option = $this->definition->getOption($name);
  33135. if (null === $value) {
  33136. if ($option->isValueRequired()) {
  33137. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  33138. }
  33139. $value = $option->isValueOptional() ? $option->getDefault() : true;
  33140. }
  33141. $this->options[$name] = $value;
  33142. }
  33143. private function addArgument($name, $value)
  33144. {
  33145. if (!$this->definition->hasArgument($name)) {
  33146. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  33147. }
  33148. $this->arguments[$name] = $value;
  33149. }
  33150. }
  33151. <?php
  33152. namespace Symfony\Component\Console\Input;
  33153. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33154. use Symfony\Component\Console\Exception\RuntimeException;
  33155. abstract class Input implements InputInterface
  33156. {
  33157. protected $definition;
  33158. protected $options = array();
  33159. protected $arguments = array();
  33160. protected $interactive = true;
  33161. public function __construct(InputDefinition $definition = null)
  33162. {
  33163. if (null === $definition) {
  33164. $this->definition = new InputDefinition();
  33165. } else {
  33166. $this->bind($definition);
  33167. $this->validate();
  33168. }
  33169. }
  33170. public function bind(InputDefinition $definition)
  33171. {
  33172. $this->arguments = array();
  33173. $this->options = array();
  33174. $this->definition = $definition;
  33175. $this->parse();
  33176. }
  33177. abstract protected function parse();
  33178. public function validate()
  33179. {
  33180. $definition = $this->definition;
  33181. $givenArguments = $this->arguments;
  33182. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  33183. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  33184. });
  33185. if (count($missingArguments) > 0) {
  33186. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  33187. }
  33188. }
  33189. public function isInteractive()
  33190. {
  33191. return $this->interactive;
  33192. }
  33193. public function setInteractive($interactive)
  33194. {
  33195. $this->interactive = (bool) $interactive;
  33196. }
  33197. public function getArguments()
  33198. {
  33199. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  33200. }
  33201. public function getArgument($name)
  33202. {
  33203. if (!$this->definition->hasArgument($name)) {
  33204. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  33205. }
  33206. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  33207. }
  33208. public function setArgument($name, $value)
  33209. {
  33210. if (!$this->definition->hasArgument($name)) {
  33211. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  33212. }
  33213. $this->arguments[$name] = $value;
  33214. }
  33215. public function hasArgument($name)
  33216. {
  33217. return $this->definition->hasArgument($name);
  33218. }
  33219. public function getOptions()
  33220. {
  33221. return array_merge($this->definition->getOptionDefaults(), $this->options);
  33222. }
  33223. public function getOption($name)
  33224. {
  33225. if (!$this->definition->hasOption($name)) {
  33226. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  33227. }
  33228. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  33229. }
  33230. public function setOption($name, $value)
  33231. {
  33232. if (!$this->definition->hasOption($name)) {
  33233. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  33234. }
  33235. $this->options[$name] = $value;
  33236. }
  33237. public function hasOption($name)
  33238. {
  33239. return $this->definition->hasOption($name);
  33240. }
  33241. public function escapeToken($token)
  33242. {
  33243. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  33244. }
  33245. }
  33246. <?php
  33247. namespace Symfony\Component\Console\Input;
  33248. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33249. use Symfony\Component\Console\Exception\LogicException;
  33250. class InputArgument
  33251. {
  33252. const REQUIRED = 1;
  33253. const OPTIONAL = 2;
  33254. const IS_ARRAY = 4;
  33255. private $name;
  33256. private $mode;
  33257. private $default;
  33258. private $description;
  33259. public function __construct($name, $mode = null, $description = '', $default = null)
  33260. {
  33261. if (null === $mode) {
  33262. $mode = self::OPTIONAL;
  33263. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  33264. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  33265. }
  33266. $this->name = $name;
  33267. $this->mode = $mode;
  33268. $this->description = $description;
  33269. $this->setDefault($default);
  33270. }
  33271. public function getName()
  33272. {
  33273. return $this->name;
  33274. }
  33275. public function isRequired()
  33276. {
  33277. return self::REQUIRED === (self::REQUIRED & $this->mode);
  33278. }
  33279. public function isArray()
  33280. {
  33281. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  33282. }
  33283. public function setDefault($default = null)
  33284. {
  33285. if (self::REQUIRED === $this->mode && null !== $default) {
  33286. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  33287. }
  33288. if ($this->isArray()) {
  33289. if (null === $default) {
  33290. $default = array();
  33291. } elseif (!is_array($default)) {
  33292. throw new LogicException('A default value for an array argument must be an array.');
  33293. }
  33294. }
  33295. $this->default = $default;
  33296. }
  33297. public function getDefault()
  33298. {
  33299. return $this->default;
  33300. }
  33301. public function getDescription()
  33302. {
  33303. return $this->description;
  33304. }
  33305. }
  33306. <?php
  33307. namespace Symfony\Component\Console\Input;
  33308. interface InputAwareInterface
  33309. {
  33310. public function setInput(InputInterface $input);
  33311. }
  33312. <?php
  33313. namespace Symfony\Component\Console\Input;
  33314. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33315. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33316. use Symfony\Component\Console\Output\BufferedOutput;
  33317. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33318. use Symfony\Component\Console\Exception\LogicException;
  33319. class InputDefinition
  33320. {
  33321. private $arguments;
  33322. private $requiredCount;
  33323. private $hasAnArrayArgument = false;
  33324. private $hasOptional;
  33325. private $options;
  33326. private $shortcuts;
  33327. public function __construct(array $definition = array())
  33328. {
  33329. $this->setDefinition($definition);
  33330. }
  33331. public function setDefinition(array $definition)
  33332. {
  33333. $arguments = array();
  33334. $options = array();
  33335. foreach ($definition as $item) {
  33336. if ($item instanceof InputOption) {
  33337. $options[] = $item;
  33338. } else {
  33339. $arguments[] = $item;
  33340. }
  33341. }
  33342. $this->setArguments($arguments);
  33343. $this->setOptions($options);
  33344. }
  33345. public function setArguments($arguments = array())
  33346. {
  33347. $this->arguments = array();
  33348. $this->requiredCount = 0;
  33349. $this->hasOptional = false;
  33350. $this->hasAnArrayArgument = false;
  33351. $this->addArguments($arguments);
  33352. }
  33353. public function addArguments($arguments = array())
  33354. {
  33355. if (null !== $arguments) {
  33356. foreach ($arguments as $argument) {
  33357. $this->addArgument($argument);
  33358. }
  33359. }
  33360. }
  33361. public function addArgument(InputArgument $argument)
  33362. {
  33363. if (isset($this->arguments[$argument->getName()])) {
  33364. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  33365. }
  33366. if ($this->hasAnArrayArgument) {
  33367. throw new LogicException('Cannot add an argument after an array argument.');
  33368. }
  33369. if ($argument->isRequired() && $this->hasOptional) {
  33370. throw new LogicException('Cannot add a required argument after an optional one.');
  33371. }
  33372. if ($argument->isArray()) {
  33373. $this->hasAnArrayArgument = true;
  33374. }
  33375. if ($argument->isRequired()) {
  33376. ++$this->requiredCount;
  33377. } else {
  33378. $this->hasOptional = true;
  33379. }
  33380. $this->arguments[$argument->getName()] = $argument;
  33381. }
  33382. public function getArgument($name)
  33383. {
  33384. if (!$this->hasArgument($name)) {
  33385. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  33386. }
  33387. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  33388. return $arguments[$name];
  33389. }
  33390. public function hasArgument($name)
  33391. {
  33392. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  33393. return isset($arguments[$name]);
  33394. }
  33395. public function getArguments()
  33396. {
  33397. return $this->arguments;
  33398. }
  33399. public function getArgumentCount()
  33400. {
  33401. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  33402. }
  33403. public function getArgumentRequiredCount()
  33404. {
  33405. return $this->requiredCount;
  33406. }
  33407. public function getArgumentDefaults()
  33408. {
  33409. $values = array();
  33410. foreach ($this->arguments as $argument) {
  33411. $values[$argument->getName()] = $argument->getDefault();
  33412. }
  33413. return $values;
  33414. }
  33415. public function setOptions($options = array())
  33416. {
  33417. $this->options = array();
  33418. $this->shortcuts = array();
  33419. $this->addOptions($options);
  33420. }
  33421. public function addOptions($options = array())
  33422. {
  33423. foreach ($options as $option) {
  33424. $this->addOption($option);
  33425. }
  33426. }
  33427. public function addOption(InputOption $option)
  33428. {
  33429. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  33430. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  33431. }
  33432. if ($option->getShortcut()) {
  33433. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  33434. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  33435. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  33436. }
  33437. }
  33438. }
  33439. $this->options[$option->getName()] = $option;
  33440. if ($option->getShortcut()) {
  33441. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  33442. $this->shortcuts[$shortcut] = $option->getName();
  33443. }
  33444. }
  33445. }
  33446. public function getOption($name)
  33447. {
  33448. if (!$this->hasOption($name)) {
  33449. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  33450. }
  33451. return $this->options[$name];
  33452. }
  33453. public function hasOption($name)
  33454. {
  33455. return isset($this->options[$name]);
  33456. }
  33457. public function getOptions()
  33458. {
  33459. return $this->options;
  33460. }
  33461. public function hasShortcut($name)
  33462. {
  33463. return isset($this->shortcuts[$name]);
  33464. }
  33465. public function getOptionForShortcut($shortcut)
  33466. {
  33467. return $this->getOption($this->shortcutToName($shortcut));
  33468. }
  33469. public function getOptionDefaults()
  33470. {
  33471. $values = array();
  33472. foreach ($this->options as $option) {
  33473. $values[$option->getName()] = $option->getDefault();
  33474. }
  33475. return $values;
  33476. }
  33477. private function shortcutToName($shortcut)
  33478. {
  33479. if (!isset($this->shortcuts[$shortcut])) {
  33480. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  33481. }
  33482. return $this->shortcuts[$shortcut];
  33483. }
  33484. public function getSynopsis($short = false)
  33485. {
  33486. $elements = array();
  33487. if ($short && $this->getOptions()) {
  33488. $elements[] = '[options]';
  33489. } elseif (!$short) {
  33490. foreach ($this->getOptions() as $option) {
  33491. $value = '';
  33492. if ($option->acceptValue()) {
  33493. $value = sprintf(
  33494. ' %s%s%s',
  33495. $option->isValueOptional() ? '[' : '',
  33496. strtoupper($option->getName()),
  33497. $option->isValueOptional() ? ']' : ''
  33498. );
  33499. }
  33500. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  33501. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  33502. }
  33503. }
  33504. if (count($elements) && $this->getArguments()) {
  33505. $elements[] = '[--]';
  33506. }
  33507. foreach ($this->getArguments() as $argument) {
  33508. $element = '<'.$argument->getName().'>';
  33509. if (!$argument->isRequired()) {
  33510. $element = '['.$element.']';
  33511. } elseif ($argument->isArray()) {
  33512. $element = $element.' ('.$element.')';
  33513. }
  33514. if ($argument->isArray()) {
  33515. $element .= '...';
  33516. }
  33517. $elements[] = $element;
  33518. }
  33519. return implode(' ', $elements);
  33520. }
  33521. public function asText()
  33522. {
  33523. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33524. $descriptor = new TextDescriptor();
  33525. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  33526. $descriptor->describe($output, $this, array('raw_output' => true));
  33527. return $output->fetch();
  33528. }
  33529. public function asXml($asDom = false)
  33530. {
  33531. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33532. $descriptor = new XmlDescriptor();
  33533. if ($asDom) {
  33534. return $descriptor->getInputDefinitionDocument($this);
  33535. }
  33536. $output = new BufferedOutput();
  33537. $descriptor->describe($output, $this);
  33538. return $output->fetch();
  33539. }
  33540. }
  33541. <?php
  33542. namespace Symfony\Component\Console\Input;
  33543. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33544. use Symfony\Component\Console\Exception\RuntimeException;
  33545. interface InputInterface
  33546. {
  33547. public function getFirstArgument();
  33548. public function hasParameterOption($values);
  33549. public function getParameterOption($values, $default = false);
  33550. public function bind(InputDefinition $definition);
  33551. public function validate();
  33552. public function getArguments();
  33553. public function getArgument($name);
  33554. public function setArgument($name, $value);
  33555. public function hasArgument($name);
  33556. public function getOptions();
  33557. public function getOption($name);
  33558. public function setOption($name, $value);
  33559. public function hasOption($name);
  33560. public function isInteractive();
  33561. public function setInteractive($interactive);
  33562. }
  33563. <?php
  33564. namespace Symfony\Component\Console\Input;
  33565. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33566. use Symfony\Component\Console\Exception\LogicException;
  33567. class InputOption
  33568. {
  33569. const VALUE_NONE = 1;
  33570. const VALUE_REQUIRED = 2;
  33571. const VALUE_OPTIONAL = 4;
  33572. const VALUE_IS_ARRAY = 8;
  33573. private $name;
  33574. private $shortcut;
  33575. private $mode;
  33576. private $default;
  33577. private $description;
  33578. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  33579. {
  33580. if (0 === strpos($name, '--')) {
  33581. $name = substr($name, 2);
  33582. }
  33583. if (empty($name)) {
  33584. throw new InvalidArgumentException('An option name cannot be empty.');
  33585. }
  33586. if (empty($shortcut)) {
  33587. $shortcut = null;
  33588. }
  33589. if (null !== $shortcut) {
  33590. if (is_array($shortcut)) {
  33591. $shortcut = implode('|', $shortcut);
  33592. }
  33593. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  33594. $shortcuts = array_filter($shortcuts);
  33595. $shortcut = implode('|', $shortcuts);
  33596. if (empty($shortcut)) {
  33597. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  33598. }
  33599. }
  33600. if (null === $mode) {
  33601. $mode = self::VALUE_NONE;
  33602. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  33603. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  33604. }
  33605. $this->name = $name;
  33606. $this->shortcut = $shortcut;
  33607. $this->mode = $mode;
  33608. $this->description = $description;
  33609. if ($this->isArray() && !$this->acceptValue()) {
  33610. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  33611. }
  33612. $this->setDefault($default);
  33613. }
  33614. public function getShortcut()
  33615. {
  33616. return $this->shortcut;
  33617. }
  33618. public function getName()
  33619. {
  33620. return $this->name;
  33621. }
  33622. public function acceptValue()
  33623. {
  33624. return $this->isValueRequired() || $this->isValueOptional();
  33625. }
  33626. public function isValueRequired()
  33627. {
  33628. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  33629. }
  33630. public function isValueOptional()
  33631. {
  33632. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  33633. }
  33634. public function isArray()
  33635. {
  33636. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  33637. }
  33638. public function setDefault($default = null)
  33639. {
  33640. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  33641. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  33642. }
  33643. if ($this->isArray()) {
  33644. if (null === $default) {
  33645. $default = array();
  33646. } elseif (!is_array($default)) {
  33647. throw new LogicException('A default value for an array option must be an array.');
  33648. }
  33649. }
  33650. $this->default = $this->acceptValue() ? $default : false;
  33651. }
  33652. public function getDefault()
  33653. {
  33654. return $this->default;
  33655. }
  33656. public function getDescription()
  33657. {
  33658. return $this->description;
  33659. }
  33660. public function equals(InputOption $option)
  33661. {
  33662. return $option->getName() === $this->getName()
  33663. && $option->getShortcut() === $this->getShortcut()
  33664. && $option->getDefault() === $this->getDefault()
  33665. && $option->isArray() === $this->isArray()
  33666. && $option->isValueRequired() === $this->isValueRequired()
  33667. && $option->isValueOptional() === $this->isValueOptional()
  33668. ;
  33669. }
  33670. }
  33671. <?php
  33672. namespace Symfony\Component\Console\Input;
  33673. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33674. class StringInput extends ArgvInput
  33675. {
  33676. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  33677. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  33678. public function __construct($input, InputDefinition $definition = null)
  33679. {
  33680. if ($definition) {
  33681. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  33682. }
  33683. parent::__construct(array(), null);
  33684. $this->setTokens($this->tokenize($input));
  33685. if (null !== $definition) {
  33686. $this->bind($definition);
  33687. }
  33688. }
  33689. private function tokenize($input)
  33690. {
  33691. $tokens = array();
  33692. $length = strlen($input);
  33693. $cursor = 0;
  33694. while ($cursor < $length) {
  33695. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  33696. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  33697. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  33698. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  33699. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  33700. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  33701. $tokens[] = stripcslashes($match[1]);
  33702. } else {
  33703. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  33704. }
  33705. $cursor += strlen($match[0]);
  33706. }
  33707. return $tokens;
  33708. }
  33709. }
  33710. Copyright (c) 2004-2016 Fabien Potencier
  33711. Permission is hereby granted, free of charge, to any person obtaining a copy
  33712. of this software and associated documentation files (the "Software"), to deal
  33713. in the Software without restriction, including without limitation the rights
  33714. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33715. copies of the Software, and to permit persons to whom the Software is furnished
  33716. to do so, subject to the following conditions:
  33717. The above copyright notice and this permission notice shall be included in all
  33718. copies or substantial portions of the Software.
  33719. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33720. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33721. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33722. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33723. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33724. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  33725. THE SOFTWARE.
  33726. <?php
  33727. namespace Symfony\Component\Console\Logger;
  33728. use Psr\Log\AbstractLogger;
  33729. use Psr\Log\InvalidArgumentException;
  33730. use Psr\Log\LogLevel;
  33731. use Symfony\Component\Console\Output\OutputInterface;
  33732. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33733. class ConsoleLogger extends AbstractLogger
  33734. {
  33735. const INFO = 'info';
  33736. const ERROR = 'error';
  33737. private $output;
  33738. private $verbosityLevelMap = array(
  33739. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  33740. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  33741. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  33742. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  33743. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  33744. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  33745. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  33746. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  33747. );
  33748. private $formatLevelMap = array(
  33749. LogLevel::EMERGENCY => self::ERROR,
  33750. LogLevel::ALERT => self::ERROR,
  33751. LogLevel::CRITICAL => self::ERROR,
  33752. LogLevel::ERROR => self::ERROR,
  33753. LogLevel::WARNING => self::INFO,
  33754. LogLevel::NOTICE => self::INFO,
  33755. LogLevel::INFO => self::INFO,
  33756. LogLevel::DEBUG => self::INFO,
  33757. );
  33758. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  33759. {
  33760. $this->output = $output;
  33761. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  33762. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  33763. }
  33764. public function log($level, $message, array $context = array())
  33765. {
  33766. if (!isset($this->verbosityLevelMap[$level])) {
  33767. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  33768. }
  33769. if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) {
  33770. $output = $this->output->getErrorOutput();
  33771. } else {
  33772. $output = $this->output;
  33773. }
  33774. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  33775. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  33776. }
  33777. }
  33778. private function interpolate($message, array $context)
  33779. {
  33780. $replace = array();
  33781. foreach ($context as $key => $val) {
  33782. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  33783. $replace[sprintf('{%s}', $key)] = $val;
  33784. }
  33785. }
  33786. return strtr($message, $replace);
  33787. }
  33788. }
  33789. <?php
  33790. namespace Symfony\Component\Console\Output;
  33791. class BufferedOutput extends Output
  33792. {
  33793. private $buffer = '';
  33794. public function fetch()
  33795. {
  33796. $content = $this->buffer;
  33797. $this->buffer = '';
  33798. return $content;
  33799. }
  33800. protected function doWrite($message, $newline)
  33801. {
  33802. $this->buffer .= $message;
  33803. if ($newline) {
  33804. $this->buffer .= "\n";
  33805. }
  33806. }
  33807. }
  33808. <?php
  33809. namespace Symfony\Component\Console\Output;
  33810. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33811. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  33812. {
  33813. private $stderr;
  33814. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  33815. {
  33816. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  33817. $actualDecorated = $this->isDecorated();
  33818. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  33819. if (null === $decorated) {
  33820. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  33821. }
  33822. }
  33823. public function setDecorated($decorated)
  33824. {
  33825. parent::setDecorated($decorated);
  33826. $this->stderr->setDecorated($decorated);
  33827. }
  33828. public function setFormatter(OutputFormatterInterface $formatter)
  33829. {
  33830. parent::setFormatter($formatter);
  33831. $this->stderr->setFormatter($formatter);
  33832. }
  33833. public function setVerbosity($level)
  33834. {
  33835. parent::setVerbosity($level);
  33836. $this->stderr->setVerbosity($level);
  33837. }
  33838. public function getErrorOutput()
  33839. {
  33840. return $this->stderr;
  33841. }
  33842. public function setErrorOutput(OutputInterface $error)
  33843. {
  33844. $this->stderr = $error;
  33845. }
  33846. protected function hasStdoutSupport()
  33847. {
  33848. return false === $this->isRunningOS400();
  33849. }
  33850. protected function hasStderrSupport()
  33851. {
  33852. return false === $this->isRunningOS400();
  33853. }
  33854. private function isRunningOS400()
  33855. {
  33856. $checks = array(
  33857. function_exists('php_uname') ? php_uname('s') : '',
  33858. getenv('OSTYPE'),
  33859. PHP_OS,
  33860. );
  33861. return false !== stripos(implode(';', $checks), 'OS400');
  33862. }
  33863. private function openOutputStream()
  33864. {
  33865. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  33866. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  33867. }
  33868. private function openErrorStream()
  33869. {
  33870. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  33871. return fopen($errorStream, 'w');
  33872. }
  33873. }
  33874. <?php
  33875. namespace Symfony\Component\Console\Output;
  33876. interface ConsoleOutputInterface extends OutputInterface
  33877. {
  33878. public function getErrorOutput();
  33879. public function setErrorOutput(OutputInterface $error);
  33880. }
  33881. <?php
  33882. namespace Symfony\Component\Console\Output;
  33883. use Symfony\Component\Console\Formatter\OutputFormatter;
  33884. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33885. class NullOutput implements OutputInterface
  33886. {
  33887. public function setFormatter(OutputFormatterInterface $formatter)
  33888. {
  33889. }
  33890. public function getFormatter()
  33891. {
  33892. return new OutputFormatter();
  33893. }
  33894. public function setDecorated($decorated)
  33895. {
  33896. }
  33897. public function isDecorated()
  33898. {
  33899. return false;
  33900. }
  33901. public function setVerbosity($level)
  33902. {
  33903. }
  33904. public function getVerbosity()
  33905. {
  33906. return self::VERBOSITY_QUIET;
  33907. }
  33908. public function isQuiet()
  33909. {
  33910. return true;
  33911. }
  33912. public function isVerbose()
  33913. {
  33914. return false;
  33915. }
  33916. public function isVeryVerbose()
  33917. {
  33918. return false;
  33919. }
  33920. public function isDebug()
  33921. {
  33922. return false;
  33923. }
  33924. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  33925. {
  33926. }
  33927. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  33928. {
  33929. }
  33930. }
  33931. <?php
  33932. namespace Symfony\Component\Console\Output;
  33933. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33934. use Symfony\Component\Console\Formatter\OutputFormatter;
  33935. abstract class Output implements OutputInterface
  33936. {
  33937. private $verbosity;
  33938. private $formatter;
  33939. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  33940. {
  33941. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  33942. $this->formatter = $formatter ?: new OutputFormatter();
  33943. $this->formatter->setDecorated($decorated);
  33944. }
  33945. public function setFormatter(OutputFormatterInterface $formatter)
  33946. {
  33947. $this->formatter = $formatter;
  33948. }
  33949. public function getFormatter()
  33950. {
  33951. return $this->formatter;
  33952. }
  33953. public function setDecorated($decorated)
  33954. {
  33955. $this->formatter->setDecorated($decorated);
  33956. }
  33957. public function isDecorated()
  33958. {
  33959. return $this->formatter->isDecorated();
  33960. }
  33961. public function setVerbosity($level)
  33962. {
  33963. $this->verbosity = (int) $level;
  33964. }
  33965. public function getVerbosity()
  33966. {
  33967. return $this->verbosity;
  33968. }
  33969. public function isQuiet()
  33970. {
  33971. return self::VERBOSITY_QUIET === $this->verbosity;
  33972. }
  33973. public function isVerbose()
  33974. {
  33975. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  33976. }
  33977. public function isVeryVerbose()
  33978. {
  33979. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  33980. }
  33981. public function isDebug()
  33982. {
  33983. return self::VERBOSITY_DEBUG <= $this->verbosity;
  33984. }
  33985. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  33986. {
  33987. $this->write($messages, true, $options);
  33988. }
  33989. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  33990. {
  33991. $messages = (array) $messages;
  33992. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  33993. $type = $types & $options ?: self::OUTPUT_NORMAL;
  33994. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  33995. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  33996. if ($verbosity > $this->getVerbosity()) {
  33997. return;
  33998. }
  33999. foreach ($messages as $message) {
  34000. switch ($type) {
  34001. case OutputInterface::OUTPUT_NORMAL:
  34002. $message = $this->formatter->format($message);
  34003. break;
  34004. case OutputInterface::OUTPUT_RAW:
  34005. break;
  34006. case OutputInterface::OUTPUT_PLAIN:
  34007. $message = strip_tags($this->formatter->format($message));
  34008. break;
  34009. }
  34010. $this->doWrite($message, $newline);
  34011. }
  34012. }
  34013. abstract protected function doWrite($message, $newline);
  34014. }
  34015. <?php
  34016. namespace Symfony\Component\Console\Output;
  34017. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34018. interface OutputInterface
  34019. {
  34020. const VERBOSITY_QUIET = 16;
  34021. const VERBOSITY_NORMAL = 32;
  34022. const VERBOSITY_VERBOSE = 64;
  34023. const VERBOSITY_VERY_VERBOSE = 128;
  34024. const VERBOSITY_DEBUG = 256;
  34025. const OUTPUT_NORMAL = 1;
  34026. const OUTPUT_RAW = 2;
  34027. const OUTPUT_PLAIN = 4;
  34028. public function write($messages, $newline = false, $options = 0);
  34029. public function writeln($messages, $options = 0);
  34030. public function setVerbosity($level);
  34031. public function getVerbosity();
  34032. public function setDecorated($decorated);
  34033. public function isDecorated();
  34034. public function setFormatter(OutputFormatterInterface $formatter);
  34035. public function getFormatter();
  34036. }
  34037. <?php
  34038. namespace Symfony\Component\Console\Output;
  34039. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34040. use Symfony\Component\Console\Exception\RuntimeException;
  34041. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34042. class StreamOutput extends Output
  34043. {
  34044. private $stream;
  34045. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  34046. {
  34047. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  34048. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  34049. }
  34050. $this->stream = $stream;
  34051. if (null === $decorated) {
  34052. $decorated = $this->hasColorSupport();
  34053. }
  34054. parent::__construct($verbosity, $decorated, $formatter);
  34055. }
  34056. public function getStream()
  34057. {
  34058. return $this->stream;
  34059. }
  34060. protected function doWrite($message, $newline)
  34061. {
  34062. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  34063. throw new RuntimeException('Unable to write output.');
  34064. }
  34065. fflush($this->stream);
  34066. }
  34067. protected function hasColorSupport()
  34068. {
  34069. if (DIRECTORY_SEPARATOR === '\\') {
  34070. return
  34071. '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  34072. || false !== getenv('ANSICON')
  34073. || 'ON' === getenv('ConEmuANSI')
  34074. || 'xterm' === getenv('TERM');
  34075. }
  34076. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  34077. }
  34078. }
  34079. <?php
  34080. namespace Symfony\Component\Console\Question;
  34081. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34082. class ChoiceQuestion extends Question
  34083. {
  34084. private $choices;
  34085. private $multiselect = false;
  34086. private $prompt = ' > ';
  34087. private $errorMessage = 'Value "%s" is invalid';
  34088. public function __construct($question, array $choices, $default = null)
  34089. {
  34090. parent::__construct($question, $default);
  34091. $this->choices = $choices;
  34092. $this->setValidator($this->getDefaultValidator());
  34093. $this->setAutocompleterValues($choices);
  34094. }
  34095. public function getChoices()
  34096. {
  34097. return $this->choices;
  34098. }
  34099. public function setMultiselect($multiselect)
  34100. {
  34101. $this->multiselect = $multiselect;
  34102. $this->setValidator($this->getDefaultValidator());
  34103. return $this;
  34104. }
  34105. public function isMultiselect()
  34106. {
  34107. return $this->multiselect;
  34108. }
  34109. public function getPrompt()
  34110. {
  34111. return $this->prompt;
  34112. }
  34113. public function setPrompt($prompt)
  34114. {
  34115. $this->prompt = $prompt;
  34116. return $this;
  34117. }
  34118. public function setErrorMessage($errorMessage)
  34119. {
  34120. $this->errorMessage = $errorMessage;
  34121. $this->setValidator($this->getDefaultValidator());
  34122. return $this;
  34123. }
  34124. private function getDefaultValidator()
  34125. {
  34126. $choices = $this->choices;
  34127. $errorMessage = $this->errorMessage;
  34128. $multiselect = $this->multiselect;
  34129. $isAssoc = $this->isAssoc($choices);
  34130. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  34131. $selectedChoices = str_replace(' ', '', $selected);
  34132. if ($multiselect) {
  34133. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  34134. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  34135. }
  34136. $selectedChoices = explode(',', $selectedChoices);
  34137. } else {
  34138. $selectedChoices = array($selected);
  34139. }
  34140. $multiselectChoices = array();
  34141. foreach ($selectedChoices as $value) {
  34142. $results = array();
  34143. foreach ($choices as $key => $choice) {
  34144. if ($choice === $value) {
  34145. $results[] = $key;
  34146. }
  34147. }
  34148. if (count($results) > 1) {
  34149. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  34150. }
  34151. $result = array_search($value, $choices);
  34152. if (!$isAssoc) {
  34153. if (false !== $result) {
  34154. $result = $choices[$result];
  34155. } elseif (isset($choices[$value])) {
  34156. $result = $choices[$value];
  34157. }
  34158. } elseif (false === $result && isset($choices[$value])) {
  34159. $result = $value;
  34160. }
  34161. if (false === $result) {
  34162. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  34163. }
  34164. $multiselectChoices[] = (string) $result;
  34165. }
  34166. if ($multiselect) {
  34167. return $multiselectChoices;
  34168. }
  34169. return current($multiselectChoices);
  34170. };
  34171. }
  34172. }
  34173. <?php
  34174. namespace Symfony\Component\Console\Question;
  34175. class ConfirmationQuestion extends Question
  34176. {
  34177. private $trueAnswerRegex;
  34178. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  34179. {
  34180. parent::__construct($question, (bool) $default);
  34181. $this->trueAnswerRegex = $trueAnswerRegex;
  34182. $this->setNormalizer($this->getDefaultNormalizer());
  34183. }
  34184. private function getDefaultNormalizer()
  34185. {
  34186. $default = $this->getDefault();
  34187. $regex = $this->trueAnswerRegex;
  34188. return function ($answer) use ($default, $regex) {
  34189. if (is_bool($answer)) {
  34190. return $answer;
  34191. }
  34192. $answerIsTrue = (bool) preg_match($regex, $answer);
  34193. if (false === $default) {
  34194. return $answer && $answerIsTrue;
  34195. }
  34196. return !$answer || $answerIsTrue;
  34197. };
  34198. }
  34199. }
  34200. <?php
  34201. namespace Symfony\Component\Console\Question;
  34202. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34203. use Symfony\Component\Console\Exception\LogicException;
  34204. class Question
  34205. {
  34206. private $question;
  34207. private $attempts;
  34208. private $hidden = false;
  34209. private $hiddenFallback = true;
  34210. private $autocompleterValues;
  34211. private $validator;
  34212. private $default;
  34213. private $normalizer;
  34214. public function __construct($question, $default = null)
  34215. {
  34216. $this->question = $question;
  34217. $this->default = $default;
  34218. }
  34219. public function getQuestion()
  34220. {
  34221. return $this->question;
  34222. }
  34223. public function getDefault()
  34224. {
  34225. return $this->default;
  34226. }
  34227. public function isHidden()
  34228. {
  34229. return $this->hidden;
  34230. }
  34231. public function setHidden($hidden)
  34232. {
  34233. if ($this->autocompleterValues) {
  34234. throw new LogicException('A hidden question cannot use the autocompleter.');
  34235. }
  34236. $this->hidden = (bool) $hidden;
  34237. return $this;
  34238. }
  34239. public function isHiddenFallback()
  34240. {
  34241. return $this->hiddenFallback;
  34242. }
  34243. public function setHiddenFallback($fallback)
  34244. {
  34245. $this->hiddenFallback = (bool) $fallback;
  34246. return $this;
  34247. }
  34248. public function getAutocompleterValues()
  34249. {
  34250. return $this->autocompleterValues;
  34251. }
  34252. public function setAutocompleterValues($values)
  34253. {
  34254. if (is_array($values)) {
  34255. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  34256. }
  34257. if (null !== $values && !is_array($values)) {
  34258. if (!$values instanceof \Traversable || !$values instanceof \Countable) {
  34259. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
  34260. }
  34261. }
  34262. if ($this->hidden) {
  34263. throw new LogicException('A hidden question cannot use the autocompleter.');
  34264. }
  34265. $this->autocompleterValues = $values;
  34266. return $this;
  34267. }
  34268. public function setValidator($validator)
  34269. {
  34270. $this->validator = $validator;
  34271. return $this;
  34272. }
  34273. public function getValidator()
  34274. {
  34275. return $this->validator;
  34276. }
  34277. public function setMaxAttempts($attempts)
  34278. {
  34279. if (null !== $attempts && $attempts < 1) {
  34280. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  34281. }
  34282. $this->attempts = $attempts;
  34283. return $this;
  34284. }
  34285. public function getMaxAttempts()
  34286. {
  34287. return $this->attempts;
  34288. }
  34289. public function setNormalizer($normalizer)
  34290. {
  34291. $this->normalizer = $normalizer;
  34292. return $this;
  34293. }
  34294. public function getNormalizer()
  34295. {
  34296. return $this->normalizer;
  34297. }
  34298. protected function isAssoc($array)
  34299. {
  34300. return (bool) count(array_filter(array_keys($array), 'is_string'));
  34301. }
  34302. }
  34303. <?php
  34304. namespace Symfony\Component\Console;
  34305. use Symfony\Component\Console\Exception\RuntimeException;
  34306. use Symfony\Component\Console\Input\StringInput;
  34307. use Symfony\Component\Console\Output\ConsoleOutput;
  34308. use Symfony\Component\Process\ProcessBuilder;
  34309. use Symfony\Component\Process\PhpExecutableFinder;
  34310. class Shell
  34311. {
  34312. private $application;
  34313. private $history;
  34314. private $output;
  34315. private $hasReadline;
  34316. private $processIsolation = false;
  34317. public function __construct(Application $application)
  34318. {
  34319. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  34320. $this->hasReadline = function_exists('readline');
  34321. $this->application = $application;
  34322. $this->history = getenv('HOME').'/.history_'.$application->getName();
  34323. $this->output = new ConsoleOutput();
  34324. }
  34325. public function run()
  34326. {
  34327. $this->application->setAutoExit(false);
  34328. $this->application->setCatchExceptions(true);
  34329. if ($this->hasReadline) {
  34330. readline_read_history($this->history);
  34331. readline_completion_function(array($this, 'autocompleter'));
  34332. }
  34333. $this->output->writeln($this->getHeader());
  34334. $php = null;
  34335. if ($this->processIsolation) {
  34336. $finder = new PhpExecutableFinder();
  34337. $php = $finder->find();
  34338. $this->output->writeln(<<<'EOF'
  34339. <info>Running with process isolation, you should consider this:</info>
  34340. * each command is executed as separate process,
  34341. * commands don't support interactivity, all params must be passed explicitly,
  34342. * commands output is not colorized.
  34343. EOF
  34344. );
  34345. }
  34346. while (true) {
  34347. $command = $this->readline();
  34348. if (false === $command) {
  34349. $this->output->writeln("\n");
  34350. break;
  34351. }
  34352. if ($this->hasReadline) {
  34353. readline_add_history($command);
  34354. readline_write_history($this->history);
  34355. }
  34356. if ($this->processIsolation) {
  34357. $pb = new ProcessBuilder();
  34358. $process = $pb
  34359. ->add($php)
  34360. ->add($_SERVER['argv'][0])
  34361. ->add($command)
  34362. ->inheritEnvironmentVariables(true)
  34363. ->getProcess()
  34364. ;
  34365. $output = $this->output;
  34366. $process->run(function ($type, $data) use ($output) {
  34367. $output->writeln($data);
  34368. });
  34369. $ret = $process->getExitCode();
  34370. } else {
  34371. $ret = $this->application->run(new StringInput($command), $this->output);
  34372. }
  34373. if (0 !== $ret) {
  34374. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  34375. }
  34376. }
  34377. }
  34378. protected function getHeader()
  34379. {
  34380. return <<<EOF
  34381. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  34382. At the prompt, type <comment>help</comment> for some help,
  34383. or <comment>list</comment> to get a list of available commands.
  34384. To exit the shell, type <comment>^D</comment>.
  34385. EOF;
  34386. }
  34387. protected function getPrompt()
  34388. {
  34389. return $this->output->getFormatter()->format($this->application->getName().' > ');
  34390. }
  34391. protected function getOutput()
  34392. {
  34393. return $this->output;
  34394. }
  34395. protected function getApplication()
  34396. {
  34397. return $this->application;
  34398. }
  34399. private function autocompleter($text)
  34400. {
  34401. $info = readline_info();
  34402. $text = substr($info['line_buffer'], 0, $info['end']);
  34403. if ($info['point'] !== $info['end']) {
  34404. return true;
  34405. }
  34406. if (false === strpos($text, ' ') || !$text) {
  34407. return array_keys($this->application->all());
  34408. }
  34409. try {
  34410. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  34411. } catch (\Exception $e) {
  34412. return true;
  34413. }
  34414. $list = array('--help');
  34415. foreach ($command->getDefinition()->getOptions() as $option) {
  34416. $list[] = '--'.$option->getName();
  34417. }
  34418. return $list;
  34419. }
  34420. private function readline()
  34421. {
  34422. if ($this->hasReadline) {
  34423. $line = readline($this->getPrompt());
  34424. } else {
  34425. $this->output->write($this->getPrompt());
  34426. $line = fgets(STDIN, 1024);
  34427. $line = (false === $line || '' === $line) ? false : rtrim($line);
  34428. }
  34429. return $line;
  34430. }
  34431. public function getProcessIsolation()
  34432. {
  34433. return $this->processIsolation;
  34434. }
  34435. public function setProcessIsolation($processIsolation)
  34436. {
  34437. $this->processIsolation = (bool) $processIsolation;
  34438. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  34439. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  34440. }
  34441. }
  34442. }
  34443. <?php
  34444. namespace Symfony\Component\Console\Style;
  34445. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34446. use Symfony\Component\Console\Helper\ProgressBar;
  34447. use Symfony\Component\Console\Output\OutputInterface;
  34448. abstract class OutputStyle implements OutputInterface, StyleInterface
  34449. {
  34450. private $output;
  34451. public function __construct(OutputInterface $output)
  34452. {
  34453. $this->output = $output;
  34454. }
  34455. public function newLine($count = 1)
  34456. {
  34457. $this->output->write(str_repeat(PHP_EOL, $count));
  34458. }
  34459. public function createProgressBar($max = 0)
  34460. {
  34461. return new ProgressBar($this->output, $max);
  34462. }
  34463. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  34464. {
  34465. $this->output->write($messages, $newline, $type);
  34466. }
  34467. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  34468. {
  34469. $this->output->writeln($messages, $type);
  34470. }
  34471. public function setVerbosity($level)
  34472. {
  34473. $this->output->setVerbosity($level);
  34474. }
  34475. public function getVerbosity()
  34476. {
  34477. return $this->output->getVerbosity();
  34478. }
  34479. public function setDecorated($decorated)
  34480. {
  34481. $this->output->setDecorated($decorated);
  34482. }
  34483. public function isDecorated()
  34484. {
  34485. return $this->output->isDecorated();
  34486. }
  34487. public function setFormatter(OutputFormatterInterface $formatter)
  34488. {
  34489. $this->output->setFormatter($formatter);
  34490. }
  34491. public function getFormatter()
  34492. {
  34493. return $this->output->getFormatter();
  34494. }
  34495. }
  34496. <?php
  34497. namespace Symfony\Component\Console\Style;
  34498. interface StyleInterface
  34499. {
  34500. public function title($message);
  34501. public function section($message);
  34502. public function listing(array $elements);
  34503. public function text($message);
  34504. public function success($message);
  34505. public function error($message);
  34506. public function warning($message);
  34507. public function note($message);
  34508. public function caution($message);
  34509. public function table(array $headers, array $rows);
  34510. public function ask($question, $default = null, $validator = null);
  34511. public function askHidden($question, $validator = null);
  34512. public function confirm($question, $default = true);
  34513. public function choice($question, array $choices, $default = null);
  34514. public function newLine($count = 1);
  34515. public function progressStart($max = 0);
  34516. public function progressAdvance($step = 1);
  34517. public function progressFinish();
  34518. }
  34519. <?php
  34520. namespace Symfony\Component\Console\Style;
  34521. use Symfony\Component\Console\Application;
  34522. use Symfony\Component\Console\Exception\RuntimeException;
  34523. use Symfony\Component\Console\Formatter\OutputFormatter;
  34524. use Symfony\Component\Console\Helper\Helper;
  34525. use Symfony\Component\Console\Helper\ProgressBar;
  34526. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  34527. use Symfony\Component\Console\Helper\Table;
  34528. use Symfony\Component\Console\Input\InputInterface;
  34529. use Symfony\Component\Console\Output\BufferedOutput;
  34530. use Symfony\Component\Console\Output\OutputInterface;
  34531. use Symfony\Component\Console\Question\ChoiceQuestion;
  34532. use Symfony\Component\Console\Question\ConfirmationQuestion;
  34533. use Symfony\Component\Console\Question\Question;
  34534. class SymfonyStyle extends OutputStyle
  34535. {
  34536. const MAX_LINE_LENGTH = 120;
  34537. private $input;
  34538. private $questionHelper;
  34539. private $progressBar;
  34540. private $lineLength;
  34541. private $bufferedOutput;
  34542. public function __construct(InputInterface $input, OutputInterface $output)
  34543. {
  34544. $this->input = $input;
  34545. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  34546. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  34547. parent::__construct($output);
  34548. }
  34549. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  34550. {
  34551. $messages = is_array($messages) ? array_values($messages) : array($messages);
  34552. $this->autoPrependBlock();
  34553. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  34554. $this->newLine();
  34555. }
  34556. public function title($message)
  34557. {
  34558. $this->autoPrependBlock();
  34559. $this->writeln(array(
  34560. sprintf('<comment>%s</>', $message),
  34561. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  34562. ));
  34563. $this->newLine();
  34564. }
  34565. public function section($message)
  34566. {
  34567. $this->autoPrependBlock();
  34568. $this->writeln(array(
  34569. sprintf('<comment>%s</>', $message),
  34570. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  34571. ));
  34572. $this->newLine();
  34573. }
  34574. public function listing(array $elements)
  34575. {
  34576. $this->autoPrependText();
  34577. $elements = array_map(function ($element) {
  34578. return sprintf(' * %s', $element);
  34579. }, $elements);
  34580. $this->writeln($elements);
  34581. $this->newLine();
  34582. }
  34583. public function text($message)
  34584. {
  34585. $this->autoPrependText();
  34586. $messages = is_array($message) ? array_values($message) : array($message);
  34587. foreach ($messages as $message) {
  34588. $this->writeln(sprintf(' %s', $message));
  34589. }
  34590. }
  34591. public function comment($message)
  34592. {
  34593. $messages = is_array($message) ? array_values($message) : array($message);
  34594. $this->autoPrependBlock();
  34595. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  34596. $this->newLine();
  34597. }
  34598. public function success($message)
  34599. {
  34600. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  34601. }
  34602. public function error($message)
  34603. {
  34604. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  34605. }
  34606. public function warning($message)
  34607. {
  34608. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  34609. }
  34610. public function note($message)
  34611. {
  34612. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  34613. }
  34614. public function caution($message)
  34615. {
  34616. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  34617. }
  34618. public function table(array $headers, array $rows)
  34619. {
  34620. $style = clone Table::getStyleDefinition('symfony-style-guide');
  34621. $style->setCellHeaderFormat('<info>%s</info>');
  34622. $table = new Table($this);
  34623. $table->setHeaders($headers);
  34624. $table->setRows($rows);
  34625. $table->setStyle($style);
  34626. $table->render();
  34627. $this->newLine();
  34628. }
  34629. public function ask($question, $default = null, $validator = null)
  34630. {
  34631. $question = new Question($question, $default);
  34632. $question->setValidator($validator);
  34633. return $this->askQuestion($question);
  34634. }
  34635. public function askHidden($question, $validator = null)
  34636. {
  34637. $question = new Question($question);
  34638. $question->setHidden(true);
  34639. $question->setValidator($validator);
  34640. return $this->askQuestion($question);
  34641. }
  34642. public function confirm($question, $default = true)
  34643. {
  34644. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  34645. }
  34646. public function choice($question, array $choices, $default = null)
  34647. {
  34648. if (null !== $default) {
  34649. $values = array_flip($choices);
  34650. $default = $values[$default];
  34651. }
  34652. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  34653. }
  34654. public function progressStart($max = 0)
  34655. {
  34656. $this->progressBar = $this->createProgressBar($max);
  34657. $this->progressBar->start();
  34658. }
  34659. public function progressAdvance($step = 1)
  34660. {
  34661. $this->getProgressBar()->advance($step);
  34662. }
  34663. public function progressFinish()
  34664. {
  34665. $this->getProgressBar()->finish();
  34666. $this->newLine(2);
  34667. $this->progressBar = null;
  34668. }
  34669. public function createProgressBar($max = 0)
  34670. {
  34671. $progressBar = parent::createProgressBar($max);
  34672. if ('\\' !== DIRECTORY_SEPARATOR) {
  34673. $progressBar->setEmptyBarCharacter('â–‘');
  34674. $progressBar->setProgressCharacter('');
  34675. $progressBar->setBarCharacter('â–“');
  34676. }
  34677. return $progressBar;
  34678. }
  34679. public function askQuestion(Question $question)
  34680. {
  34681. if ($this->input->isInteractive()) {
  34682. $this->autoPrependBlock();
  34683. }
  34684. if (!$this->questionHelper) {
  34685. $this->questionHelper = new SymfonyQuestionHelper();
  34686. }
  34687. $answer = $this->questionHelper->ask($this->input, $this, $question);
  34688. if ($this->input->isInteractive()) {
  34689. $this->newLine();
  34690. $this->bufferedOutput->write("\n");
  34691. }
  34692. return $answer;
  34693. }
  34694. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  34695. {
  34696. parent::writeln($messages, $type);
  34697. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  34698. }
  34699. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  34700. {
  34701. parent::write($messages, $newline, $type);
  34702. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  34703. }
  34704. public function newLine($count = 1)
  34705. {
  34706. parent::newLine($count);
  34707. $this->bufferedOutput->write(str_repeat("\n", $count));
  34708. }
  34709. private function getProgressBar()
  34710. {
  34711. if (!$this->progressBar) {
  34712. throw new RuntimeException('The ProgressBar is not started.');
  34713. }
  34714. return $this->progressBar;
  34715. }
  34716. private function getTerminalWidth()
  34717. {
  34718. $application = new Application();
  34719. $dimensions = $application->getTerminalDimensions();
  34720. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  34721. }
  34722. private function autoPrependBlock()
  34723. {
  34724. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  34725. if (!isset($chars[0])) {
  34726. return $this->newLine();
  34727. }
  34728. $this->newLine(2 - substr_count($chars, "\n"));
  34729. }
  34730. private function autoPrependText()
  34731. {
  34732. $fetched = $this->bufferedOutput->fetch();
  34733. if ("\n" !== substr($fetched, -1)) {
  34734. $this->newLine();
  34735. }
  34736. }
  34737. private function reduceBuffer($messages)
  34738. {
  34739. return array_map(function ($value) {
  34740. return substr($value, -4);
  34741. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  34742. }
  34743. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  34744. {
  34745. $indentLength = 0;
  34746. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  34747. $lines = array();
  34748. if (null !== $type) {
  34749. $type = sprintf('[%s] ', $type);
  34750. $indentLength = strlen($type);
  34751. $lineIndentation = str_repeat(' ', $indentLength);
  34752. }
  34753. foreach ($messages as $key => $message) {
  34754. if ($escape) {
  34755. $message = OutputFormatter::escape($message);
  34756. }
  34757. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  34758. if (count($messages) > 1 && $key < count($messages) - 1) {
  34759. $lines[] = '';
  34760. }
  34761. }
  34762. $firstLineIndex = 0;
  34763. if ($padding && $this->isDecorated()) {
  34764. $firstLineIndex = 1;
  34765. array_unshift($lines, '');
  34766. $lines[] = '';
  34767. }
  34768. foreach ($lines as $i => &$line) {
  34769. if (null !== $type) {
  34770. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  34771. }
  34772. $line = $prefix.$line;
  34773. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  34774. if ($style) {
  34775. $line = sprintf('<%s>%s</>', $style, $line);
  34776. }
  34777. }
  34778. return $lines;
  34779. }
  34780. }
  34781. <?php
  34782. namespace Symfony\Component\Console\Tester;
  34783. use Symfony\Component\Console\Application;
  34784. use Symfony\Component\Console\Input\ArrayInput;
  34785. use Symfony\Component\Console\Input\InputInterface;
  34786. use Symfony\Component\Console\Output\OutputInterface;
  34787. use Symfony\Component\Console\Output\StreamOutput;
  34788. class ApplicationTester
  34789. {
  34790. private $application;
  34791. private $input;
  34792. private $output;
  34793. private $statusCode;
  34794. public function __construct(Application $application)
  34795. {
  34796. $this->application = $application;
  34797. }
  34798. public function run(array $input, $options = array())
  34799. {
  34800. $this->input = new ArrayInput($input);
  34801. if (isset($options['interactive'])) {
  34802. $this->input->setInteractive($options['interactive']);
  34803. }
  34804. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  34805. if (isset($options['decorated'])) {
  34806. $this->output->setDecorated($options['decorated']);
  34807. }
  34808. if (isset($options['verbosity'])) {
  34809. $this->output->setVerbosity($options['verbosity']);
  34810. }
  34811. return $this->statusCode = $this->application->run($this->input, $this->output);
  34812. }
  34813. public function getDisplay($normalize = false)
  34814. {
  34815. rewind($this->output->getStream());
  34816. $display = stream_get_contents($this->output->getStream());
  34817. if ($normalize) {
  34818. $display = str_replace(PHP_EOL, "\n", $display);
  34819. }
  34820. return $display;
  34821. }
  34822. public function getInput()
  34823. {
  34824. return $this->input;
  34825. }
  34826. public function getOutput()
  34827. {
  34828. return $this->output;
  34829. }
  34830. public function getStatusCode()
  34831. {
  34832. return $this->statusCode;
  34833. }
  34834. }
  34835. <?php
  34836. namespace Symfony\Component\Console\Tester;
  34837. use Symfony\Component\Console\Command\Command;
  34838. use Symfony\Component\Console\Input\ArrayInput;
  34839. use Symfony\Component\Console\Output\StreamOutput;
  34840. use Symfony\Component\Console\Input\InputInterface;
  34841. use Symfony\Component\Console\Output\OutputInterface;
  34842. class CommandTester
  34843. {
  34844. private $command;
  34845. private $input;
  34846. private $output;
  34847. private $statusCode;
  34848. public function __construct(Command $command)
  34849. {
  34850. $this->command = $command;
  34851. }
  34852. public function execute(array $input, array $options = array())
  34853. {
  34854. if (!isset($input['command'])
  34855. && (null !== $application = $this->command->getApplication())
  34856. && $application->getDefinition()->hasArgument('command')
  34857. ) {
  34858. $input = array_merge(array('command' => $this->command->getName()), $input);
  34859. }
  34860. $this->input = new ArrayInput($input);
  34861. if (isset($options['interactive'])) {
  34862. $this->input->setInteractive($options['interactive']);
  34863. }
  34864. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  34865. if (isset($options['decorated'])) {
  34866. $this->output->setDecorated($options['decorated']);
  34867. }
  34868. if (isset($options['verbosity'])) {
  34869. $this->output->setVerbosity($options['verbosity']);
  34870. }
  34871. return $this->statusCode = $this->command->run($this->input, $this->output);
  34872. }
  34873. public function getDisplay($normalize = false)
  34874. {
  34875. rewind($this->output->getStream());
  34876. $display = stream_get_contents($this->output->getStream());
  34877. if ($normalize) {
  34878. $display = str_replace(PHP_EOL, "\n", $display);
  34879. }
  34880. return $display;
  34881. }
  34882. public function getInput()
  34883. {
  34884. return $this->input;
  34885. }
  34886. public function getOutput()
  34887. {
  34888. return $this->output;
  34889. }
  34890. public function getStatusCode()
  34891. {
  34892. return $this->statusCode;
  34893. }
  34894. }
  34895. <?php
  34896. namespace Symfony\Component\Debug;
  34897. use Psr\Log\AbstractLogger;
  34898. class BufferingLogger extends AbstractLogger
  34899. {
  34900. private $logs = array();
  34901. public function log($level, $message, array $context = array())
  34902. {
  34903. $this->logs[] = array($level, $message, $context);
  34904. }
  34905. public function cleanLogs()
  34906. {
  34907. $logs = $this->logs;
  34908. $this->logs = array();
  34909. return $logs;
  34910. }
  34911. }
  34912. <?php
  34913. namespace Symfony\Component\Debug;
  34914. class Debug
  34915. {
  34916. private static $enabled = false;
  34917. public static function enable($errorReportingLevel = null, $displayErrors = true)
  34918. {
  34919. if (static::$enabled) {
  34920. return;
  34921. }
  34922. static::$enabled = true;
  34923. if (null !== $errorReportingLevel) {
  34924. error_reporting($errorReportingLevel);
  34925. } else {
  34926. error_reporting(-1);
  34927. }
  34928. if ('cli' !== PHP_SAPI) {
  34929. ini_set('display_errors', 0);
  34930. ExceptionHandler::register();
  34931. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  34932. ini_set('display_errors', 1);
  34933. }
  34934. if ($displayErrors) {
  34935. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  34936. } else {
  34937. ErrorHandler::register()->throwAt(0, true);
  34938. }
  34939. DebugClassLoader::enable();
  34940. }
  34941. }
  34942. <?php
  34943. namespace Symfony\Component\Debug;
  34944. class DebugClassLoader
  34945. {
  34946. private $classLoader;
  34947. private $isFinder;
  34948. private $wasFinder;
  34949. private static $caseCheck;
  34950. private static $deprecated = array();
  34951. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  34952. private static $darwinCache = array('/' => array('/', array()));
  34953. public function __construct($classLoader)
  34954. {
  34955. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  34956. if ($this->wasFinder) {
  34957. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  34958. $this->classLoader = array($classLoader, 'loadClass');
  34959. $this->isFinder = true;
  34960. } else {
  34961. $this->classLoader = $classLoader;
  34962. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  34963. }
  34964. if (!isset(self::$caseCheck)) {
  34965. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  34966. $i = strrpos($file, DIRECTORY_SEPARATOR);
  34967. $dir = substr($file, 0, 1 + $i);
  34968. $file = substr($file, 1 + $i);
  34969. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  34970. $test = realpath($dir.$test);
  34971. if (false === $test || false === $i) {
  34972. self::$caseCheck = 0;
  34973. } elseif (substr($test, -strlen($file)) === $file) {
  34974. self::$caseCheck = 1;
  34975. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  34976. self::$caseCheck = 2;
  34977. } else {
  34978. self::$caseCheck = 0;
  34979. }
  34980. }
  34981. }
  34982. public function getClassLoader()
  34983. {
  34984. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  34985. }
  34986. public static function enable()
  34987. {
  34988. class_exists('Symfony\Component\Debug\ErrorHandler');
  34989. class_exists('Psr\Log\LogLevel');
  34990. if (!is_array($functions = spl_autoload_functions())) {
  34991. return;
  34992. }
  34993. foreach ($functions as $function) {
  34994. spl_autoload_unregister($function);
  34995. }
  34996. foreach ($functions as $function) {
  34997. if (!is_array($function) || !$function[0] instanceof self) {
  34998. $function = array(new static($function), 'loadClass');
  34999. }
  35000. spl_autoload_register($function);
  35001. }
  35002. }
  35003. public static function disable()
  35004. {
  35005. if (!is_array($functions = spl_autoload_functions())) {
  35006. return;
  35007. }
  35008. foreach ($functions as $function) {
  35009. spl_autoload_unregister($function);
  35010. }
  35011. foreach ($functions as $function) {
  35012. if (is_array($function) && $function[0] instanceof self) {
  35013. $function = $function[0]->getClassLoader();
  35014. }
  35015. spl_autoload_register($function);
  35016. }
  35017. }
  35018. public function findFile($class)
  35019. {
  35020. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  35021. if ($this->wasFinder) {
  35022. return $this->classLoader[0]->findFile($class);
  35023. }
  35024. }
  35025. public function loadClass($class)
  35026. {
  35027. ErrorHandler::stackErrors();
  35028. try {
  35029. if ($this->isFinder) {
  35030. if ($file = $this->classLoader[0]->findFile($class)) {
  35031. require_once $file;
  35032. }
  35033. } else {
  35034. call_user_func($this->classLoader, $class);
  35035. $file = false;
  35036. }
  35037. } catch (\Exception $e) {
  35038. ErrorHandler::unstackErrors();
  35039. throw $e;
  35040. } catch (\Throwable $e) {
  35041. ErrorHandler::unstackErrors();
  35042. throw $e;
  35043. }
  35044. ErrorHandler::unstackErrors();
  35045. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  35046. if ('\\' === $class[0]) {
  35047. $class = substr($class, 1);
  35048. }
  35049. if ($exists) {
  35050. $refl = new \ReflectionClass($class);
  35051. $name = $refl->getName();
  35052. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  35053. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  35054. }
  35055. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  35056. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  35057. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  35058. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  35059. } else {
  35060. if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
  35061. $len = 0;
  35062. $ns = '';
  35063. } else {
  35064. switch ($ns = substr($name, 0, $len)) {
  35065. case 'Symfony\Bridge\\':
  35066. case 'Symfony\Bundle\\':
  35067. case 'Symfony\Component\\':
  35068. $ns = 'Symfony\\';
  35069. $len = strlen($ns);
  35070. break;
  35071. }
  35072. }
  35073. $parent = get_parent_class($class);
  35074. if (!$parent || strncmp($ns, $parent, $len)) {
  35075. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  35076. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  35077. }
  35078. $parentInterfaces = array();
  35079. $deprecatedInterfaces = array();
  35080. if ($parent) {
  35081. foreach (class_implements($parent) as $interface) {
  35082. $parentInterfaces[$interface] = 1;
  35083. }
  35084. }
  35085. foreach ($refl->getInterfaceNames() as $interface) {
  35086. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  35087. $deprecatedInterfaces[] = $interface;
  35088. }
  35089. foreach (class_implements($interface) as $interface) {
  35090. $parentInterfaces[$interface] = 1;
  35091. }
  35092. }
  35093. foreach ($deprecatedInterfaces as $interface) {
  35094. if (!isset($parentInterfaces[$interface])) {
  35095. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  35096. }
  35097. }
  35098. }
  35099. }
  35100. }
  35101. if ($file) {
  35102. if (!$exists) {
  35103. if (false !== strpos($class, '/')) {
  35104. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  35105. }
  35106. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  35107. }
  35108. if (self::$caseCheck) {
  35109. $real = explode('\\', $class.strrchr($file, '.'));
  35110. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  35111. $i = count($tail) - 1;
  35112. $j = count($real) - 1;
  35113. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  35114. --$i;
  35115. --$j;
  35116. }
  35117. array_splice($tail, 0, $i + 1);
  35118. }
  35119. if (self::$caseCheck && $tail) {
  35120. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  35121. $tailLen = strlen($tail);
  35122. $real = $refl->getFileName();
  35123. if (2 === self::$caseCheck) {
  35124. $i = 1 + strrpos($real, '/');
  35125. $file = substr($real, $i);
  35126. $real = substr($real, 0, $i);
  35127. if (isset(self::$darwinCache[$real])) {
  35128. $kDir = $real;
  35129. } else {
  35130. $kDir = strtolower($real);
  35131. if (isset(self::$darwinCache[$kDir])) {
  35132. $real = self::$darwinCache[$kDir][0];
  35133. } else {
  35134. $dir = getcwd();
  35135. chdir($real);
  35136. $real = getcwd().'/';
  35137. chdir($dir);
  35138. $dir = $real;
  35139. $k = $kDir;
  35140. $i = strlen($dir) - 1;
  35141. while (!isset(self::$darwinCache[$k])) {
  35142. self::$darwinCache[$k] = array($dir, array());
  35143. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  35144. while ('/' !== $dir[--$i]) {
  35145. }
  35146. $k = substr($k, 0, ++$i);
  35147. $dir = substr($dir, 0, $i--);
  35148. }
  35149. }
  35150. }
  35151. $dirFiles = self::$darwinCache[$kDir][1];
  35152. if (isset($dirFiles[$file])) {
  35153. $kFile = $file;
  35154. } else {
  35155. $kFile = strtolower($file);
  35156. if (!isset($dirFiles[$kFile])) {
  35157. foreach (scandir($real, 2) as $f) {
  35158. if ('.' !== $f[0]) {
  35159. $dirFiles[$f] = $f;
  35160. if ($f === $file) {
  35161. $kFile = $k = $file;
  35162. } elseif ($f !== $k = strtolower($f)) {
  35163. $dirFiles[$k] = $f;
  35164. }
  35165. }
  35166. }
  35167. self::$darwinCache[$kDir][1] = $dirFiles;
  35168. }
  35169. }
  35170. $real .= $dirFiles[$kFile];
  35171. }
  35172. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  35173. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  35174. ) {
  35175. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  35176. }
  35177. }
  35178. return true;
  35179. }
  35180. }
  35181. }
  35182. <?php
  35183. namespace Symfony\Component\Debug;
  35184. use Psr\Log\LogLevel;
  35185. use Psr\Log\LoggerInterface;
  35186. use Symfony\Component\Debug\Exception\ContextErrorException;
  35187. use Symfony\Component\Debug\Exception\FatalErrorException;
  35188. use Symfony\Component\Debug\Exception\FatalThrowableError;
  35189. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  35190. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  35191. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  35192. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  35193. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  35194. class ErrorHandler
  35195. {
  35196. const TYPE_DEPRECATION = -100;
  35197. private $levels = array(
  35198. E_DEPRECATED => 'Deprecated',
  35199. E_USER_DEPRECATED => 'User Deprecated',
  35200. E_NOTICE => 'Notice',
  35201. E_USER_NOTICE => 'User Notice',
  35202. E_STRICT => 'Runtime Notice',
  35203. E_WARNING => 'Warning',
  35204. E_USER_WARNING => 'User Warning',
  35205. E_COMPILE_WARNING => 'Compile Warning',
  35206. E_CORE_WARNING => 'Core Warning',
  35207. E_USER_ERROR => 'User Error',
  35208. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  35209. E_COMPILE_ERROR => 'Compile Error',
  35210. E_PARSE => 'Parse Error',
  35211. E_ERROR => 'Error',
  35212. E_CORE_ERROR => 'Core Error',
  35213. );
  35214. private $loggers = array(
  35215. E_DEPRECATED => array(null, LogLevel::INFO),
  35216. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  35217. E_NOTICE => array(null, LogLevel::WARNING),
  35218. E_USER_NOTICE => array(null, LogLevel::WARNING),
  35219. E_STRICT => array(null, LogLevel::WARNING),
  35220. E_WARNING => array(null, LogLevel::WARNING),
  35221. E_USER_WARNING => array(null, LogLevel::WARNING),
  35222. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  35223. E_CORE_WARNING => array(null, LogLevel::WARNING),
  35224. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  35225. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  35226. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  35227. E_PARSE => array(null, LogLevel::CRITICAL),
  35228. E_ERROR => array(null, LogLevel::CRITICAL),
  35229. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  35230. );
  35231. private $thrownErrors = 0x1FFF;
  35232. private $scopedErrors = 0x1FFF;
  35233. private $tracedErrors = 0x77FB;
  35234. private $screamedErrors = 0x55;
  35235. private $loggedErrors = 0;
  35236. private $loggedTraces = array();
  35237. private $isRecursive = 0;
  35238. private $isRoot = false;
  35239. private $exceptionHandler;
  35240. private $bootstrappingLogger;
  35241. private static $reservedMemory;
  35242. private static $stackedErrors = array();
  35243. private static $stackedErrorLevels = array();
  35244. private static $toStringException = null;
  35245. private $displayErrors = 0x1FFF;
  35246. public static function register($handler = null, $replace = true)
  35247. {
  35248. if (null === self::$reservedMemory) {
  35249. self::$reservedMemory = str_repeat('x', 10240);
  35250. register_shutdown_function(__CLASS__.'::handleFatalError');
  35251. }
  35252. $levels = -1;
  35253. if ($handlerIsNew = !$handler instanceof self) {
  35254. if (null !== $handler) {
  35255. $levels = $replace ? $handler : 0;
  35256. $replace = true;
  35257. }
  35258. $handler = new static();
  35259. }
  35260. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  35261. restore_error_handler();
  35262. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  35263. $handler->isRoot = true;
  35264. }
  35265. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  35266. $handler = $prev[0];
  35267. $replace = false;
  35268. }
  35269. if ($replace || !$prev) {
  35270. $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
  35271. } else {
  35272. restore_error_handler();
  35273. }
  35274. $handler->throwAt($levels & $handler->thrownErrors, true);
  35275. return $handler;
  35276. }
  35277. public function __construct(BufferingLogger $bootstrappingLogger = null)
  35278. {
  35279. if ($bootstrappingLogger) {
  35280. $this->bootstrappingLogger = $bootstrappingLogger;
  35281. $this->setDefaultLogger($bootstrappingLogger);
  35282. }
  35283. }
  35284. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  35285. {
  35286. $loggers = array();
  35287. if (is_array($levels)) {
  35288. foreach ($levels as $type => $logLevel) {
  35289. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  35290. $loggers[$type] = array($logger, $logLevel);
  35291. }
  35292. }
  35293. } else {
  35294. if (null === $levels) {
  35295. $levels = E_ALL | E_STRICT;
  35296. }
  35297. foreach ($this->loggers as $type => $log) {
  35298. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  35299. $log[0] = $logger;
  35300. $loggers[$type] = $log;
  35301. }
  35302. }
  35303. }
  35304. $this->setLoggers($loggers);
  35305. }
  35306. public function setLoggers(array $loggers)
  35307. {
  35308. $prevLogged = $this->loggedErrors;
  35309. $prev = $this->loggers;
  35310. $flush = array();
  35311. foreach ($loggers as $type => $log) {
  35312. if (!isset($prev[$type])) {
  35313. throw new \InvalidArgumentException('Unknown error type: '.$type);
  35314. }
  35315. if (!is_array($log)) {
  35316. $log = array($log);
  35317. } elseif (!array_key_exists(0, $log)) {
  35318. throw new \InvalidArgumentException('No logger provided');
  35319. }
  35320. if (null === $log[0]) {
  35321. $this->loggedErrors &= ~$type;
  35322. } elseif ($log[0] instanceof LoggerInterface) {
  35323. $this->loggedErrors |= $type;
  35324. } else {
  35325. throw new \InvalidArgumentException('Invalid logger provided');
  35326. }
  35327. $this->loggers[$type] = $log + $prev[$type];
  35328. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  35329. $flush[$type] = $type;
  35330. }
  35331. }
  35332. $this->reRegister($prevLogged | $this->thrownErrors);
  35333. if ($flush) {
  35334. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  35335. $type = $log[2]['type'];
  35336. if (!isset($flush[$type])) {
  35337. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  35338. } elseif ($this->loggers[$type][0]) {
  35339. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  35340. }
  35341. }
  35342. }
  35343. return $prev;
  35344. }
  35345. public function setExceptionHandler($handler)
  35346. {
  35347. if (null !== $handler && !is_callable($handler)) {
  35348. throw new \LogicException('The exception handler must be a valid PHP callable.');
  35349. }
  35350. $prev = $this->exceptionHandler;
  35351. $this->exceptionHandler = $handler;
  35352. return $prev;
  35353. }
  35354. public function throwAt($levels, $replace = false)
  35355. {
  35356. $prev = $this->thrownErrors;
  35357. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  35358. if (!$replace) {
  35359. $this->thrownErrors |= $prev;
  35360. }
  35361. $this->reRegister($prev | $this->loggedErrors);
  35362. $this->displayErrors = $this->thrownErrors;
  35363. return $prev;
  35364. }
  35365. public function scopeAt($levels, $replace = false)
  35366. {
  35367. $prev = $this->scopedErrors;
  35368. $this->scopedErrors = (int) $levels;
  35369. if (!$replace) {
  35370. $this->scopedErrors |= $prev;
  35371. }
  35372. return $prev;
  35373. }
  35374. public function traceAt($levels, $replace = false)
  35375. {
  35376. $prev = $this->tracedErrors;
  35377. $this->tracedErrors = (int) $levels;
  35378. if (!$replace) {
  35379. $this->tracedErrors |= $prev;
  35380. }
  35381. return $prev;
  35382. }
  35383. public function screamAt($levels, $replace = false)
  35384. {
  35385. $prev = $this->screamedErrors;
  35386. $this->screamedErrors = (int) $levels;
  35387. if (!$replace) {
  35388. $this->screamedErrors |= $prev;
  35389. }
  35390. return $prev;
  35391. }
  35392. private function reRegister($prev)
  35393. {
  35394. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  35395. $handler = set_error_handler('var_dump');
  35396. $handler = is_array($handler) ? $handler[0] : null;
  35397. restore_error_handler();
  35398. if ($handler === $this) {
  35399. restore_error_handler();
  35400. if ($this->isRoot) {
  35401. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  35402. } else {
  35403. set_error_handler(array($this, 'handleError'));
  35404. }
  35405. }
  35406. }
  35407. }
  35408. public function handleError($type, $message, $file, $line, array $context, array $backtrace = null)
  35409. {
  35410. $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  35411. $log = $this->loggedErrors & $type;
  35412. $throw = $this->thrownErrors & $type & $level;
  35413. $type &= $level | $this->screamedErrors;
  35414. if (!$type || (!$log && !$throw)) {
  35415. return $type && $log;
  35416. }
  35417. if (isset($context['GLOBALS']) && ($this->scopedErrors & $type)) {
  35418. $e = $context;
  35419. unset($e['GLOBALS'], $context);
  35420. $context = $e;
  35421. }
  35422. if (null !== $backtrace && $type & E_ERROR) {
  35423. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  35424. return true;
  35425. }
  35426. if ($throw) {
  35427. if (null !== self::$toStringException) {
  35428. $throw = self::$toStringException;
  35429. self::$toStringException = null;
  35430. } elseif (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  35431. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  35432. } else {
  35433. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  35434. }
  35435. if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) {
  35436. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  35437. }
  35438. if (E_USER_ERROR & $type) {
  35439. $backtrace = $backtrace ?: $throw->getTrace();
  35440. for ($i = 1; isset($backtrace[$i]); ++$i) {
  35441. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  35442. && '__toString' === $backtrace[$i]['function']
  35443. && '->' === $backtrace[$i]['type']
  35444. && !isset($backtrace[$i - 1]['class'])
  35445. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  35446. ) {
  35447. foreach ($context as $e) {
  35448. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  35449. if (1 === $i) {
  35450. $throw = $e;
  35451. break;
  35452. }
  35453. self::$toStringException = $e;
  35454. return true;
  35455. }
  35456. }
  35457. if (1 < $i) {
  35458. $this->handleException($throw);
  35459. return false;
  35460. }
  35461. }
  35462. }
  35463. }
  35464. throw $throw;
  35465. }
  35466. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  35467. $trace = true;
  35468. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  35469. $trace = false;
  35470. } else {
  35471. $this->loggedTraces[$e] = 1;
  35472. }
  35473. $e = compact('type', 'file', 'line', 'level');
  35474. if ($type & $level) {
  35475. if ($this->scopedErrors & $type) {
  35476. $e['scope_vars'] = $context;
  35477. if ($trace) {
  35478. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  35479. }
  35480. } elseif ($trace) {
  35481. if (null === $backtrace) {
  35482. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  35483. } else {
  35484. foreach ($backtrace as &$frame) {
  35485. unset($frame['args'], $frame);
  35486. }
  35487. $e['stack'] = $backtrace;
  35488. }
  35489. }
  35490. }
  35491. if ($this->isRecursive) {
  35492. $log = 0;
  35493. } elseif (self::$stackedErrorLevels) {
  35494. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  35495. } else {
  35496. try {
  35497. $this->isRecursive = true;
  35498. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  35499. $this->isRecursive = false;
  35500. } catch (\Exception $e) {
  35501. $this->isRecursive = false;
  35502. throw $e;
  35503. } catch (\Throwable $e) {
  35504. $this->isRecursive = false;
  35505. throw $e;
  35506. }
  35507. }
  35508. return $type && $log;
  35509. }
  35510. public function handleException($exception, array $error = null)
  35511. {
  35512. if (!$exception instanceof \Exception) {
  35513. $exception = new FatalThrowableError($exception);
  35514. }
  35515. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  35516. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  35517. $e = array(
  35518. 'type' => $type,
  35519. 'file' => $exception->getFile(),
  35520. 'line' => $exception->getLine(),
  35521. 'level' => error_reporting(),
  35522. 'stack' => $exception->getTrace(),
  35523. );
  35524. if ($exception instanceof FatalErrorException) {
  35525. if ($exception instanceof FatalThrowableError) {
  35526. $error = array(
  35527. 'type' => $type,
  35528. 'message' => $message = $exception->getMessage(),
  35529. 'file' => $e['file'],
  35530. 'line' => $e['line'],
  35531. );
  35532. } else {
  35533. $message = 'Fatal '.$exception->getMessage();
  35534. }
  35535. } elseif ($exception instanceof \ErrorException) {
  35536. $message = 'Uncaught '.$exception->getMessage();
  35537. if ($exception instanceof ContextErrorException) {
  35538. $e['context'] = $exception->getContext();
  35539. }
  35540. } else {
  35541. $message = 'Uncaught Exception: '.$exception->getMessage();
  35542. }
  35543. }
  35544. if ($this->loggedErrors & $type) {
  35545. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  35546. }
  35547. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  35548. foreach ($this->getFatalErrorHandlers() as $handler) {
  35549. if ($e = $handler->handleError($error, $exception)) {
  35550. $exception = $e;
  35551. break;
  35552. }
  35553. }
  35554. }
  35555. if (empty($this->exceptionHandler)) {
  35556. throw $exception;
  35557. }
  35558. try {
  35559. call_user_func($this->exceptionHandler, $exception);
  35560. } catch (\Exception $handlerException) {
  35561. } catch (\Throwable $handlerException) {
  35562. }
  35563. if (isset($handlerException)) {
  35564. $this->exceptionHandler = null;
  35565. $this->handleException($handlerException);
  35566. }
  35567. }
  35568. public static function handleFatalError(array $error = null)
  35569. {
  35570. if (null === self::$reservedMemory) {
  35571. return;
  35572. }
  35573. self::$reservedMemory = null;
  35574. $handler = set_error_handler('var_dump');
  35575. $handler = is_array($handler) ? $handler[0] : null;
  35576. restore_error_handler();
  35577. if (!$handler instanceof self) {
  35578. return;
  35579. }
  35580. if (null === $error) {
  35581. $error = error_get_last();
  35582. }
  35583. try {
  35584. while (self::$stackedErrorLevels) {
  35585. static::unstackErrors();
  35586. }
  35587. } catch (\Exception $exception) {
  35588. } catch (\Throwable $exception) {
  35589. }
  35590. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  35591. $handler->throwAt(0, true);
  35592. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  35593. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  35594. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  35595. } else {
  35596. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  35597. }
  35598. } elseif (!isset($exception)) {
  35599. return;
  35600. }
  35601. try {
  35602. $handler->handleException($exception, $error);
  35603. } catch (FatalErrorException $e) {
  35604. }
  35605. }
  35606. public static function stackErrors()
  35607. {
  35608. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  35609. }
  35610. public static function unstackErrors()
  35611. {
  35612. $level = array_pop(self::$stackedErrorLevels);
  35613. if (null !== $level) {
  35614. $e = error_reporting($level);
  35615. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  35616. error_reporting($e);
  35617. }
  35618. }
  35619. if (empty(self::$stackedErrorLevels)) {
  35620. $errors = self::$stackedErrors;
  35621. self::$stackedErrors = array();
  35622. foreach ($errors as $e) {
  35623. $e[0]->log($e[1], $e[2], $e[3]);
  35624. }
  35625. }
  35626. }
  35627. protected function getFatalErrorHandlers()
  35628. {
  35629. return array(
  35630. new UndefinedFunctionFatalErrorHandler(),
  35631. new UndefinedMethodFatalErrorHandler(),
  35632. new ClassNotFoundFatalErrorHandler(),
  35633. );
  35634. }
  35635. public function setLevel($level)
  35636. {
  35637. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  35638. $level = null === $level ? error_reporting() : $level;
  35639. $this->throwAt($level, true);
  35640. }
  35641. public function setDisplayErrors($displayErrors)
  35642. {
  35643. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  35644. if ($displayErrors) {
  35645. $this->throwAt($this->displayErrors, true);
  35646. } else {
  35647. $displayErrors = $this->displayErrors;
  35648. $this->throwAt(0, true);
  35649. $this->displayErrors = $displayErrors;
  35650. }
  35651. }
  35652. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  35653. {
  35654. @trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  35655. $handler = set_error_handler('var_dump');
  35656. $handler = is_array($handler) ? $handler[0] : null;
  35657. restore_error_handler();
  35658. if (!$handler instanceof self) {
  35659. return;
  35660. }
  35661. if ('deprecation' === $channel) {
  35662. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  35663. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  35664. } elseif ('scream' === $channel) {
  35665. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  35666. $handler->screamAt(E_ALL | E_STRICT);
  35667. } elseif ('emergency' === $channel) {
  35668. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  35669. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  35670. }
  35671. }
  35672. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  35673. {
  35674. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  35675. return $this->handleError($level, $message, $file, $line, (array) $context);
  35676. }
  35677. public function handleFatal()
  35678. {
  35679. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  35680. static::handleFatalError();
  35681. }
  35682. }
  35683. class ErrorHandlerCanary
  35684. {
  35685. private static $displayErrors = null;
  35686. public function __construct()
  35687. {
  35688. if (null === self::$displayErrors) {
  35689. self::$displayErrors = ini_set('display_errors', 1);
  35690. }
  35691. }
  35692. public function __destruct()
  35693. {
  35694. if (null !== self::$displayErrors) {
  35695. ini_set('display_errors', self::$displayErrors);
  35696. self::$displayErrors = null;
  35697. }
  35698. }
  35699. }
  35700. <?php
  35701. namespace Symfony\Component\Debug\Exception;
  35702. class ClassNotFoundException extends FatalErrorException
  35703. {
  35704. public function __construct($message, \ErrorException $previous)
  35705. {
  35706. parent::__construct(
  35707. $message,
  35708. $previous->getCode(),
  35709. $previous->getSeverity(),
  35710. $previous->getFile(),
  35711. $previous->getLine(),
  35712. $previous->getPrevious()
  35713. );
  35714. $this->setTrace($previous->getTrace());
  35715. }
  35716. }
  35717. <?php
  35718. namespace Symfony\Component\Debug\Exception;
  35719. class ContextErrorException extends \ErrorException
  35720. {
  35721. private $context = array();
  35722. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  35723. {
  35724. parent::__construct($message, $code, $severity, $filename, $lineno);
  35725. $this->context = $context;
  35726. }
  35727. public function getContext()
  35728. {
  35729. return $this->context;
  35730. }
  35731. }
  35732. <?php
  35733. namespace Symfony\Component\Debug\Exception;
  35734. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  35735. class DummyException extends \ErrorException
  35736. {
  35737. }
  35738. <?php
  35739. namespace Symfony\Component\HttpKernel\Exception;
  35740. class FatalErrorException extends \ErrorException
  35741. {
  35742. }
  35743. namespace Symfony\Component\Debug\Exception;
  35744. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  35745. class FatalErrorException extends LegacyFatalErrorException
  35746. {
  35747. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
  35748. {
  35749. parent::__construct($message, $code, $severity, $filename, $lineno);
  35750. if (null !== $trace) {
  35751. if (!$traceArgs) {
  35752. foreach ($trace as &$frame) {
  35753. unset($frame['args'], $frame['this'], $frame);
  35754. }
  35755. }
  35756. $this->setTrace($trace);
  35757. } elseif (null !== $traceOffset) {
  35758. if (function_exists('xdebug_get_function_stack')) {
  35759. $trace = xdebug_get_function_stack();
  35760. if (0 < $traceOffset) {
  35761. array_splice($trace, -$traceOffset);
  35762. }
  35763. foreach ($trace as &$frame) {
  35764. if (!isset($frame['type'])) {
  35765. if (isset($frame['class'])) {
  35766. $frame['type'] = '::';
  35767. }
  35768. } elseif ('dynamic' === $frame['type']) {
  35769. $frame['type'] = '->';
  35770. } elseif ('static' === $frame['type']) {
  35771. $frame['type'] = '::';
  35772. }
  35773. if (!$traceArgs) {
  35774. unset($frame['params'], $frame['args']);
  35775. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  35776. $frame['args'] = $frame['params'];
  35777. unset($frame['params']);
  35778. }
  35779. }
  35780. unset($frame);
  35781. $trace = array_reverse($trace);
  35782. } elseif (function_exists('symfony_debug_backtrace')) {
  35783. $trace = symfony_debug_backtrace();
  35784. if (0 < $traceOffset) {
  35785. array_splice($trace, 0, $traceOffset);
  35786. }
  35787. } else {
  35788. $trace = array();
  35789. }
  35790. $this->setTrace($trace);
  35791. }
  35792. }
  35793. protected function setTrace($trace)
  35794. {
  35795. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  35796. $traceReflector->setAccessible(true);
  35797. $traceReflector->setValue($this, $trace);
  35798. }
  35799. }
  35800. <?php
  35801. namespace Symfony\Component\Debug\Exception;
  35802. class FatalThrowableError extends FatalErrorException
  35803. {
  35804. public function __construct(\Throwable $e)
  35805. {
  35806. if ($e instanceof \ParseError) {
  35807. $message = 'Parse error: '.$e->getMessage();
  35808. $severity = E_PARSE;
  35809. } elseif ($e instanceof \TypeError) {
  35810. $message = 'Type error: '.$e->getMessage();
  35811. $severity = E_RECOVERABLE_ERROR;
  35812. } else {
  35813. $message = $e->getMessage();
  35814. $severity = E_ERROR;
  35815. }
  35816. \ErrorException::__construct(
  35817. $message,
  35818. $e->getCode(),
  35819. $severity,
  35820. $e->getFile(),
  35821. $e->getLine()
  35822. );
  35823. $this->setTrace($e->getTrace());
  35824. }
  35825. }
  35826. <?php
  35827. namespace Symfony\Component\HttpKernel\Exception;
  35828. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  35829. class FlattenException
  35830. {
  35831. private $handler;
  35832. public static function __callStatic($method, $args)
  35833. {
  35834. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  35835. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  35836. }
  35837. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  35838. }
  35839. public function __call($method, $args)
  35840. {
  35841. if (!isset($this->handler)) {
  35842. $this->handler = new DebugFlattenException();
  35843. }
  35844. if (!method_exists($this->handler, $method)) {
  35845. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  35846. }
  35847. return call_user_func_array(array($this->handler, $method), $args);
  35848. }
  35849. }
  35850. namespace Symfony\Component\Debug\Exception;
  35851. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  35852. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  35853. class FlattenException extends LegacyFlattenException
  35854. {
  35855. private $message;
  35856. private $code;
  35857. private $previous;
  35858. private $trace;
  35859. private $class;
  35860. private $statusCode;
  35861. private $headers;
  35862. private $file;
  35863. private $line;
  35864. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  35865. {
  35866. $e = new static();
  35867. $e->setMessage($exception->getMessage());
  35868. $e->setCode($exception->getCode());
  35869. if ($exception instanceof HttpExceptionInterface) {
  35870. $statusCode = $exception->getStatusCode();
  35871. $headers = array_merge($headers, $exception->getHeaders());
  35872. }
  35873. if (null === $statusCode) {
  35874. $statusCode = 500;
  35875. }
  35876. $e->setStatusCode($statusCode);
  35877. $e->setHeaders($headers);
  35878. $e->setTraceFromException($exception);
  35879. $e->setClass(get_class($exception));
  35880. $e->setFile($exception->getFile());
  35881. $e->setLine($exception->getLine());
  35882. $previous = $exception->getPrevious();
  35883. if ($previous instanceof \Exception) {
  35884. $e->setPrevious(static::create($previous));
  35885. } elseif ($previous instanceof \Throwable) {
  35886. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  35887. }
  35888. return $e;
  35889. }
  35890. public function toArray()
  35891. {
  35892. $exceptions = array();
  35893. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  35894. $exceptions[] = array(
  35895. 'message' => $exception->getMessage(),
  35896. 'class' => $exception->getClass(),
  35897. 'trace' => $exception->getTrace(),
  35898. );
  35899. }
  35900. return $exceptions;
  35901. }
  35902. public function getStatusCode()
  35903. {
  35904. return $this->statusCode;
  35905. }
  35906. public function setStatusCode($code)
  35907. {
  35908. $this->statusCode = $code;
  35909. }
  35910. public function getHeaders()
  35911. {
  35912. return $this->headers;
  35913. }
  35914. public function setHeaders(array $headers)
  35915. {
  35916. $this->headers = $headers;
  35917. }
  35918. public function getClass()
  35919. {
  35920. return $this->class;
  35921. }
  35922. public function setClass($class)
  35923. {
  35924. $this->class = $class;
  35925. }
  35926. public function getFile()
  35927. {
  35928. return $this->file;
  35929. }
  35930. public function setFile($file)
  35931. {
  35932. $this->file = $file;
  35933. }
  35934. public function getLine()
  35935. {
  35936. return $this->line;
  35937. }
  35938. public function setLine($line)
  35939. {
  35940. $this->line = $line;
  35941. }
  35942. public function getMessage()
  35943. {
  35944. return $this->message;
  35945. }
  35946. public function setMessage($message)
  35947. {
  35948. $this->message = $message;
  35949. }
  35950. public function getCode()
  35951. {
  35952. return $this->code;
  35953. }
  35954. public function setCode($code)
  35955. {
  35956. $this->code = $code;
  35957. }
  35958. public function getPrevious()
  35959. {
  35960. return $this->previous;
  35961. }
  35962. public function setPrevious(FlattenException $previous)
  35963. {
  35964. $this->previous = $previous;
  35965. }
  35966. public function getAllPrevious()
  35967. {
  35968. $exceptions = array();
  35969. $e = $this;
  35970. while ($e = $e->getPrevious()) {
  35971. $exceptions[] = $e;
  35972. }
  35973. return $exceptions;
  35974. }
  35975. public function getTrace()
  35976. {
  35977. return $this->trace;
  35978. }
  35979. public function setTraceFromException(\Exception $exception)
  35980. {
  35981. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  35982. }
  35983. public function setTrace($trace, $file, $line)
  35984. {
  35985. $this->trace = array();
  35986. $this->trace[] = array(
  35987. 'namespace' => '',
  35988. 'short_class' => '',
  35989. 'class' => '',
  35990. 'type' => '',
  35991. 'function' => '',
  35992. 'file' => $file,
  35993. 'line' => $line,
  35994. 'args' => array(),
  35995. );
  35996. foreach ($trace as $entry) {
  35997. $class = '';
  35998. $namespace = '';
  35999. if (isset($entry['class'])) {
  36000. $parts = explode('\\', $entry['class']);
  36001. $class = array_pop($parts);
  36002. $namespace = implode('\\', $parts);
  36003. }
  36004. $this->trace[] = array(
  36005. 'namespace' => $namespace,
  36006. 'short_class' => $class,
  36007. 'class' => isset($entry['class']) ? $entry['class'] : '',
  36008. 'type' => isset($entry['type']) ? $entry['type'] : '',
  36009. 'function' => isset($entry['function']) ? $entry['function'] : null,
  36010. 'file' => isset($entry['file']) ? $entry['file'] : null,
  36011. 'line' => isset($entry['line']) ? $entry['line'] : null,
  36012. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  36013. );
  36014. }
  36015. }
  36016. private function flattenArgs($args, $level = 0, &$count = 0)
  36017. {
  36018. $result = array();
  36019. foreach ($args as $key => $value) {
  36020. if (++$count > 1e4) {
  36021. return array('array', '*SKIPPED over 10000 entries*');
  36022. }
  36023. if ($value instanceof \__PHP_Incomplete_Class) {
  36024. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  36025. } elseif (is_object($value)) {
  36026. $result[$key] = array('object', get_class($value));
  36027. } elseif (is_array($value)) {
  36028. if ($level > 10) {
  36029. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  36030. } else {
  36031. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  36032. }
  36033. } elseif (null === $value) {
  36034. $result[$key] = array('null', null);
  36035. } elseif (is_bool($value)) {
  36036. $result[$key] = array('boolean', $value);
  36037. } elseif (is_resource($value)) {
  36038. $result[$key] = array('resource', get_resource_type($value));
  36039. } else {
  36040. $result[$key] = array('string', (string) $value);
  36041. }
  36042. }
  36043. return $result;
  36044. }
  36045. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  36046. {
  36047. $array = new \ArrayObject($value);
  36048. return $array['__PHP_Incomplete_Class_Name'];
  36049. }
  36050. }
  36051. <?php
  36052. namespace Symfony\Component\Debug\Exception;
  36053. class OutOfMemoryException extends FatalErrorException
  36054. {
  36055. }
  36056. <?php
  36057. namespace Symfony\Component\Debug\Exception;
  36058. class UndefinedFunctionException extends FatalErrorException
  36059. {
  36060. public function __construct($message, \ErrorException $previous)
  36061. {
  36062. parent::__construct(
  36063. $message,
  36064. $previous->getCode(),
  36065. $previous->getSeverity(),
  36066. $previous->getFile(),
  36067. $previous->getLine(),
  36068. $previous->getPrevious()
  36069. );
  36070. $this->setTrace($previous->getTrace());
  36071. }
  36072. }
  36073. <?php
  36074. namespace Symfony\Component\Debug\Exception;
  36075. class UndefinedMethodException extends FatalErrorException
  36076. {
  36077. public function __construct($message, \ErrorException $previous)
  36078. {
  36079. parent::__construct(
  36080. $message,
  36081. $previous->getCode(),
  36082. $previous->getSeverity(),
  36083. $previous->getFile(),
  36084. $previous->getLine(),
  36085. $previous->getPrevious()
  36086. );
  36087. $this->setTrace($previous->getTrace());
  36088. }
  36089. }
  36090. <?php
  36091. namespace Symfony\Component\Debug;
  36092. use Symfony\Component\HttpFoundation\Response;
  36093. use Symfony\Component\Debug\Exception\FlattenException;
  36094. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  36095. class ExceptionHandler
  36096. {
  36097. private $debug;
  36098. private $charset;
  36099. private $handler;
  36100. private $caughtBuffer;
  36101. private $caughtLength;
  36102. private $fileLinkFormat;
  36103. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  36104. {
  36105. if (false !== strpos($charset, '%')) {
  36106. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since version 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  36107. $pivot = $fileLinkFormat;
  36108. $fileLinkFormat = $charset;
  36109. $charset = $pivot;
  36110. }
  36111. $this->debug = $debug;
  36112. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  36113. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  36114. }
  36115. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  36116. {
  36117. $handler = new static($debug, $charset, $fileLinkFormat);
  36118. $prev = set_exception_handler(array($handler, 'handle'));
  36119. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  36120. restore_exception_handler();
  36121. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  36122. }
  36123. return $handler;
  36124. }
  36125. public function setHandler($handler)
  36126. {
  36127. if (null !== $handler && !is_callable($handler)) {
  36128. throw new \LogicException('The exception handler must be a valid PHP callable.');
  36129. }
  36130. $old = $this->handler;
  36131. $this->handler = $handler;
  36132. return $old;
  36133. }
  36134. public function setFileLinkFormat($format)
  36135. {
  36136. $old = $this->fileLinkFormat;
  36137. $this->fileLinkFormat = $format;
  36138. return $old;
  36139. }
  36140. public function handle(\Exception $exception)
  36141. {
  36142. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  36143. $this->failSafeHandle($exception);
  36144. return;
  36145. }
  36146. $caughtLength = $this->caughtLength = 0;
  36147. ob_start(array($this, 'catchOutput'));
  36148. $this->failSafeHandle($exception);
  36149. while (null === $this->caughtBuffer && ob_end_flush()) {
  36150. }
  36151. if (isset($this->caughtBuffer[0])) {
  36152. ob_start(array($this, 'cleanOutput'));
  36153. echo $this->caughtBuffer;
  36154. $caughtLength = ob_get_length();
  36155. }
  36156. $this->caughtBuffer = null;
  36157. try {
  36158. call_user_func($this->handler, $exception);
  36159. $this->caughtLength = $caughtLength;
  36160. } catch (\Exception $e) {
  36161. if (!$caughtLength) {
  36162. throw $exception;
  36163. }
  36164. }
  36165. }
  36166. private function failSafeHandle(\Exception $exception)
  36167. {
  36168. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  36169. && __CLASS__ !== get_class($this)
  36170. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  36171. && __CLASS__ !== $reflector->class
  36172. ) {
  36173. $response = $this->createResponse($exception);
  36174. $response->sendHeaders();
  36175. $response->sendContent();
  36176. @trigger_error(sprintf("The %s::createResponse method is deprecated since 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  36177. return;
  36178. }
  36179. $this->sendPhpResponse($exception);
  36180. }
  36181. public function sendPhpResponse($exception)
  36182. {
  36183. if (!$exception instanceof FlattenException) {
  36184. $exception = FlattenException::create($exception);
  36185. }
  36186. if (!headers_sent()) {
  36187. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  36188. foreach ($exception->getHeaders() as $name => $value) {
  36189. header($name.': '.$value, false);
  36190. }
  36191. header('Content-Type: text/html; charset='.$this->charset);
  36192. }
  36193. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  36194. }
  36195. public function createResponse($exception)
  36196. {
  36197. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36198. if (!$exception instanceof FlattenException) {
  36199. $exception = FlattenException::create($exception);
  36200. }
  36201. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  36202. }
  36203. public function getHtml($exception)
  36204. {
  36205. if (!$exception instanceof FlattenException) {
  36206. $exception = FlattenException::create($exception);
  36207. }
  36208. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  36209. }
  36210. public function getContent(FlattenException $exception)
  36211. {
  36212. switch ($exception->getStatusCode()) {
  36213. case 404:
  36214. $title = 'Sorry, the page you are looking for could not be found.';
  36215. break;
  36216. default:
  36217. $title = 'Whoops, looks like something went wrong.';
  36218. }
  36219. $content = '';
  36220. if ($this->debug) {
  36221. try {
  36222. $count = count($exception->getAllPrevious());
  36223. $total = $count + 1;
  36224. foreach ($exception->toArray() as $position => $e) {
  36225. $ind = $count - $position + 1;
  36226. $class = $this->formatClass($e['class']);
  36227. $message = nl2br($this->escapeHtml($e['message']));
  36228. $content .= sprintf(<<<'EOF'
  36229. <h2 class="block_exception clear_fix">
  36230. <span class="exception_counter">%d/%d</span>
  36231. <span class="exception_title">%s%s:</span>
  36232. <span class="exception_message">%s</span>
  36233. </h2>
  36234. <div class="block">
  36235. <ol class="traces list_exception">
  36236. EOF
  36237. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  36238. foreach ($e['trace'] as $trace) {
  36239. $content .= ' <li>';
  36240. if ($trace['function']) {
  36241. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  36242. }
  36243. if (isset($trace['file']) && isset($trace['line'])) {
  36244. $content .= $this->formatPath($trace['file'], $trace['line']);
  36245. }
  36246. $content .= "</li>\n";
  36247. }
  36248. $content .= " </ol>\n</div>\n";
  36249. }
  36250. } catch (\Exception $e) {
  36251. if ($this->debug) {
  36252. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  36253. } else {
  36254. $title = 'Whoops, looks like something went wrong.';
  36255. }
  36256. }
  36257. }
  36258. return <<<EOF
  36259. <div id="sf-resetcontent" class="sf-reset">
  36260. <h1>$title</h1>
  36261. $content
  36262. </div>
  36263. EOF;
  36264. }
  36265. public function getStylesheet(FlattenException $exception)
  36266. {
  36267. return <<<'EOF'
  36268. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  36269. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  36270. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  36271. .sf-reset .clear_fix { display:inline-block; }
  36272. .sf-reset * html .clear_fix { height:1%; }
  36273. .sf-reset .clear_fix { display:block; }
  36274. .sf-reset, .sf-reset .block { margin: auto }
  36275. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  36276. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  36277. .sf-reset strong { font-weight:bold; }
  36278. .sf-reset a { color:#6c6159; cursor: default; }
  36279. .sf-reset a img { border:none; }
  36280. .sf-reset a:hover { text-decoration:underline; }
  36281. .sf-reset em { font-style:italic; }
  36282. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  36283. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  36284. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  36285. .sf-reset .exception_message { margin-left: 3em; display: block; }
  36286. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  36287. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  36288. -webkit-border-bottom-right-radius: 16px;
  36289. -webkit-border-bottom-left-radius: 16px;
  36290. -moz-border-radius-bottomright: 16px;
  36291. -moz-border-radius-bottomleft: 16px;
  36292. border-bottom-right-radius: 16px;
  36293. border-bottom-left-radius: 16px;
  36294. border-bottom:1px solid #ccc;
  36295. border-right:1px solid #ccc;
  36296. border-left:1px solid #ccc;
  36297. word-wrap: break-word;
  36298. }
  36299. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  36300. -webkit-border-top-left-radius: 16px;
  36301. -webkit-border-top-right-radius: 16px;
  36302. -moz-border-radius-topleft: 16px;
  36303. -moz-border-radius-topright: 16px;
  36304. border-top-left-radius: 16px;
  36305. border-top-right-radius: 16px;
  36306. border-top:1px solid #ccc;
  36307. border-right:1px solid #ccc;
  36308. border-left:1px solid #ccc;
  36309. overflow: hidden;
  36310. word-wrap: break-word;
  36311. }
  36312. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  36313. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  36314. .sf-reset ol { padding: 10px 0; }
  36315. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  36316. -webkit-border-radius: 10px;
  36317. -moz-border-radius: 10px;
  36318. border-radius: 10px;
  36319. border: 1px solid #ccc;
  36320. }
  36321. EOF;
  36322. }
  36323. private function decorate($content, $css)
  36324. {
  36325. return <<<EOF
  36326. <!DOCTYPE html>
  36327. <html>
  36328. <head>
  36329. <meta charset="{$this->charset}" />
  36330. <meta name="robots" content="noindex,nofollow" />
  36331. <style>
  36332. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  36333. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  36334. html { background: #eee; padding: 10px }
  36335. img { border: 0; }
  36336. #sf-resetcontent { width:970px; margin:0 auto; }
  36337. $css
  36338. </style>
  36339. </head>
  36340. <body>
  36341. $content
  36342. </body>
  36343. </html>
  36344. EOF;
  36345. }
  36346. private function formatClass($class)
  36347. {
  36348. $parts = explode('\\', $class);
  36349. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  36350. }
  36351. private function formatPath($path, $line)
  36352. {
  36353. $path = $this->escapeHtml($path);
  36354. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  36355. if ($linkFormat = $this->fileLinkFormat) {
  36356. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  36357. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  36358. }
  36359. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  36360. }
  36361. private function formatArgs(array $args)
  36362. {
  36363. $result = array();
  36364. foreach ($args as $key => $item) {
  36365. if ('object' === $item[0]) {
  36366. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  36367. } elseif ('array' === $item[0]) {
  36368. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  36369. } elseif ('string' === $item[0]) {
  36370. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  36371. } elseif ('null' === $item[0]) {
  36372. $formattedValue = '<em>null</em>';
  36373. } elseif ('boolean' === $item[0]) {
  36374. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  36375. } elseif ('resource' === $item[0]) {
  36376. $formattedValue = '<em>resource</em>';
  36377. } else {
  36378. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  36379. }
  36380. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
  36381. }
  36382. return implode(', ', $result);
  36383. }
  36384. protected static function utf8Htmlize($str)
  36385. {
  36386. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  36387. return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  36388. }
  36389. private function escapeHtml($str)
  36390. {
  36391. return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  36392. }
  36393. public function catchOutput($buffer)
  36394. {
  36395. $this->caughtBuffer = $buffer;
  36396. return '';
  36397. }
  36398. public function cleanOutput($buffer)
  36399. {
  36400. if ($this->caughtLength) {
  36401. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  36402. if (isset($cleanBuffer[0])) {
  36403. $buffer = $cleanBuffer;
  36404. }
  36405. }
  36406. return $buffer;
  36407. }
  36408. }
  36409. <?php
  36410. namespace Symfony\Component\Debug\FatalErrorHandler;
  36411. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  36412. use Symfony\Component\Debug\Exception\FatalErrorException;
  36413. use Symfony\Component\Debug\DebugClassLoader;
  36414. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  36415. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  36416. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  36417. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  36418. {
  36419. public function handleError(array $error, FatalErrorException $exception)
  36420. {
  36421. $messageLen = strlen($error['message']);
  36422. $notFoundSuffix = '\' not found';
  36423. $notFoundSuffixLen = strlen($notFoundSuffix);
  36424. if ($notFoundSuffixLen > $messageLen) {
  36425. return;
  36426. }
  36427. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  36428. return;
  36429. }
  36430. foreach (array('class', 'interface', 'trait') as $typeName) {
  36431. $prefix = ucfirst($typeName).' \'';
  36432. $prefixLen = strlen($prefix);
  36433. if (0 !== strpos($error['message'], $prefix)) {
  36434. continue;
  36435. }
  36436. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  36437. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  36438. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  36439. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  36440. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  36441. $tail = ' for another namespace?';
  36442. } else {
  36443. $className = $fullyQualifiedClassName;
  36444. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  36445. $tail = '?';
  36446. }
  36447. if ($candidates = $this->getClassCandidates($className)) {
  36448. $tail = array_pop($candidates).'"?';
  36449. if ($candidates) {
  36450. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  36451. } else {
  36452. $tail = ' for "'.$tail;
  36453. }
  36454. }
  36455. $message .= "\nDid you forget a \"use\" statement".$tail;
  36456. return new ClassNotFoundException($message, $exception);
  36457. }
  36458. }
  36459. private function getClassCandidates($class)
  36460. {
  36461. if (!is_array($functions = spl_autoload_functions())) {
  36462. return array();
  36463. }
  36464. $classes = array();
  36465. foreach ($functions as $function) {
  36466. if (!is_array($function)) {
  36467. continue;
  36468. }
  36469. if ($function[0] instanceof DebugClassLoader) {
  36470. $function = $function[0]->getClassLoader();
  36471. if (is_object($function)) {
  36472. $function = array($function);
  36473. }
  36474. if (!is_array($function)) {
  36475. continue;
  36476. }
  36477. }
  36478. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  36479. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  36480. foreach ($paths as $path) {
  36481. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  36482. }
  36483. }
  36484. }
  36485. if ($function[0] instanceof ComposerClassLoader) {
  36486. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  36487. foreach ($paths as $path) {
  36488. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  36489. }
  36490. }
  36491. }
  36492. }
  36493. return array_unique($classes);
  36494. }
  36495. private function findClassInPath($path, $class, $prefix)
  36496. {
  36497. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  36498. return array();
  36499. }
  36500. $classes = array();
  36501. $filename = $class.'.php';
  36502. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  36503. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  36504. $classes[] = $class;
  36505. }
  36506. }
  36507. return $classes;
  36508. }
  36509. private function convertFileToClass($path, $file, $prefix)
  36510. {
  36511. $candidates = array(
  36512. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  36513. $prefix.$namespacedClass,
  36514. $prefix.'\\'.$namespacedClass,
  36515. str_replace('\\', '_', $namespacedClass),
  36516. str_replace('\\', '_', $prefix.$namespacedClass),
  36517. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  36518. );
  36519. if ($prefix) {
  36520. $candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);});
  36521. }
  36522. foreach ($candidates as $candidate) {
  36523. if ($this->classExists($candidate)) {
  36524. return $candidate;
  36525. }
  36526. }
  36527. require_once $file;
  36528. foreach ($candidates as $candidate) {
  36529. if ($this->classExists($candidate)) {
  36530. return $candidate;
  36531. }
  36532. }
  36533. }
  36534. private function classExists($class)
  36535. {
  36536. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  36537. }
  36538. }
  36539. <?php
  36540. namespace Symfony\Component\Debug\FatalErrorHandler;
  36541. use Symfony\Component\Debug\Exception\FatalErrorException;
  36542. interface FatalErrorHandlerInterface
  36543. {
  36544. public function handleError(array $error, FatalErrorException $exception);
  36545. }
  36546. <?php
  36547. namespace Symfony\Component\Debug\FatalErrorHandler;
  36548. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  36549. use Symfony\Component\Debug\Exception\FatalErrorException;
  36550. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  36551. {
  36552. public function handleError(array $error, FatalErrorException $exception)
  36553. {
  36554. $messageLen = strlen($error['message']);
  36555. $notFoundSuffix = '()';
  36556. $notFoundSuffixLen = strlen($notFoundSuffix);
  36557. if ($notFoundSuffixLen > $messageLen) {
  36558. return;
  36559. }
  36560. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  36561. return;
  36562. }
  36563. $prefix = 'Call to undefined function ';
  36564. $prefixLen = strlen($prefix);
  36565. if (0 !== strpos($error['message'], $prefix)) {
  36566. return;
  36567. }
  36568. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  36569. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  36570. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  36571. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  36572. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  36573. } else {
  36574. $functionName = $fullyQualifiedFunctionName;
  36575. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  36576. }
  36577. $candidates = array();
  36578. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  36579. foreach ($definedFunctionNames as $definedFunctionName) {
  36580. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  36581. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  36582. } else {
  36583. $definedFunctionNameBasename = $definedFunctionName;
  36584. }
  36585. if ($definedFunctionNameBasename === $functionName) {
  36586. $candidates[] = '\\'.$definedFunctionName;
  36587. }
  36588. }
  36589. }
  36590. if ($candidates) {
  36591. sort($candidates);
  36592. $last = array_pop($candidates).'"?';
  36593. if ($candidates) {
  36594. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  36595. } else {
  36596. $candidates = '"'.$last;
  36597. }
  36598. $message .= "\nDid you mean to call ".$candidates;
  36599. }
  36600. return new UndefinedFunctionException($message, $exception);
  36601. }
  36602. }
  36603. <?php
  36604. namespace Symfony\Component\Debug\FatalErrorHandler;
  36605. use Symfony\Component\Debug\Exception\FatalErrorException;
  36606. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  36607. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  36608. {
  36609. public function handleError(array $error, FatalErrorException $exception)
  36610. {
  36611. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  36612. if (!$matches) {
  36613. return;
  36614. }
  36615. $className = $matches[1];
  36616. $methodName = $matches[2];
  36617. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  36618. $candidates = array();
  36619. foreach (get_class_methods($className) as $definedMethodName) {
  36620. $lev = levenshtein($methodName, $definedMethodName);
  36621. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  36622. $candidates[] = $definedMethodName;
  36623. }
  36624. }
  36625. if ($candidates) {
  36626. sort($candidates);
  36627. $last = array_pop($candidates).'"?';
  36628. if ($candidates) {
  36629. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  36630. } else {
  36631. $candidates = '"'.$last;
  36632. }
  36633. $message .= "\nDid you mean to call ".$candidates;
  36634. }
  36635. return new UndefinedMethodException($message, $exception);
  36636. }
  36637. }
  36638. Copyright (c) 2004-2016 Fabien Potencier
  36639. Permission is hereby granted, free of charge, to any person obtaining a copy
  36640. of this software and associated documentation files (the "Software"), to deal
  36641. in the Software without restriction, including without limitation the rights
  36642. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36643. copies of the Software, and to permit persons to whom the Software is furnished
  36644. to do so, subject to the following conditions:
  36645. The above copyright notice and this permission notice shall be included in all
  36646. copies or substantial portions of the Software.
  36647. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36648. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36649. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36650. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36651. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36652. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36653. THE SOFTWARE.
  36654. <?php
  36655. namespace Symfony\Component\Filesystem\Exception;
  36656. interface ExceptionInterface
  36657. {
  36658. }
  36659. <?php
  36660. namespace Symfony\Component\Filesystem\Exception;
  36661. class FileNotFoundException extends IOException
  36662. {
  36663. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  36664. {
  36665. if (null === $message) {
  36666. if (null === $path) {
  36667. $message = 'File could not be found.';
  36668. } else {
  36669. $message = sprintf('File "%s" could not be found.', $path);
  36670. }
  36671. }
  36672. parent::__construct($message, $code, $previous, $path);
  36673. }
  36674. }
  36675. <?php
  36676. namespace Symfony\Component\Filesystem\Exception;
  36677. class IOException extends \RuntimeException implements IOExceptionInterface
  36678. {
  36679. private $path;
  36680. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  36681. {
  36682. $this->path = $path;
  36683. parent::__construct($message, $code, $previous);
  36684. }
  36685. public function getPath()
  36686. {
  36687. return $this->path;
  36688. }
  36689. }
  36690. <?php
  36691. namespace Symfony\Component\Filesystem\Exception;
  36692. interface IOExceptionInterface extends ExceptionInterface
  36693. {
  36694. public function getPath();
  36695. }
  36696. <?php
  36697. namespace Symfony\Component\Filesystem;
  36698. use Symfony\Component\Filesystem\Exception\IOException;
  36699. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  36700. class Filesystem
  36701. {
  36702. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  36703. {
  36704. if (stream_is_local($originFile) && !is_file($originFile)) {
  36705. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  36706. }
  36707. $this->mkdir(dirname($targetFile));
  36708. $doCopy = true;
  36709. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  36710. $doCopy = filemtime($originFile) > filemtime($targetFile);
  36711. }
  36712. if ($doCopy) {
  36713. if (false === $source = @fopen($originFile, 'r')) {
  36714. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  36715. }
  36716. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  36717. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  36718. }
  36719. $bytesCopied = stream_copy_to_stream($source, $target);
  36720. fclose($source);
  36721. fclose($target);
  36722. unset($source, $target);
  36723. if (!is_file($targetFile)) {
  36724. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  36725. }
  36726. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  36727. if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
  36728. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  36729. }
  36730. }
  36731. }
  36732. public function mkdir($dirs, $mode = 0777)
  36733. {
  36734. foreach ($this->toIterator($dirs) as $dir) {
  36735. if (is_dir($dir)) {
  36736. continue;
  36737. }
  36738. if (true !== @mkdir($dir, $mode, true)) {
  36739. $error = error_get_last();
  36740. if (!is_dir($dir)) {
  36741. if ($error) {
  36742. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  36743. }
  36744. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  36745. }
  36746. }
  36747. }
  36748. }
  36749. public function exists($files)
  36750. {
  36751. foreach ($this->toIterator($files) as $file) {
  36752. if ('\\' === DIRECTORY_SEPARATOR && strlen($file) > 258) {
  36753. throw new IOException('Could not check if file exist because path length exceeds 258 characters.', 0, null, $file);
  36754. }
  36755. if (!file_exists($file)) {
  36756. return false;
  36757. }
  36758. }
  36759. return true;
  36760. }
  36761. public function touch($files, $time = null, $atime = null)
  36762. {
  36763. foreach ($this->toIterator($files) as $file) {
  36764. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  36765. if (true !== $touch) {
  36766. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  36767. }
  36768. }
  36769. }
  36770. public function remove($files)
  36771. {
  36772. if ($files instanceof \Traversable) {
  36773. $files = iterator_to_array($files, false);
  36774. } elseif (!is_array($files)) {
  36775. $files = array($files);
  36776. }
  36777. $files = array_reverse($files);
  36778. foreach ($files as $file) {
  36779. if (is_link($file)) {
  36780. if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) {
  36781. $error = error_get_last();
  36782. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message']));
  36783. }
  36784. } elseif (is_dir($file)) {
  36785. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  36786. if (!@rmdir($file) && file_exists($file)) {
  36787. $error = error_get_last();
  36788. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
  36789. }
  36790. } elseif (!@unlink($file) && file_exists($file)) {
  36791. $error = error_get_last();
  36792. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
  36793. }
  36794. }
  36795. }
  36796. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  36797. {
  36798. foreach ($this->toIterator($files) as $file) {
  36799. if (true !== @chmod($file, $mode & ~$umask)) {
  36800. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  36801. }
  36802. if ($recursive && is_dir($file) && !is_link($file)) {
  36803. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  36804. }
  36805. }
  36806. }
  36807. public function chown($files, $user, $recursive = false)
  36808. {
  36809. foreach ($this->toIterator($files) as $file) {
  36810. if ($recursive && is_dir($file) && !is_link($file)) {
  36811. $this->chown(new \FilesystemIterator($file), $user, true);
  36812. }
  36813. if (is_link($file) && function_exists('lchown')) {
  36814. if (true !== @lchown($file, $user)) {
  36815. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  36816. }
  36817. } else {
  36818. if (true !== @chown($file, $user)) {
  36819. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  36820. }
  36821. }
  36822. }
  36823. }
  36824. public function chgrp($files, $group, $recursive = false)
  36825. {
  36826. foreach ($this->toIterator($files) as $file) {
  36827. if ($recursive && is_dir($file) && !is_link($file)) {
  36828. $this->chgrp(new \FilesystemIterator($file), $group, true);
  36829. }
  36830. if (is_link($file) && function_exists('lchgrp')) {
  36831. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  36832. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  36833. }
  36834. } else {
  36835. if (true !== @chgrp($file, $group)) {
  36836. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  36837. }
  36838. }
  36839. }
  36840. }
  36841. public function rename($origin, $target, $overwrite = false)
  36842. {
  36843. if (!$overwrite && $this->isReadable($target)) {
  36844. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  36845. }
  36846. if (true !== @rename($origin, $target)) {
  36847. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  36848. }
  36849. }
  36850. private function isReadable($filename)
  36851. {
  36852. if ('\\' === DIRECTORY_SEPARATOR && strlen($filename) > 258) {
  36853. throw new IOException('Could not check if file is readable because path length exceeds 258 characters.', 0, null, $filename);
  36854. }
  36855. return is_readable($filename);
  36856. }
  36857. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  36858. {
  36859. if ('\\' === DIRECTORY_SEPARATOR) {
  36860. $originDir = strtr($originDir, '/', '\\');
  36861. $targetDir = strtr($targetDir, '/', '\\');
  36862. if ($copyOnWindows) {
  36863. $this->mirror($originDir, $targetDir);
  36864. return;
  36865. }
  36866. }
  36867. $this->mkdir(dirname($targetDir));
  36868. $ok = false;
  36869. if (is_link($targetDir)) {
  36870. if (readlink($targetDir) != $originDir) {
  36871. $this->remove($targetDir);
  36872. } else {
  36873. $ok = true;
  36874. }
  36875. }
  36876. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  36877. $report = error_get_last();
  36878. if (is_array($report)) {
  36879. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  36880. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  36881. }
  36882. }
  36883. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  36884. }
  36885. }
  36886. public function makePathRelative($endPath, $startPath)
  36887. {
  36888. if ('\\' === DIRECTORY_SEPARATOR) {
  36889. $endPath = str_replace('\\', '/', $endPath);
  36890. $startPath = str_replace('\\', '/', $startPath);
  36891. }
  36892. $startPathArr = explode('/', trim($startPath, '/'));
  36893. $endPathArr = explode('/', trim($endPath, '/'));
  36894. $index = 0;
  36895. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  36896. ++$index;
  36897. }
  36898. if (count($startPathArr) === 1 && $startPathArr[0] === '') {
  36899. $depth = 0;
  36900. } else {
  36901. $depth = count($startPathArr) - $index;
  36902. }
  36903. if ('/' === $startPath[0] && 0 === $index && 0 === $depth) {
  36904. $traverser = '';
  36905. } else {
  36906. $traverser = str_repeat('../', $depth);
  36907. }
  36908. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  36909. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  36910. return '' === $relativePath ? './' : $relativePath;
  36911. }
  36912. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  36913. {
  36914. $targetDir = rtrim($targetDir, '/\\');
  36915. $originDir = rtrim($originDir, '/\\');
  36916. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  36917. $deleteIterator = $iterator;
  36918. if (null === $deleteIterator) {
  36919. $flags = \FilesystemIterator::SKIP_DOTS;
  36920. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  36921. }
  36922. foreach ($deleteIterator as $file) {
  36923. $origin = str_replace($targetDir, $originDir, $file->getPathname());
  36924. if (!$this->exists($origin)) {
  36925. $this->remove($file);
  36926. }
  36927. }
  36928. }
  36929. $copyOnWindows = false;
  36930. if (isset($options['copy_on_windows'])) {
  36931. $copyOnWindows = $options['copy_on_windows'];
  36932. }
  36933. if (null === $iterator) {
  36934. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  36935. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  36936. }
  36937. if ($this->exists($originDir)) {
  36938. $this->mkdir($targetDir);
  36939. }
  36940. foreach ($iterator as $file) {
  36941. $target = str_replace($originDir, $targetDir, $file->getPathname());
  36942. if ($copyOnWindows) {
  36943. if (is_file($file)) {
  36944. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  36945. } elseif (is_dir($file)) {
  36946. $this->mkdir($target);
  36947. } else {
  36948. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  36949. }
  36950. } else {
  36951. if (is_link($file)) {
  36952. $this->symlink($file->getLinkTarget(), $target);
  36953. } elseif (is_dir($file)) {
  36954. $this->mkdir($target);
  36955. } elseif (is_file($file)) {
  36956. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  36957. } else {
  36958. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  36959. }
  36960. }
  36961. }
  36962. }
  36963. public function isAbsolutePath($file)
  36964. {
  36965. return strspn($file, '/\\', 0, 1)
  36966. || (strlen($file) > 3 && ctype_alpha($file[0])
  36967. && substr($file, 1, 1) === ':'
  36968. && strspn($file, '/\\', 2, 1)
  36969. )
  36970. || null !== parse_url($file, PHP_URL_SCHEME)
  36971. ;
  36972. }
  36973. public function tempnam($dir, $prefix)
  36974. {
  36975. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  36976. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  36977. $tmpFile = @tempnam($hierarchy, $prefix);
  36978. if (false !== $tmpFile) {
  36979. if (null !== $scheme && 'gs' !== $scheme) {
  36980. return $scheme.'://'.$tmpFile;
  36981. }
  36982. return $tmpFile;
  36983. }
  36984. throw new IOException('A temporary file could not be created.');
  36985. }
  36986. for ($i = 0; $i < 10; ++$i) {
  36987. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  36988. $handle = @fopen($tmpFile, 'x+');
  36989. if (false === $handle) {
  36990. continue;
  36991. }
  36992. @fclose($handle);
  36993. return $tmpFile;
  36994. }
  36995. throw new IOException('A temporary file could not be created.');
  36996. }
  36997. public function dumpFile($filename, $content, $mode = 0666)
  36998. {
  36999. $dir = dirname($filename);
  37000. if (!is_dir($dir)) {
  37001. $this->mkdir($dir);
  37002. } elseif (!is_writable($dir)) {
  37003. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  37004. }
  37005. $tmpFile = $this->tempnam($dir, basename($filename));
  37006. if (false === @file_put_contents($tmpFile, $content)) {
  37007. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  37008. }
  37009. if (null !== $mode) {
  37010. if (func_num_args() > 2) {
  37011. @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  37012. }
  37013. $this->chmod($tmpFile, $mode);
  37014. }
  37015. $this->rename($tmpFile, $filename, true);
  37016. }
  37017. private function toIterator($files)
  37018. {
  37019. if (!$files instanceof \Traversable) {
  37020. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  37021. }
  37022. return $files;
  37023. }
  37024. private function getSchemeAndHierarchy($filename)
  37025. {
  37026. $components = explode('://', $filename, 2);
  37027. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  37028. }
  37029. }
  37030. Copyright (c) 2004-2016 Fabien Potencier
  37031. Permission is hereby granted, free of charge, to any person obtaining a copy
  37032. of this software and associated documentation files (the "Software"), to deal
  37033. in the Software without restriction, including without limitation the rights
  37034. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37035. copies of the Software, and to permit persons to whom the Software is furnished
  37036. to do so, subject to the following conditions:
  37037. The above copyright notice and this permission notice shall be included in all
  37038. copies or substantial portions of the Software.
  37039. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37040. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37041. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37042. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37043. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37044. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37045. THE SOFTWARE.
  37046. <?php
  37047. namespace Symfony\Component\Filesystem;
  37048. use Symfony\Component\Filesystem\Exception\IOException;
  37049. class LockHandler
  37050. {
  37051. private $file;
  37052. private $handle;
  37053. public function __construct($name, $lockPath = null)
  37054. {
  37055. $lockPath = $lockPath ?: sys_get_temp_dir();
  37056. if (!is_dir($lockPath)) {
  37057. $fs = new Filesystem();
  37058. $fs->mkdir($lockPath);
  37059. }
  37060. if (!is_writable($lockPath)) {
  37061. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  37062. }
  37063. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  37064. }
  37065. public function lock($blocking = false)
  37066. {
  37067. if ($this->handle) {
  37068. return true;
  37069. }
  37070. set_error_handler(function () {});
  37071. if (!$this->handle = fopen($this->file, 'r')) {
  37072. if ($this->handle = fopen($this->file, 'x')) {
  37073. chmod($this->file, 0444);
  37074. } elseif (!$this->handle = fopen($this->file, 'r')) {
  37075. usleep(100);
  37076. $this->handle = fopen($this->file, 'r');
  37077. }
  37078. }
  37079. restore_error_handler();
  37080. if (!$this->handle) {
  37081. $error = error_get_last();
  37082. throw new IOException($error['message'], 0, null, $this->file);
  37083. }
  37084. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  37085. fclose($this->handle);
  37086. $this->handle = null;
  37087. return false;
  37088. }
  37089. return true;
  37090. }
  37091. public function release()
  37092. {
  37093. if ($this->handle) {
  37094. flock($this->handle, LOCK_UN | LOCK_NB);
  37095. fclose($this->handle);
  37096. $this->handle = null;
  37097. }
  37098. }
  37099. }
  37100. <?php
  37101. namespace Symfony\Component\Finder\Adapter;
  37102. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  37103. abstract class AbstractAdapter implements AdapterInterface
  37104. {
  37105. protected $followLinks = false;
  37106. protected $mode = 0;
  37107. protected $minDepth = 0;
  37108. protected $maxDepth = PHP_INT_MAX;
  37109. protected $exclude = array();
  37110. protected $names = array();
  37111. protected $notNames = array();
  37112. protected $contains = array();
  37113. protected $notContains = array();
  37114. protected $sizes = array();
  37115. protected $dates = array();
  37116. protected $filters = array();
  37117. protected $sort = false;
  37118. protected $paths = array();
  37119. protected $notPaths = array();
  37120. protected $ignoreUnreadableDirs = false;
  37121. private static $areSupported = array();
  37122. public function isSupported()
  37123. {
  37124. $name = $this->getName();
  37125. if (!array_key_exists($name, self::$areSupported)) {
  37126. self::$areSupported[$name] = $this->canBeUsed();
  37127. }
  37128. return self::$areSupported[$name];
  37129. }
  37130. public function setFollowLinks($followLinks)
  37131. {
  37132. $this->followLinks = $followLinks;
  37133. return $this;
  37134. }
  37135. public function setMode($mode)
  37136. {
  37137. $this->mode = $mode;
  37138. return $this;
  37139. }
  37140. public function setDepths(array $depths)
  37141. {
  37142. $this->minDepth = 0;
  37143. $this->maxDepth = PHP_INT_MAX;
  37144. foreach ($depths as $comparator) {
  37145. switch ($comparator->getOperator()) {
  37146. case '>':
  37147. $this->minDepth = $comparator->getTarget() + 1;
  37148. break;
  37149. case '>=':
  37150. $this->minDepth = $comparator->getTarget();
  37151. break;
  37152. case '<':
  37153. $this->maxDepth = $comparator->getTarget() - 1;
  37154. break;
  37155. case '<=':
  37156. $this->maxDepth = $comparator->getTarget();
  37157. break;
  37158. default:
  37159. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  37160. }
  37161. }
  37162. return $this;
  37163. }
  37164. public function setExclude(array $exclude)
  37165. {
  37166. $this->exclude = $exclude;
  37167. return $this;
  37168. }
  37169. public function setNames(array $names)
  37170. {
  37171. $this->names = $names;
  37172. return $this;
  37173. }
  37174. public function setNotNames(array $notNames)
  37175. {
  37176. $this->notNames = $notNames;
  37177. return $this;
  37178. }
  37179. public function setContains(array $contains)
  37180. {
  37181. $this->contains = $contains;
  37182. return $this;
  37183. }
  37184. public function setNotContains(array $notContains)
  37185. {
  37186. $this->notContains = $notContains;
  37187. return $this;
  37188. }
  37189. public function setSizes(array $sizes)
  37190. {
  37191. $this->sizes = $sizes;
  37192. return $this;
  37193. }
  37194. public function setDates(array $dates)
  37195. {
  37196. $this->dates = $dates;
  37197. return $this;
  37198. }
  37199. public function setFilters(array $filters)
  37200. {
  37201. $this->filters = $filters;
  37202. return $this;
  37203. }
  37204. public function setSort($sort)
  37205. {
  37206. $this->sort = $sort;
  37207. return $this;
  37208. }
  37209. public function setPath(array $paths)
  37210. {
  37211. $this->paths = $paths;
  37212. return $this;
  37213. }
  37214. public function setNotPath(array $notPaths)
  37215. {
  37216. $this->notPaths = $notPaths;
  37217. return $this;
  37218. }
  37219. public function ignoreUnreadableDirs($ignore = true)
  37220. {
  37221. $this->ignoreUnreadableDirs = (bool) $ignore;
  37222. return $this;
  37223. }
  37224. abstract protected function canBeUsed();
  37225. }
  37226. <?php
  37227. namespace Symfony\Component\Finder\Adapter;
  37228. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  37229. use Symfony\Component\Finder\Exception\AccessDeniedException;
  37230. use Symfony\Component\Finder\Iterator;
  37231. use Symfony\Component\Finder\Shell\Shell;
  37232. use Symfony\Component\Finder\Expression\Expression;
  37233. use Symfony\Component\Finder\Shell\Command;
  37234. use Symfony\Component\Finder\Comparator\NumberComparator;
  37235. use Symfony\Component\Finder\Comparator\DateComparator;
  37236. abstract class AbstractFindAdapter extends AbstractAdapter
  37237. {
  37238. protected $shell;
  37239. public function __construct()
  37240. {
  37241. $this->shell = new Shell();
  37242. }
  37243. public function searchInDirectory($dir)
  37244. {
  37245. $dir = realpath($dir);
  37246. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  37247. return new Iterator\FilePathsIterator(array(), $dir);
  37248. }
  37249. $command = Command::create();
  37250. $find = $this->buildFindCommand($command, $dir);
  37251. if ($this->followLinks) {
  37252. $find->add('-follow');
  37253. }
  37254. $find->add('-mindepth')->add($this->minDepth + 1);
  37255. if (PHP_INT_MAX !== $this->maxDepth) {
  37256. $find->add('-maxdepth')->add($this->maxDepth + 1);
  37257. }
  37258. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  37259. $find->add('-type d');
  37260. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  37261. $find->add('-type f');
  37262. }
  37263. $this->buildNamesFiltering($find, $this->names);
  37264. $this->buildNamesFiltering($find, $this->notNames, true);
  37265. $this->buildPathsFiltering($find, $dir, $this->paths);
  37266. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  37267. $this->buildSizesFiltering($find, $this->sizes);
  37268. $this->buildDatesFiltering($find, $this->dates);
  37269. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  37270. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  37271. if ($useGrep && ($this->contains || $this->notContains)) {
  37272. $grep = $command->ins('grep');
  37273. $this->buildContentFiltering($grep, $this->contains);
  37274. $this->buildContentFiltering($grep, $this->notContains, true);
  37275. }
  37276. if ($useSort) {
  37277. $this->buildSorting($command, $this->sort);
  37278. }
  37279. $command->setErrorHandler(
  37280. $this->ignoreUnreadableDirs
  37281. ? function ($stderr) { }
  37282. : function ($stderr) { throw new AccessDeniedException($stderr); }
  37283. );
  37284. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  37285. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  37286. if ($this->exclude) {
  37287. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  37288. }
  37289. if (!$useGrep && ($this->contains || $this->notContains)) {
  37290. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  37291. }
  37292. if ($this->filters) {
  37293. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  37294. }
  37295. if (!$useSort && $this->sort) {
  37296. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  37297. $iterator = $iteratorAggregate->getIterator();
  37298. }
  37299. return $iterator;
  37300. }
  37301. protected function canBeUsed()
  37302. {
  37303. return $this->shell->testCommand('find');
  37304. }
  37305. protected function buildFindCommand(Command $command, $dir)
  37306. {
  37307. return $command
  37308. ->ins('find')
  37309. ->add('find ')
  37310. ->arg($dir)
  37311. ->add('-noleaf');
  37312. }
  37313. private function buildNamesFiltering(Command $command, array $names, $not = false)
  37314. {
  37315. if (0 === count($names)) {
  37316. return;
  37317. }
  37318. $command->add($not ? '-not' : null)->cmd('(');
  37319. foreach ($names as $i => $name) {
  37320. $expr = Expression::create($name);
  37321. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  37322. $expr = Expression::create($expr->getGlob()->toRegex(false));
  37323. }
  37324. if ($expr->isRegex()) {
  37325. $regex = $expr->getRegex();
  37326. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  37327. ->setStartFlag(false)
  37328. ->setStartJoker(true)
  37329. ->replaceJokers('[^/]');
  37330. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  37331. $regex->setEndJoker(false)->append('[^/]*');
  37332. }
  37333. }
  37334. $command
  37335. ->add($i > 0 ? '-or' : null)
  37336. ->add($expr->isRegex()
  37337. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  37338. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  37339. )
  37340. ->arg($expr->renderPattern());
  37341. }
  37342. $command->cmd(')');
  37343. }
  37344. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  37345. {
  37346. if (0 === count($paths)) {
  37347. return;
  37348. }
  37349. $command->add($not ? '-not' : null)->cmd('(');
  37350. foreach ($paths as $i => $path) {
  37351. $expr = Expression::create($path);
  37352. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  37353. $expr = Expression::create($expr->getGlob()->toRegex(false));
  37354. }
  37355. if ($expr->isRegex()) {
  37356. $regex = $expr->getRegex();
  37357. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  37358. } else {
  37359. $expr->prepend('*')->append('*');
  37360. }
  37361. $command
  37362. ->add($i > 0 ? '-or' : null)
  37363. ->add($expr->isRegex()
  37364. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  37365. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  37366. )
  37367. ->arg($expr->renderPattern());
  37368. }
  37369. $command->cmd(')');
  37370. }
  37371. private function buildSizesFiltering(Command $command, array $sizes)
  37372. {
  37373. foreach ($sizes as $i => $size) {
  37374. $command->add($i > 0 ? '-and' : null);
  37375. switch ($size->getOperator()) {
  37376. case '<=':
  37377. $command->add('-size -'.($size->getTarget() + 1).'c');
  37378. break;
  37379. case '>=':
  37380. $command->add('-size +'.($size->getTarget() - 1).'c');
  37381. break;
  37382. case '>':
  37383. $command->add('-size +'.$size->getTarget().'c');
  37384. break;
  37385. case '!=':
  37386. $command->add('-size -'.$size->getTarget().'c');
  37387. $command->add('-size +'.$size->getTarget().'c');
  37388. break;
  37389. case '<':
  37390. default:
  37391. $command->add('-size -'.$size->getTarget().'c');
  37392. }
  37393. }
  37394. }
  37395. private function buildDatesFiltering(Command $command, array $dates)
  37396. {
  37397. foreach ($dates as $i => $date) {
  37398. $command->add($i > 0 ? '-and' : null);
  37399. $mins = (int) round((time() - $date->getTarget()) / 60);
  37400. if (0 > $mins) {
  37401. $command->add(' -mmin -0');
  37402. return;
  37403. }
  37404. switch ($date->getOperator()) {
  37405. case '<=':
  37406. $command->add('-mmin +'.($mins - 1));
  37407. break;
  37408. case '>=':
  37409. $command->add('-mmin -'.($mins + 1));
  37410. break;
  37411. case '>':
  37412. $command->add('-mmin -'.$mins);
  37413. break;
  37414. case '!=':
  37415. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  37416. break;
  37417. case '<':
  37418. default:
  37419. $command->add('-mmin +'.$mins);
  37420. }
  37421. }
  37422. }
  37423. private function buildSorting(Command $command, $sort)
  37424. {
  37425. $this->buildFormatSorting($command, $sort);
  37426. }
  37427. abstract protected function buildFormatSorting(Command $command, $sort);
  37428. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  37429. }
  37430. <?php
  37431. namespace Symfony\Component\Finder\Adapter;
  37432. interface AdapterInterface
  37433. {
  37434. public function setFollowLinks($followLinks);
  37435. public function setMode($mode);
  37436. public function setExclude(array $exclude);
  37437. public function setDepths(array $depths);
  37438. public function setNames(array $names);
  37439. public function setNotNames(array $notNames);
  37440. public function setContains(array $contains);
  37441. public function setNotContains(array $notContains);
  37442. public function setSizes(array $sizes);
  37443. public function setDates(array $dates);
  37444. public function setFilters(array $filters);
  37445. public function setSort($sort);
  37446. public function setPath(array $paths);
  37447. public function setNotPath(array $notPaths);
  37448. public function ignoreUnreadableDirs($ignore = true);
  37449. public function searchInDirectory($dir);
  37450. public function isSupported();
  37451. public function getName();
  37452. }
  37453. <?php
  37454. namespace Symfony\Component\Finder\Adapter;
  37455. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  37456. use Symfony\Component\Finder\Shell\Shell;
  37457. use Symfony\Component\Finder\Shell\Command;
  37458. use Symfony\Component\Finder\Iterator\SortableIterator;
  37459. use Symfony\Component\Finder\Expression\Expression;
  37460. class BsdFindAdapter extends AbstractFindAdapter
  37461. {
  37462. public function getName()
  37463. {
  37464. return 'bsd_find';
  37465. }
  37466. protected function canBeUsed()
  37467. {
  37468. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  37469. }
  37470. protected function buildFormatSorting(Command $command, $sort)
  37471. {
  37472. switch ($sort) {
  37473. case SortableIterator::SORT_BY_NAME:
  37474. $command->ins('sort')->add('| sort');
  37475. return;
  37476. case SortableIterator::SORT_BY_TYPE:
  37477. $format = '%HT';
  37478. break;
  37479. case SortableIterator::SORT_BY_ACCESSED_TIME:
  37480. $format = '%a';
  37481. break;
  37482. case SortableIterator::SORT_BY_CHANGED_TIME:
  37483. $format = '%c';
  37484. break;
  37485. case SortableIterator::SORT_BY_MODIFIED_TIME:
  37486. $format = '%m';
  37487. break;
  37488. default:
  37489. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  37490. }
  37491. $command
  37492. ->add('-print0 | xargs -0 stat -f')
  37493. ->arg($format.'%t%N')
  37494. ->add('| sort | cut -f 2');
  37495. }
  37496. protected function buildFindCommand(Command $command, $dir)
  37497. {
  37498. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  37499. return $command;
  37500. }
  37501. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  37502. {
  37503. foreach ($contains as $contain) {
  37504. $expr = Expression::create($contain);
  37505. $command
  37506. ->add('| grep -v \'^$\'')
  37507. ->add('| xargs -I{} grep -I')
  37508. ->add($expr->isCaseSensitive() ? null : '-i')
  37509. ->add($not ? '-L' : '-l')
  37510. ->add('-Ee')->arg($expr->renderPattern())
  37511. ->add('{}')
  37512. ;
  37513. }
  37514. }
  37515. }
  37516. <?php
  37517. namespace Symfony\Component\Finder\Adapter;
  37518. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  37519. use Symfony\Component\Finder\Shell\Shell;
  37520. use Symfony\Component\Finder\Shell\Command;
  37521. use Symfony\Component\Finder\Iterator\SortableIterator;
  37522. use Symfony\Component\Finder\Expression\Expression;
  37523. class GnuFindAdapter extends AbstractFindAdapter
  37524. {
  37525. public function getName()
  37526. {
  37527. return 'gnu_find';
  37528. }
  37529. protected function buildFormatSorting(Command $command, $sort)
  37530. {
  37531. switch ($sort) {
  37532. case SortableIterator::SORT_BY_NAME:
  37533. $command->ins('sort')->add('| sort');
  37534. return;
  37535. case SortableIterator::SORT_BY_TYPE:
  37536. $format = '%y';
  37537. break;
  37538. case SortableIterator::SORT_BY_ACCESSED_TIME:
  37539. $format = '%A@';
  37540. break;
  37541. case SortableIterator::SORT_BY_CHANGED_TIME:
  37542. $format = '%C@';
  37543. break;
  37544. case SortableIterator::SORT_BY_MODIFIED_TIME:
  37545. $format = '%T@';
  37546. break;
  37547. default:
  37548. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  37549. }
  37550. $command
  37551. ->get('find')
  37552. ->add('-printf')
  37553. ->arg($format.' %h/%f\\n')
  37554. ->add('| sort | cut')
  37555. ->arg('-d ')
  37556. ->arg('-f2-')
  37557. ;
  37558. }
  37559. protected function canBeUsed()
  37560. {
  37561. return $this->shell->getType() === Shell::TYPE_UNIX && parent::canBeUsed();
  37562. }
  37563. protected function buildFindCommand(Command $command, $dir)
  37564. {
  37565. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  37566. }
  37567. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  37568. {
  37569. foreach ($contains as $contain) {
  37570. $expr = Expression::create($contain);
  37571. $command
  37572. ->add('| xargs -I{} -r grep -I')
  37573. ->add($expr->isCaseSensitive() ? null : '-i')
  37574. ->add($not ? '-L' : '-l')
  37575. ->add('-Ee')->arg($expr->renderPattern())
  37576. ->add('{}')
  37577. ;
  37578. }
  37579. }
  37580. }
  37581. <?php
  37582. namespace Symfony\Component\Finder\Adapter;
  37583. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  37584. use Symfony\Component\Finder\Iterator;
  37585. class PhpAdapter extends AbstractAdapter
  37586. {
  37587. public function searchInDirectory($dir)
  37588. {
  37589. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  37590. if ($this->followLinks) {
  37591. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  37592. }
  37593. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  37594. if ($this->exclude) {
  37595. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  37596. }
  37597. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  37598. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  37599. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  37600. }
  37601. if ($this->mode) {
  37602. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  37603. }
  37604. if ($this->names || $this->notNames) {
  37605. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  37606. }
  37607. if ($this->contains || $this->notContains) {
  37608. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  37609. }
  37610. if ($this->sizes) {
  37611. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  37612. }
  37613. if ($this->dates) {
  37614. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  37615. }
  37616. if ($this->filters) {
  37617. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  37618. }
  37619. if ($this->paths || $this->notPaths) {
  37620. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  37621. }
  37622. if ($this->sort) {
  37623. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  37624. $iterator = $iteratorAggregate->getIterator();
  37625. }
  37626. return $iterator;
  37627. }
  37628. public function getName()
  37629. {
  37630. return 'php';
  37631. }
  37632. protected function canBeUsed()
  37633. {
  37634. return true;
  37635. }
  37636. }
  37637. <?php
  37638. namespace Symfony\Component\Finder\Comparator;
  37639. class Comparator
  37640. {
  37641. private $target;
  37642. private $operator = '==';
  37643. public function getTarget()
  37644. {
  37645. return $this->target;
  37646. }
  37647. public function setTarget($target)
  37648. {
  37649. $this->target = $target;
  37650. }
  37651. public function getOperator()
  37652. {
  37653. return $this->operator;
  37654. }
  37655. public function setOperator($operator)
  37656. {
  37657. if (!$operator) {
  37658. $operator = '==';
  37659. }
  37660. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  37661. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  37662. }
  37663. $this->operator = $operator;
  37664. }
  37665. public function test($test)
  37666. {
  37667. switch ($this->operator) {
  37668. case '>':
  37669. return $test > $this->target;
  37670. case '>=':
  37671. return $test >= $this->target;
  37672. case '<':
  37673. return $test < $this->target;
  37674. case '<=':
  37675. return $test <= $this->target;
  37676. case '!=':
  37677. return $test != $this->target;
  37678. }
  37679. return $test == $this->target;
  37680. }
  37681. }
  37682. <?php
  37683. namespace Symfony\Component\Finder\Comparator;
  37684. class DateComparator extends Comparator
  37685. {
  37686. public function __construct($test)
  37687. {
  37688. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  37689. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  37690. }
  37691. try {
  37692. $date = new \DateTime($matches[2]);
  37693. $target = $date->format('U');
  37694. } catch (\Exception $e) {
  37695. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  37696. }
  37697. $operator = isset($matches[1]) ? $matches[1] : '==';
  37698. if ('since' === $operator || 'after' === $operator) {
  37699. $operator = '>';
  37700. }
  37701. if ('until' === $operator || 'before' === $operator) {
  37702. $operator = '<';
  37703. }
  37704. $this->setOperator($operator);
  37705. $this->setTarget($target);
  37706. }
  37707. }
  37708. <?php
  37709. namespace Symfony\Component\Finder\Comparator;
  37710. class NumberComparator extends Comparator
  37711. {
  37712. public function __construct($test)
  37713. {
  37714. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  37715. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  37716. }
  37717. $target = $matches[2];
  37718. if (!is_numeric($target)) {
  37719. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  37720. }
  37721. if (isset($matches[3])) {
  37722. switch (strtolower($matches[3])) {
  37723. case 'k':
  37724. $target *= 1000;
  37725. break;
  37726. case 'ki':
  37727. $target *= 1024;
  37728. break;
  37729. case 'm':
  37730. $target *= 1000000;
  37731. break;
  37732. case 'mi':
  37733. $target *= 1024 * 1024;
  37734. break;
  37735. case 'g':
  37736. $target *= 1000000000;
  37737. break;
  37738. case 'gi':
  37739. $target *= 1024 * 1024 * 1024;
  37740. break;
  37741. }
  37742. }
  37743. $this->setTarget($target);
  37744. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  37745. }
  37746. }
  37747. <?php
  37748. namespace Symfony\Component\Finder\Exception;
  37749. class AccessDeniedException extends \UnexpectedValueException
  37750. {
  37751. }
  37752. <?php
  37753. namespace Symfony\Component\Finder\Exception;
  37754. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37755. use Symfony\Component\Finder\Adapter\AdapterInterface;
  37756. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  37757. {
  37758. private $adapter;
  37759. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  37760. {
  37761. $this->adapter = $adapter;
  37762. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  37763. }
  37764. public function getAdapter()
  37765. {
  37766. return $this->adapter;
  37767. }
  37768. }
  37769. <?php
  37770. namespace Symfony\Component\Finder\Exception;
  37771. interface ExceptionInterface
  37772. {
  37773. public function getAdapter();
  37774. }
  37775. <?php
  37776. namespace Symfony\Component\Finder\Exception;
  37777. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37778. class OperationNotPermitedException extends AdapterFailureException
  37779. {
  37780. }
  37781. <?php
  37782. namespace Symfony\Component\Finder\Exception;
  37783. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37784. use Symfony\Component\Finder\Adapter\AdapterInterface;
  37785. use Symfony\Component\Finder\Shell\Command;
  37786. class ShellCommandFailureException extends AdapterFailureException
  37787. {
  37788. private $command;
  37789. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  37790. {
  37791. $this->command = $command;
  37792. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  37793. }
  37794. public function getCommand()
  37795. {
  37796. return $this->command;
  37797. }
  37798. }
  37799. <?php
  37800. namespace Symfony\Component\Finder\Expression;
  37801. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37802. class Expression implements ValueInterface
  37803. {
  37804. const TYPE_REGEX = 1;
  37805. const TYPE_GLOB = 2;
  37806. private $value;
  37807. public static function create($expr)
  37808. {
  37809. return new self($expr);
  37810. }
  37811. public function __construct($expr)
  37812. {
  37813. try {
  37814. $this->value = Regex::create($expr);
  37815. } catch (\InvalidArgumentException $e) {
  37816. $this->value = new Glob($expr);
  37817. }
  37818. }
  37819. public function __toString()
  37820. {
  37821. return $this->render();
  37822. }
  37823. public function render()
  37824. {
  37825. return $this->value->render();
  37826. }
  37827. public function renderPattern()
  37828. {
  37829. return $this->value->renderPattern();
  37830. }
  37831. public function isCaseSensitive()
  37832. {
  37833. return $this->value->isCaseSensitive();
  37834. }
  37835. public function getType()
  37836. {
  37837. return $this->value->getType();
  37838. }
  37839. public function prepend($expr)
  37840. {
  37841. $this->value->prepend($expr);
  37842. return $this;
  37843. }
  37844. public function append($expr)
  37845. {
  37846. $this->value->append($expr);
  37847. return $this;
  37848. }
  37849. public function isRegex()
  37850. {
  37851. return self::TYPE_REGEX === $this->value->getType();
  37852. }
  37853. public function isGlob()
  37854. {
  37855. return self::TYPE_GLOB === $this->value->getType();
  37856. }
  37857. public function getGlob()
  37858. {
  37859. if (self::TYPE_GLOB !== $this->value->getType()) {
  37860. throw new \LogicException('Regex can\'t be transformed to glob.');
  37861. }
  37862. return $this->value;
  37863. }
  37864. public function getRegex()
  37865. {
  37866. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  37867. }
  37868. }
  37869. <?php
  37870. namespace Symfony\Component\Finder\Expression;
  37871. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37872. use Symfony\Component\Finder\Glob as FinderGlob;
  37873. class Glob implements ValueInterface
  37874. {
  37875. private $pattern;
  37876. public function __construct($pattern)
  37877. {
  37878. $this->pattern = $pattern;
  37879. }
  37880. public function render()
  37881. {
  37882. return $this->pattern;
  37883. }
  37884. public function renderPattern()
  37885. {
  37886. return $this->pattern;
  37887. }
  37888. public function getType()
  37889. {
  37890. return Expression::TYPE_GLOB;
  37891. }
  37892. public function isCaseSensitive()
  37893. {
  37894. return true;
  37895. }
  37896. public function prepend($expr)
  37897. {
  37898. $this->pattern = $expr.$this->pattern;
  37899. return $this;
  37900. }
  37901. public function append($expr)
  37902. {
  37903. $this->pattern .= $expr;
  37904. return $this;
  37905. }
  37906. public function isExpandable()
  37907. {
  37908. return false !== strpos($this->pattern, '{')
  37909. && false !== strpos($this->pattern, '}');
  37910. }
  37911. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  37912. {
  37913. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  37914. return new Regex($regex);
  37915. }
  37916. }
  37917. <?php
  37918. namespace Symfony\Component\Finder\Expression;
  37919. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37920. class Regex implements ValueInterface
  37921. {
  37922. const START_FLAG = '^';
  37923. const END_FLAG = '$';
  37924. const BOUNDARY = '~';
  37925. const JOKER = '.*';
  37926. const ESCAPING = '\\';
  37927. private $pattern;
  37928. private $options;
  37929. private $startFlag;
  37930. private $endFlag;
  37931. private $startJoker;
  37932. private $endJoker;
  37933. public static function create($expr)
  37934. {
  37935. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  37936. $start = substr($m[1], 0, 1);
  37937. $end = substr($m[1], -1);
  37938. if (
  37939. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  37940. || ($start === '{' && $end === '}')
  37941. || ($start === '(' && $end === ')')
  37942. ) {
  37943. return new self(substr($m[1], 1, -1), $m[2], $end);
  37944. }
  37945. }
  37946. throw new \InvalidArgumentException('Given expression is not a regex.');
  37947. }
  37948. public function __construct($pattern, $options = '', $delimiter = null)
  37949. {
  37950. if (null !== $delimiter) {
  37951. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  37952. }
  37953. $this->parsePattern($pattern);
  37954. $this->options = $options;
  37955. }
  37956. public function __toString()
  37957. {
  37958. return $this->render();
  37959. }
  37960. public function render()
  37961. {
  37962. return self::BOUNDARY
  37963. .$this->renderPattern()
  37964. .self::BOUNDARY
  37965. .$this->options;
  37966. }
  37967. public function renderPattern()
  37968. {
  37969. return ($this->startFlag ? self::START_FLAG : '')
  37970. .($this->startJoker ? self::JOKER : '')
  37971. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  37972. .($this->endJoker ? self::JOKER : '')
  37973. .($this->endFlag ? self::END_FLAG : '');
  37974. }
  37975. public function isCaseSensitive()
  37976. {
  37977. return !$this->hasOption('i');
  37978. }
  37979. public function getType()
  37980. {
  37981. return Expression::TYPE_REGEX;
  37982. }
  37983. public function prepend($expr)
  37984. {
  37985. $this->pattern = $expr.$this->pattern;
  37986. return $this;
  37987. }
  37988. public function append($expr)
  37989. {
  37990. $this->pattern .= $expr;
  37991. return $this;
  37992. }
  37993. public function hasOption($option)
  37994. {
  37995. return false !== strpos($this->options, $option);
  37996. }
  37997. public function addOption($option)
  37998. {
  37999. if (!$this->hasOption($option)) {
  38000. $this->options .= $option;
  38001. }
  38002. return $this;
  38003. }
  38004. public function removeOption($option)
  38005. {
  38006. $this->options = str_replace($option, '', $this->options);
  38007. return $this;
  38008. }
  38009. public function setStartFlag($startFlag)
  38010. {
  38011. $this->startFlag = $startFlag;
  38012. return $this;
  38013. }
  38014. public function hasStartFlag()
  38015. {
  38016. return $this->startFlag;
  38017. }
  38018. public function setEndFlag($endFlag)
  38019. {
  38020. $this->endFlag = (bool) $endFlag;
  38021. return $this;
  38022. }
  38023. public function hasEndFlag()
  38024. {
  38025. return $this->endFlag;
  38026. }
  38027. public function setStartJoker($startJoker)
  38028. {
  38029. $this->startJoker = $startJoker;
  38030. return $this;
  38031. }
  38032. public function hasStartJoker()
  38033. {
  38034. return $this->startJoker;
  38035. }
  38036. public function setEndJoker($endJoker)
  38037. {
  38038. $this->endJoker = (bool) $endJoker;
  38039. return $this;
  38040. }
  38041. public function hasEndJoker()
  38042. {
  38043. return $this->endJoker;
  38044. }
  38045. public function replaceJokers($replacement)
  38046. {
  38047. $replace = function ($subject) use ($replacement) {
  38048. $subject = $subject[0];
  38049. $replace = 0 === substr_count($subject, '\\') % 2;
  38050. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  38051. };
  38052. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  38053. return $this;
  38054. }
  38055. private function parsePattern($pattern)
  38056. {
  38057. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  38058. $pattern = substr($pattern, 1);
  38059. }
  38060. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  38061. $pattern = substr($pattern, 2);
  38062. }
  38063. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  38064. $pattern = substr($pattern, 0, -1);
  38065. }
  38066. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  38067. $pattern = substr($pattern, 0, -2);
  38068. }
  38069. $this->pattern = $pattern;
  38070. }
  38071. }
  38072. <?php
  38073. namespace Symfony\Component\Finder\Expression;
  38074. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38075. interface ValueInterface
  38076. {
  38077. public function render();
  38078. public function renderPattern();
  38079. public function isCaseSensitive();
  38080. public function getType();
  38081. public function prepend($expr);
  38082. public function append($expr);
  38083. }
  38084. <?php
  38085. namespace Symfony\Component\Finder;
  38086. use Symfony\Component\Finder\Adapter\AdapterInterface;
  38087. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  38088. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  38089. use Symfony\Component\Finder\Adapter\PhpAdapter;
  38090. use Symfony\Component\Finder\Comparator\DateComparator;
  38091. use Symfony\Component\Finder\Comparator\NumberComparator;
  38092. use Symfony\Component\Finder\Exception\ExceptionInterface;
  38093. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  38094. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  38095. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  38096. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  38097. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  38098. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  38099. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  38100. use Symfony\Component\Finder\Iterator\SortableIterator;
  38101. class Finder implements \IteratorAggregate, \Countable
  38102. {
  38103. const IGNORE_VCS_FILES = 1;
  38104. const IGNORE_DOT_FILES = 2;
  38105. private $mode = 0;
  38106. private $names = array();
  38107. private $notNames = array();
  38108. private $exclude = array();
  38109. private $filters = array();
  38110. private $depths = array();
  38111. private $sizes = array();
  38112. private $followLinks = false;
  38113. private $sort = false;
  38114. private $ignore = 0;
  38115. private $dirs = array();
  38116. private $dates = array();
  38117. private $iterators = array();
  38118. private $contains = array();
  38119. private $notContains = array();
  38120. private $adapters = null;
  38121. private $paths = array();
  38122. private $notPaths = array();
  38123. private $ignoreUnreadableDirs = false;
  38124. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  38125. public function __construct()
  38126. {
  38127. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  38128. }
  38129. public static function create()
  38130. {
  38131. return new static();
  38132. }
  38133. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  38134. {
  38135. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38136. $this->initDefaultAdapters();
  38137. $this->adapters[$adapter->getName()] = array(
  38138. 'adapter' => $adapter,
  38139. 'priority' => $priority,
  38140. 'selected' => false,
  38141. );
  38142. return $this->sortAdapters();
  38143. }
  38144. public function useBestAdapter()
  38145. {
  38146. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38147. $this->initDefaultAdapters();
  38148. $this->resetAdapterSelection();
  38149. return $this->sortAdapters();
  38150. }
  38151. public function setAdapter($name)
  38152. {
  38153. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38154. $this->initDefaultAdapters();
  38155. if (!isset($this->adapters[$name])) {
  38156. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  38157. }
  38158. $this->resetAdapterSelection();
  38159. $this->adapters[$name]['selected'] = true;
  38160. return $this->sortAdapters();
  38161. }
  38162. public function removeAdapters()
  38163. {
  38164. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38165. $this->adapters = array();
  38166. return $this;
  38167. }
  38168. public function getAdapters()
  38169. {
  38170. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38171. $this->initDefaultAdapters();
  38172. return array_values(array_map(function (array $adapter) {
  38173. return $adapter['adapter'];
  38174. }, $this->adapters));
  38175. }
  38176. public function directories()
  38177. {
  38178. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  38179. return $this;
  38180. }
  38181. public function files()
  38182. {
  38183. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  38184. return $this;
  38185. }
  38186. public function depth($level)
  38187. {
  38188. $this->depths[] = new Comparator\NumberComparator($level);
  38189. return $this;
  38190. }
  38191. public function date($date)
  38192. {
  38193. $this->dates[] = new Comparator\DateComparator($date);
  38194. return $this;
  38195. }
  38196. public function name($pattern)
  38197. {
  38198. $this->names[] = $pattern;
  38199. return $this;
  38200. }
  38201. public function notName($pattern)
  38202. {
  38203. $this->notNames[] = $pattern;
  38204. return $this;
  38205. }
  38206. public function contains($pattern)
  38207. {
  38208. $this->contains[] = $pattern;
  38209. return $this;
  38210. }
  38211. public function notContains($pattern)
  38212. {
  38213. $this->notContains[] = $pattern;
  38214. return $this;
  38215. }
  38216. public function path($pattern)
  38217. {
  38218. $this->paths[] = $pattern;
  38219. return $this;
  38220. }
  38221. public function notPath($pattern)
  38222. {
  38223. $this->notPaths[] = $pattern;
  38224. return $this;
  38225. }
  38226. public function size($size)
  38227. {
  38228. $this->sizes[] = new Comparator\NumberComparator($size);
  38229. return $this;
  38230. }
  38231. public function exclude($dirs)
  38232. {
  38233. $this->exclude = array_merge($this->exclude, (array) $dirs);
  38234. return $this;
  38235. }
  38236. public function ignoreDotFiles($ignoreDotFiles)
  38237. {
  38238. if ($ignoreDotFiles) {
  38239. $this->ignore |= static::IGNORE_DOT_FILES;
  38240. } else {
  38241. $this->ignore &= ~static::IGNORE_DOT_FILES;
  38242. }
  38243. return $this;
  38244. }
  38245. public function ignoreVCS($ignoreVCS)
  38246. {
  38247. if ($ignoreVCS) {
  38248. $this->ignore |= static::IGNORE_VCS_FILES;
  38249. } else {
  38250. $this->ignore &= ~static::IGNORE_VCS_FILES;
  38251. }
  38252. return $this;
  38253. }
  38254. public static function addVCSPattern($pattern)
  38255. {
  38256. foreach ((array) $pattern as $p) {
  38257. self::$vcsPatterns[] = $p;
  38258. }
  38259. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  38260. }
  38261. public function sort(\Closure $closure)
  38262. {
  38263. $this->sort = $closure;
  38264. return $this;
  38265. }
  38266. public function sortByName()
  38267. {
  38268. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  38269. return $this;
  38270. }
  38271. public function sortByType()
  38272. {
  38273. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  38274. return $this;
  38275. }
  38276. public function sortByAccessedTime()
  38277. {
  38278. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  38279. return $this;
  38280. }
  38281. public function sortByChangedTime()
  38282. {
  38283. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  38284. return $this;
  38285. }
  38286. public function sortByModifiedTime()
  38287. {
  38288. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  38289. return $this;
  38290. }
  38291. public function filter(\Closure $closure)
  38292. {
  38293. $this->filters[] = $closure;
  38294. return $this;
  38295. }
  38296. public function followLinks()
  38297. {
  38298. $this->followLinks = true;
  38299. return $this;
  38300. }
  38301. public function ignoreUnreadableDirs($ignore = true)
  38302. {
  38303. $this->ignoreUnreadableDirs = (bool) $ignore;
  38304. return $this;
  38305. }
  38306. public function in($dirs)
  38307. {
  38308. $resolvedDirs = array();
  38309. foreach ((array) $dirs as $dir) {
  38310. if (is_dir($dir)) {
  38311. $resolvedDirs[] = $dir;
  38312. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  38313. $resolvedDirs = array_merge($resolvedDirs, $glob);
  38314. } else {
  38315. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  38316. }
  38317. }
  38318. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  38319. return $this;
  38320. }
  38321. public function getIterator()
  38322. {
  38323. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  38324. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  38325. }
  38326. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  38327. return $this->searchInDirectory($this->dirs[0]);
  38328. }
  38329. $iterator = new \AppendIterator();
  38330. foreach ($this->dirs as $dir) {
  38331. $iterator->append($this->searchInDirectory($dir));
  38332. }
  38333. foreach ($this->iterators as $it) {
  38334. $iterator->append($it);
  38335. }
  38336. return $iterator;
  38337. }
  38338. public function append($iterator)
  38339. {
  38340. if ($iterator instanceof \IteratorAggregate) {
  38341. $this->iterators[] = $iterator->getIterator();
  38342. } elseif ($iterator instanceof \Iterator) {
  38343. $this->iterators[] = $iterator;
  38344. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  38345. $it = new \ArrayIterator();
  38346. foreach ($iterator as $file) {
  38347. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  38348. }
  38349. $this->iterators[] = $it;
  38350. } else {
  38351. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  38352. }
  38353. return $this;
  38354. }
  38355. public function count()
  38356. {
  38357. return iterator_count($this->getIterator());
  38358. }
  38359. private function sortAdapters()
  38360. {
  38361. uasort($this->adapters, function (array $a, array $b) {
  38362. if ($a['selected'] || $b['selected']) {
  38363. return $a['selected'] ? -1 : 1;
  38364. }
  38365. return $a['priority'] > $b['priority'] ? -1 : 1;
  38366. });
  38367. return $this;
  38368. }
  38369. private function searchInDirectory($dir)
  38370. {
  38371. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  38372. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  38373. }
  38374. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  38375. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  38376. }
  38377. if ($this->adapters) {
  38378. foreach ($this->adapters as $adapter) {
  38379. if ($adapter['adapter']->isSupported()) {
  38380. try {
  38381. return $this
  38382. ->buildAdapter($adapter['adapter'])
  38383. ->searchInDirectory($dir);
  38384. } catch (ExceptionInterface $e) {
  38385. }
  38386. }
  38387. }
  38388. }
  38389. $minDepth = 0;
  38390. $maxDepth = PHP_INT_MAX;
  38391. foreach ($this->depths as $comparator) {
  38392. switch ($comparator->getOperator()) {
  38393. case '>':
  38394. $minDepth = $comparator->getTarget() + 1;
  38395. break;
  38396. case '>=':
  38397. $minDepth = $comparator->getTarget();
  38398. break;
  38399. case '<':
  38400. $maxDepth = $comparator->getTarget() - 1;
  38401. break;
  38402. case '<=':
  38403. $maxDepth = $comparator->getTarget();
  38404. break;
  38405. default:
  38406. $minDepth = $maxDepth = $comparator->getTarget();
  38407. }
  38408. }
  38409. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  38410. if ($this->followLinks) {
  38411. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  38412. }
  38413. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  38414. if ($this->exclude) {
  38415. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  38416. }
  38417. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  38418. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  38419. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  38420. }
  38421. if ($this->mode) {
  38422. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  38423. }
  38424. if ($this->names || $this->notNames) {
  38425. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  38426. }
  38427. if ($this->contains || $this->notContains) {
  38428. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  38429. }
  38430. if ($this->sizes) {
  38431. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  38432. }
  38433. if ($this->dates) {
  38434. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  38435. }
  38436. if ($this->filters) {
  38437. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  38438. }
  38439. if ($this->paths || $this->notPaths) {
  38440. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  38441. }
  38442. if ($this->sort) {
  38443. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  38444. $iterator = $iteratorAggregate->getIterator();
  38445. }
  38446. return $iterator;
  38447. }
  38448. private function buildAdapter(AdapterInterface $adapter)
  38449. {
  38450. return $adapter
  38451. ->setFollowLinks($this->followLinks)
  38452. ->setDepths($this->depths)
  38453. ->setMode($this->mode)
  38454. ->setExclude($this->exclude)
  38455. ->setNames($this->names)
  38456. ->setNotNames($this->notNames)
  38457. ->setContains($this->contains)
  38458. ->setNotContains($this->notContains)
  38459. ->setSizes($this->sizes)
  38460. ->setDates($this->dates)
  38461. ->setFilters($this->filters)
  38462. ->setSort($this->sort)
  38463. ->setPath($this->paths)
  38464. ->setNotPath($this->notPaths)
  38465. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  38466. }
  38467. private function resetAdapterSelection()
  38468. {
  38469. $this->adapters = array_map(function (array $properties) {
  38470. $properties['selected'] = false;
  38471. return $properties;
  38472. }, $this->adapters);
  38473. }
  38474. private function initDefaultAdapters()
  38475. {
  38476. if (null === $this->adapters) {
  38477. $this->adapters = array();
  38478. $this
  38479. ->addAdapter(new GnuFindAdapter())
  38480. ->addAdapter(new BsdFindAdapter())
  38481. ->addAdapter(new PhpAdapter(), -50)
  38482. ->setAdapter('php')
  38483. ;
  38484. }
  38485. }
  38486. }
  38487. <?php
  38488. namespace Symfony\Component\Finder;
  38489. class Glob
  38490. {
  38491. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  38492. {
  38493. $firstByte = true;
  38494. $escaping = false;
  38495. $inCurlies = 0;
  38496. $regex = '';
  38497. $sizeGlob = strlen($glob);
  38498. for ($i = 0; $i < $sizeGlob; ++$i) {
  38499. $car = $glob[$i];
  38500. if ($firstByte) {
  38501. if ($strictLeadingDot && '.' !== $car) {
  38502. $regex .= '(?=[^\.])';
  38503. }
  38504. $firstByte = false;
  38505. }
  38506. if ('/' === $car) {
  38507. $firstByte = true;
  38508. }
  38509. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  38510. $regex .= "\\$car";
  38511. } elseif ('*' === $car) {
  38512. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  38513. } elseif ('?' === $car) {
  38514. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  38515. } elseif ('{' === $car) {
  38516. $regex .= $escaping ? '\\{' : '(';
  38517. if (!$escaping) {
  38518. ++$inCurlies;
  38519. }
  38520. } elseif ('}' === $car && $inCurlies) {
  38521. $regex .= $escaping ? '}' : ')';
  38522. if (!$escaping) {
  38523. --$inCurlies;
  38524. }
  38525. } elseif (',' === $car && $inCurlies) {
  38526. $regex .= $escaping ? ',' : '|';
  38527. } elseif ('\\' === $car) {
  38528. if ($escaping) {
  38529. $regex .= '\\\\';
  38530. $escaping = false;
  38531. } else {
  38532. $escaping = true;
  38533. }
  38534. continue;
  38535. } else {
  38536. $regex .= $car;
  38537. }
  38538. $escaping = false;
  38539. }
  38540. return $delimiter.'^'.$regex.'$'.$delimiter;
  38541. }
  38542. }
  38543. <?php
  38544. namespace Symfony\Component\Finder\Iterator;
  38545. class CustomFilterIterator extends FilterIterator
  38546. {
  38547. private $filters = array();
  38548. public function __construct(\Iterator $iterator, array $filters)
  38549. {
  38550. foreach ($filters as $filter) {
  38551. if (!is_callable($filter)) {
  38552. throw new \InvalidArgumentException('Invalid PHP callback.');
  38553. }
  38554. }
  38555. $this->filters = $filters;
  38556. parent::__construct($iterator);
  38557. }
  38558. public function accept()
  38559. {
  38560. $fileinfo = $this->current();
  38561. foreach ($this->filters as $filter) {
  38562. if (false === call_user_func($filter, $fileinfo)) {
  38563. return false;
  38564. }
  38565. }
  38566. return true;
  38567. }
  38568. }
  38569. <?php
  38570. namespace Symfony\Component\Finder\Iterator;
  38571. use Symfony\Component\Finder\Comparator\DateComparator;
  38572. class DateRangeFilterIterator extends FilterIterator
  38573. {
  38574. private $comparators = array();
  38575. public function __construct(\Iterator $iterator, array $comparators)
  38576. {
  38577. $this->comparators = $comparators;
  38578. parent::__construct($iterator);
  38579. }
  38580. public function accept()
  38581. {
  38582. $fileinfo = $this->current();
  38583. if (!file_exists($fileinfo->getPathname())) {
  38584. return false;
  38585. }
  38586. $filedate = $fileinfo->getMTime();
  38587. foreach ($this->comparators as $compare) {
  38588. if (!$compare->test($filedate)) {
  38589. return false;
  38590. }
  38591. }
  38592. return true;
  38593. }
  38594. }
  38595. <?php
  38596. namespace Symfony\Component\Finder\Iterator;
  38597. class DepthRangeFilterIterator extends FilterIterator
  38598. {
  38599. private $minDepth = 0;
  38600. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  38601. {
  38602. $this->minDepth = $minDepth;
  38603. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  38604. parent::__construct($iterator);
  38605. }
  38606. public function accept()
  38607. {
  38608. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  38609. }
  38610. }
  38611. <?php
  38612. namespace Symfony\Component\Finder\Iterator;
  38613. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  38614. {
  38615. private $iterator;
  38616. private $isRecursive;
  38617. private $excludedDirs = array();
  38618. private $excludedPattern;
  38619. public function __construct(\Iterator $iterator, array $directories)
  38620. {
  38621. $this->iterator = $iterator;
  38622. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  38623. $patterns = array();
  38624. foreach ($directories as $directory) {
  38625. $directory = rtrim($directory, '/');
  38626. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  38627. $patterns[] = preg_quote($directory, '#');
  38628. } else {
  38629. $this->excludedDirs[$directory] = true;
  38630. }
  38631. }
  38632. if ($patterns) {
  38633. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  38634. }
  38635. parent::__construct($iterator);
  38636. }
  38637. public function accept()
  38638. {
  38639. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  38640. return false;
  38641. }
  38642. if ($this->excludedPattern) {
  38643. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  38644. $path = str_replace('\\', '/', $path);
  38645. return !preg_match($this->excludedPattern, $path);
  38646. }
  38647. return true;
  38648. }
  38649. public function hasChildren()
  38650. {
  38651. return $this->isRecursive && $this->iterator->hasChildren();
  38652. }
  38653. public function getChildren()
  38654. {
  38655. $children = new self($this->iterator->getChildren(), array());
  38656. $children->excludedDirs = $this->excludedDirs;
  38657. $children->excludedPattern = $this->excludedPattern;
  38658. return $children;
  38659. }
  38660. }
  38661. <?php
  38662. namespace Symfony\Component\Finder\Iterator;
  38663. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38664. use Symfony\Component\Finder\SplFileInfo;
  38665. class FilePathsIterator extends \ArrayIterator
  38666. {
  38667. private $baseDir;
  38668. private $baseDirLength;
  38669. private $subPath;
  38670. private $subPathname;
  38671. private $current;
  38672. public function __construct(array $paths, $baseDir)
  38673. {
  38674. $this->baseDir = $baseDir;
  38675. $this->baseDirLength = strlen($baseDir);
  38676. parent::__construct($paths);
  38677. }
  38678. public function __call($name, array $arguments)
  38679. {
  38680. return call_user_func_array(array($this->current(), $name), $arguments);
  38681. }
  38682. public function current()
  38683. {
  38684. return $this->current;
  38685. }
  38686. public function key()
  38687. {
  38688. return $this->current->getPathname();
  38689. }
  38690. public function next()
  38691. {
  38692. parent::next();
  38693. $this->buildProperties();
  38694. }
  38695. public function rewind()
  38696. {
  38697. parent::rewind();
  38698. $this->buildProperties();
  38699. }
  38700. public function getSubPath()
  38701. {
  38702. return $this->subPath;
  38703. }
  38704. public function getSubPathname()
  38705. {
  38706. return $this->subPathname;
  38707. }
  38708. private function buildProperties()
  38709. {
  38710. $absolutePath = parent::current();
  38711. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  38712. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  38713. $dir = dirname($this->subPathname);
  38714. $this->subPath = '.' === $dir ? '' : $dir;
  38715. } else {
  38716. $this->subPath = $this->subPathname = '';
  38717. }
  38718. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  38719. }
  38720. }
  38721. <?php
  38722. namespace Symfony\Component\Finder\Iterator;
  38723. class FileTypeFilterIterator extends FilterIterator
  38724. {
  38725. const ONLY_FILES = 1;
  38726. const ONLY_DIRECTORIES = 2;
  38727. private $mode;
  38728. public function __construct(\Iterator $iterator, $mode)
  38729. {
  38730. $this->mode = $mode;
  38731. parent::__construct($iterator);
  38732. }
  38733. public function accept()
  38734. {
  38735. $fileinfo = $this->current();
  38736. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  38737. return false;
  38738. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  38739. return false;
  38740. }
  38741. return true;
  38742. }
  38743. }
  38744. <?php
  38745. namespace Symfony\Component\Finder\Iterator;
  38746. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  38747. {
  38748. public function accept()
  38749. {
  38750. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  38751. return true;
  38752. }
  38753. $fileinfo = $this->current();
  38754. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  38755. return false;
  38756. }
  38757. $content = $fileinfo->getContents();
  38758. if (!$content) {
  38759. return false;
  38760. }
  38761. return $this->isAccepted($content);
  38762. }
  38763. protected function toRegex($str)
  38764. {
  38765. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  38766. }
  38767. }
  38768. <?php
  38769. namespace Symfony\Component\Finder\Iterator;
  38770. use Symfony\Component\Finder\Glob;
  38771. class FilenameFilterIterator extends MultiplePcreFilterIterator
  38772. {
  38773. public function accept()
  38774. {
  38775. return $this->isAccepted($this->current()->getFilename());
  38776. }
  38777. protected function toRegex($str)
  38778. {
  38779. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  38780. }
  38781. }
  38782. <?php
  38783. namespace Symfony\Component\Finder\Iterator;
  38784. abstract class FilterIterator extends \FilterIterator
  38785. {
  38786. public function rewind()
  38787. {
  38788. if (PHP_VERSION_ID > 50607 || (PHP_VERSION_ID > 50523 && PHP_VERSION_ID < 50600)) {
  38789. parent::rewind();
  38790. return;
  38791. }
  38792. $iterator = $this;
  38793. while ($iterator instanceof \OuterIterator) {
  38794. $innerIterator = $iterator->getInnerIterator();
  38795. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  38796. if ($innerIterator->isRewindable()) {
  38797. $innerIterator->next();
  38798. $innerIterator->rewind();
  38799. }
  38800. } elseif ($innerIterator instanceof \FilesystemIterator) {
  38801. $innerIterator->next();
  38802. $innerIterator->rewind();
  38803. }
  38804. $iterator = $innerIterator;
  38805. }
  38806. parent::rewind();
  38807. }
  38808. }
  38809. <?php
  38810. namespace Symfony\Component\Finder\Iterator;
  38811. abstract class MultiplePcreFilterIterator extends FilterIterator
  38812. {
  38813. protected $matchRegexps = array();
  38814. protected $noMatchRegexps = array();
  38815. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  38816. {
  38817. foreach ($matchPatterns as $pattern) {
  38818. $this->matchRegexps[] = $this->toRegex($pattern);
  38819. }
  38820. foreach ($noMatchPatterns as $pattern) {
  38821. $this->noMatchRegexps[] = $this->toRegex($pattern);
  38822. }
  38823. parent::__construct($iterator);
  38824. }
  38825. protected function isAccepted($string)
  38826. {
  38827. foreach ($this->noMatchRegexps as $regex) {
  38828. if (preg_match($regex, $string)) {
  38829. return false;
  38830. }
  38831. }
  38832. if ($this->matchRegexps) {
  38833. foreach ($this->matchRegexps as $regex) {
  38834. if (preg_match($regex, $string)) {
  38835. return true;
  38836. }
  38837. }
  38838. return false;
  38839. }
  38840. return true;
  38841. }
  38842. protected function isRegex($str)
  38843. {
  38844. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  38845. $start = substr($m[1], 0, 1);
  38846. $end = substr($m[1], -1);
  38847. if ($start === $end) {
  38848. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  38849. }
  38850. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  38851. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  38852. return true;
  38853. }
  38854. }
  38855. }
  38856. return false;
  38857. }
  38858. abstract protected function toRegex($str);
  38859. }
  38860. <?php
  38861. namespace Symfony\Component\Finder\Iterator;
  38862. class PathFilterIterator extends MultiplePcreFilterIterator
  38863. {
  38864. public function accept()
  38865. {
  38866. $filename = $this->current()->getRelativePathname();
  38867. if ('\\' === DIRECTORY_SEPARATOR) {
  38868. $filename = str_replace('\\', '/', $filename);
  38869. }
  38870. return $this->isAccepted($filename);
  38871. }
  38872. protected function toRegex($str)
  38873. {
  38874. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  38875. }
  38876. }
  38877. <?php
  38878. namespace Symfony\Component\Finder\Iterator;
  38879. use Symfony\Component\Finder\Exception\AccessDeniedException;
  38880. use Symfony\Component\Finder\SplFileInfo;
  38881. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  38882. {
  38883. private $ignoreUnreadableDirs;
  38884. private $rewindable;
  38885. private $rootPath;
  38886. private $subPath;
  38887. private $directorySeparator = '/';
  38888. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  38889. {
  38890. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  38891. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  38892. }
  38893. parent::__construct($path, $flags);
  38894. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  38895. $this->rootPath = (string) $path;
  38896. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  38897. $this->directorySeparator = DIRECTORY_SEPARATOR;
  38898. }
  38899. }
  38900. public function current()
  38901. {
  38902. if (null === $subPathname = $this->subPath) {
  38903. $subPathname = $this->subPath = (string) $this->getSubPath();
  38904. }
  38905. if ('' !== $subPathname) {
  38906. $subPathname .= $this->directorySeparator;
  38907. }
  38908. $subPathname .= $this->getFilename();
  38909. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  38910. }
  38911. public function getChildren()
  38912. {
  38913. try {
  38914. $children = parent::getChildren();
  38915. if ($children instanceof self) {
  38916. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  38917. $children->rewindable = &$this->rewindable;
  38918. $children->rootPath = $this->rootPath;
  38919. }
  38920. return $children;
  38921. } catch (\UnexpectedValueException $e) {
  38922. if ($this->ignoreUnreadableDirs) {
  38923. return new \RecursiveArrayIterator(array());
  38924. } else {
  38925. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  38926. }
  38927. }
  38928. }
  38929. public function rewind()
  38930. {
  38931. if (false === $this->isRewindable()) {
  38932. return;
  38933. }
  38934. if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
  38935. parent::next();
  38936. }
  38937. parent::rewind();
  38938. }
  38939. public function isRewindable()
  38940. {
  38941. if (null !== $this->rewindable) {
  38942. return $this->rewindable;
  38943. }
  38944. if ('' === $this->getPath()) {
  38945. return $this->rewindable = false;
  38946. }
  38947. if (false !== $stream = @opendir($this->getPath())) {
  38948. $infos = stream_get_meta_data($stream);
  38949. closedir($stream);
  38950. if ($infos['seekable']) {
  38951. return $this->rewindable = true;
  38952. }
  38953. }
  38954. return $this->rewindable = false;
  38955. }
  38956. }
  38957. <?php
  38958. namespace Symfony\Component\Finder\Iterator;
  38959. use Symfony\Component\Finder\Comparator\NumberComparator;
  38960. class SizeRangeFilterIterator extends FilterIterator
  38961. {
  38962. private $comparators = array();
  38963. public function __construct(\Iterator $iterator, array $comparators)
  38964. {
  38965. $this->comparators = $comparators;
  38966. parent::__construct($iterator);
  38967. }
  38968. public function accept()
  38969. {
  38970. $fileinfo = $this->current();
  38971. if (!$fileinfo->isFile()) {
  38972. return true;
  38973. }
  38974. $filesize = $fileinfo->getSize();
  38975. foreach ($this->comparators as $compare) {
  38976. if (!$compare->test($filesize)) {
  38977. return false;
  38978. }
  38979. }
  38980. return true;
  38981. }
  38982. }
  38983. <?php
  38984. namespace Symfony\Component\Finder\Iterator;
  38985. class SortableIterator implements \IteratorAggregate
  38986. {
  38987. const SORT_BY_NAME = 1;
  38988. const SORT_BY_TYPE = 2;
  38989. const SORT_BY_ACCESSED_TIME = 3;
  38990. const SORT_BY_CHANGED_TIME = 4;
  38991. const SORT_BY_MODIFIED_TIME = 5;
  38992. private $iterator;
  38993. private $sort;
  38994. public function __construct(\Traversable $iterator, $sort)
  38995. {
  38996. $this->iterator = $iterator;
  38997. if (self::SORT_BY_NAME === $sort) {
  38998. $this->sort = function ($a, $b) {
  38999. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  39000. };
  39001. } elseif (self::SORT_BY_TYPE === $sort) {
  39002. $this->sort = function ($a, $b) {
  39003. if ($a->isDir() && $b->isFile()) {
  39004. return -1;
  39005. } elseif ($a->isFile() && $b->isDir()) {
  39006. return 1;
  39007. }
  39008. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  39009. };
  39010. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  39011. $this->sort = function ($a, $b) {
  39012. return $a->getATime() - $b->getATime();
  39013. };
  39014. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  39015. $this->sort = function ($a, $b) {
  39016. return $a->getCTime() - $b->getCTime();
  39017. };
  39018. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  39019. $this->sort = function ($a, $b) {
  39020. return $a->getMTime() - $b->getMTime();
  39021. };
  39022. } elseif (is_callable($sort)) {
  39023. $this->sort = $sort;
  39024. } else {
  39025. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  39026. }
  39027. }
  39028. public function getIterator()
  39029. {
  39030. $array = iterator_to_array($this->iterator, true);
  39031. uasort($array, $this->sort);
  39032. return new \ArrayIterator($array);
  39033. }
  39034. }
  39035. Copyright (c) 2004-2016 Fabien Potencier
  39036. Permission is hereby granted, free of charge, to any person obtaining a copy
  39037. of this software and associated documentation files (the "Software"), to deal
  39038. in the Software without restriction, including without limitation the rights
  39039. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39040. copies of the Software, and to permit persons to whom the Software is furnished
  39041. to do so, subject to the following conditions:
  39042. The above copyright notice and this permission notice shall be included in all
  39043. copies or substantial portions of the Software.
  39044. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39045. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39046. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39047. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39048. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39049. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39050. THE SOFTWARE.
  39051. <?php
  39052. namespace Symfony\Component\Finder\Shell;
  39053. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39054. class Command
  39055. {
  39056. private $parent;
  39057. private $bits = array();
  39058. private $labels = array();
  39059. private $errorHandler;
  39060. public function __construct(Command $parent = null)
  39061. {
  39062. $this->parent = $parent;
  39063. }
  39064. public function __toString()
  39065. {
  39066. return $this->join();
  39067. }
  39068. public static function create(Command $parent = null)
  39069. {
  39070. return new self($parent);
  39071. }
  39072. public static function escape($input)
  39073. {
  39074. return escapeshellcmd($input);
  39075. }
  39076. public static function quote($input)
  39077. {
  39078. return escapeshellarg($input);
  39079. }
  39080. public function add($bit)
  39081. {
  39082. $this->bits[] = $bit;
  39083. return $this;
  39084. }
  39085. public function top($bit)
  39086. {
  39087. array_unshift($this->bits, $bit);
  39088. foreach ($this->labels as $label => $index) {
  39089. $this->labels[$label] += 1;
  39090. }
  39091. return $this;
  39092. }
  39093. public function arg($arg)
  39094. {
  39095. $this->bits[] = self::quote($arg);
  39096. return $this;
  39097. }
  39098. public function cmd($esc)
  39099. {
  39100. $this->bits[] = self::escape($esc);
  39101. return $this;
  39102. }
  39103. public function ins($label)
  39104. {
  39105. if (isset($this->labels[$label])) {
  39106. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  39107. }
  39108. $this->bits[] = self::create($this);
  39109. $this->labels[$label] = count($this->bits) - 1;
  39110. return $this->bits[$this->labels[$label]];
  39111. }
  39112. public function get($label)
  39113. {
  39114. if (!isset($this->labels[$label])) {
  39115. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  39116. }
  39117. return $this->bits[$this->labels[$label]];
  39118. }
  39119. public function end()
  39120. {
  39121. if (null === $this->parent) {
  39122. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  39123. }
  39124. return $this->parent;
  39125. }
  39126. public function length()
  39127. {
  39128. return count($this->bits);
  39129. }
  39130. public function setErrorHandler(\Closure $errorHandler)
  39131. {
  39132. $this->errorHandler = $errorHandler;
  39133. return $this;
  39134. }
  39135. public function getErrorHandler()
  39136. {
  39137. return $this->errorHandler;
  39138. }
  39139. public function execute()
  39140. {
  39141. if (null === $errorHandler = $this->errorHandler) {
  39142. exec($this->join(), $output);
  39143. } else {
  39144. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  39145. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  39146. if ($error = stream_get_contents($pipes[2])) {
  39147. $errorHandler($error);
  39148. }
  39149. proc_close($process);
  39150. }
  39151. return $output ?: array();
  39152. }
  39153. public function join()
  39154. {
  39155. return implode(' ', array_filter(
  39156. array_map(function ($bit) {
  39157. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  39158. }, $this->bits),
  39159. function ($bit) { return null !== $bit; }
  39160. ));
  39161. }
  39162. public function addAtIndex($bit, $index)
  39163. {
  39164. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  39165. return $this;
  39166. }
  39167. }
  39168. <?php
  39169. namespace Symfony\Component\Finder\Shell;
  39170. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39171. class Shell
  39172. {
  39173. const TYPE_UNIX = 1;
  39174. const TYPE_DARWIN = 2;
  39175. const TYPE_CYGWIN = 3;
  39176. const TYPE_WINDOWS = 4;
  39177. const TYPE_BSD = 5;
  39178. private $type;
  39179. public function getType()
  39180. {
  39181. if (null === $this->type) {
  39182. $this->type = $this->guessType();
  39183. }
  39184. return $this->type;
  39185. }
  39186. public function testCommand($command)
  39187. {
  39188. if (!function_exists('exec')) {
  39189. return false;
  39190. }
  39191. $testCommand = 'which ';
  39192. if (self::TYPE_WINDOWS === $this->type) {
  39193. $testCommand = 'where ';
  39194. }
  39195. $command = escapeshellcmd($command);
  39196. exec($testCommand.$command, $output, $code);
  39197. return 0 === $code && count($output) > 0;
  39198. }
  39199. private function guessType()
  39200. {
  39201. $os = strtolower(PHP_OS);
  39202. if (false !== strpos($os, 'cygwin')) {
  39203. return self::TYPE_CYGWIN;
  39204. }
  39205. if (false !== strpos($os, 'darwin')) {
  39206. return self::TYPE_DARWIN;
  39207. }
  39208. if (false !== strpos($os, 'bsd')) {
  39209. return self::TYPE_BSD;
  39210. }
  39211. if (0 === strpos($os, 'win')) {
  39212. return self::TYPE_WINDOWS;
  39213. }
  39214. return self::TYPE_UNIX;
  39215. }
  39216. }
  39217. <?php
  39218. namespace Symfony\Component\Finder;
  39219. class SplFileInfo extends \SplFileInfo
  39220. {
  39221. private $relativePath;
  39222. private $relativePathname;
  39223. public function __construct($file, $relativePath, $relativePathname)
  39224. {
  39225. parent::__construct($file);
  39226. $this->relativePath = $relativePath;
  39227. $this->relativePathname = $relativePathname;
  39228. }
  39229. public function getRelativePath()
  39230. {
  39231. return $this->relativePath;
  39232. }
  39233. public function getRelativePathname()
  39234. {
  39235. return $this->relativePathname;
  39236. }
  39237. public function getContents()
  39238. {
  39239. $level = error_reporting(0);
  39240. $content = file_get_contents($this->getPathname());
  39241. error_reporting($level);
  39242. if (false === $content) {
  39243. $error = error_get_last();
  39244. throw new \RuntimeException($error['message']);
  39245. }
  39246. return $content;
  39247. }
  39248. }
  39249. Copyright (c) 2014-2016 Fabien Potencier
  39250. Permission is hereby granted, free of charge, to any person obtaining a copy
  39251. of this software and associated documentation files (the "Software"), to deal
  39252. in the Software without restriction, including without limitation the rights
  39253. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39254. copies of the Software, and to permit persons to whom the Software is furnished
  39255. to do so, subject to the following conditions:
  39256. The above copyright notice and this permission notice shall be included in all
  39257. copies or substantial portions of the Software.
  39258. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39259. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39260. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39261. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39262. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39263. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39264. THE SOFTWARE.
  39265. <?php
  39266. namespace Symfony\Polyfill\Mbstring;
  39267. final class Mbstring
  39268. {
  39269. const MB_CASE_FOLD = PHP_INT_MAX;
  39270. private static $encodingList = array('ASCII', 'UTF-8');
  39271. private static $language = 'neutral';
  39272. private static $internalEncoding = 'UTF-8';
  39273. private static $caseFold = array(
  39274. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  39275. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  39276. );
  39277. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  39278. {
  39279. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  39280. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  39281. } else {
  39282. $fromEncoding = self::getEncoding($fromEncoding);
  39283. }
  39284. $toEncoding = self::getEncoding($toEncoding);
  39285. if ('BASE64' === $fromEncoding) {
  39286. $s = base64_decode($s);
  39287. $fromEncoding = $toEncoding;
  39288. }
  39289. if ('BASE64' === $toEncoding) {
  39290. return base64_encode($s);
  39291. }
  39292. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  39293. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  39294. $fromEncoding = 'Windows-1252';
  39295. }
  39296. if ('UTF-8' !== $fromEncoding) {
  39297. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  39298. }
  39299. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  39300. }
  39301. if ('HTML-ENTITIES' === $fromEncoding) {
  39302. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  39303. $fromEncoding = 'UTF-8';
  39304. }
  39305. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  39306. }
  39307. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  39308. {
  39309. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  39310. $ok = true;
  39311. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  39312. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  39313. $ok = false;
  39314. }
  39315. });
  39316. return $ok ? $fromEncoding : false;
  39317. }
  39318. public static function mb_decode_mimeheader($s)
  39319. {
  39320. return iconv_mime_decode($s, 2, self::$internalEncoding);
  39321. }
  39322. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  39323. {
  39324. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  39325. }
  39326. public static function mb_convert_case($s, $mode, $encoding = null)
  39327. {
  39328. if ('' === $s .= '') {
  39329. return '';
  39330. }
  39331. $encoding = self::getEncoding($encoding);
  39332. if ('UTF-8' === $encoding) {
  39333. $encoding = null;
  39334. } else {
  39335. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  39336. }
  39337. if (MB_CASE_TITLE == $mode) {
  39338. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  39339. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  39340. } else {
  39341. if (MB_CASE_UPPER == $mode) {
  39342. static $upper = null;
  39343. if (null === $upper) {
  39344. $upper = self::getData('upperCase');
  39345. }
  39346. $map = $upper;
  39347. } else {
  39348. if (self::MB_CASE_FOLD === $mode) {
  39349. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  39350. }
  39351. static $lower = null;
  39352. if (null === $lower) {
  39353. $lower = self::getData('lowerCase');
  39354. }
  39355. $map = $lower;
  39356. }
  39357. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  39358. $i = 0;
  39359. $len = strlen($s);
  39360. while ($i < $len) {
  39361. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  39362. $uchr = substr($s, $i, $ulen);
  39363. $i += $ulen;
  39364. if (isset($map[$uchr])) {
  39365. $uchr = $map[$uchr];
  39366. $nlen = strlen($uchr);
  39367. if ($nlen == $ulen) {
  39368. $nlen = $i;
  39369. do {
  39370. $s[--$nlen] = $uchr[--$ulen];
  39371. } while ($ulen);
  39372. } else {
  39373. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  39374. $len += $nlen - $ulen;
  39375. $i += $nlen - $ulen;
  39376. }
  39377. }
  39378. }
  39379. }
  39380. if (null === $encoding) {
  39381. return $s;
  39382. }
  39383. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  39384. }
  39385. public static function mb_internal_encoding($encoding = null)
  39386. {
  39387. if (null === $encoding) {
  39388. return self::$internalEncoding;
  39389. }
  39390. $encoding = self::getEncoding($encoding);
  39391. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  39392. self::$internalEncoding = $encoding;
  39393. return true;
  39394. }
  39395. return false;
  39396. }
  39397. public static function mb_language($lang = null)
  39398. {
  39399. if (null === $lang) {
  39400. return self::$language;
  39401. }
  39402. switch ($lang = strtolower($lang)) {
  39403. case 'uni':
  39404. case 'neutral':
  39405. self::$language = $lang;
  39406. return true;
  39407. }
  39408. return false;
  39409. }
  39410. public static function mb_list_encodings()
  39411. {
  39412. return array('UTF-8');
  39413. }
  39414. public static function mb_encoding_aliases($encoding)
  39415. {
  39416. switch (strtoupper($encoding)) {
  39417. case 'UTF8':
  39418. case 'UTF-8':
  39419. return array('utf8');
  39420. }
  39421. return false;
  39422. }
  39423. public static function mb_check_encoding($var = null, $encoding = null)
  39424. {
  39425. if (null === $encoding) {
  39426. if (null === $var) {
  39427. return false;
  39428. }
  39429. $encoding = self::$internalEncoding;
  39430. }
  39431. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  39432. }
  39433. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  39434. {
  39435. if (null === $encodingList) {
  39436. $encodingList = self::$encodingList;
  39437. } else {
  39438. if (!is_array($encodingList)) {
  39439. $encodingList = array_map('trim', explode(',', $encodingList));
  39440. }
  39441. $encodingList = array_map('strtoupper', $encodingList);
  39442. }
  39443. foreach ($encodingList as $enc) {
  39444. switch ($enc) {
  39445. case 'ASCII':
  39446. if (!preg_match('/[\x80-\xFF]/', $str)) {
  39447. return $enc;
  39448. }
  39449. break;
  39450. case 'UTF8':
  39451. case 'UTF-8':
  39452. if (preg_match('//u', $str)) {
  39453. return 'UTF-8';
  39454. }
  39455. break;
  39456. default:
  39457. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  39458. return $enc;
  39459. }
  39460. }
  39461. }
  39462. return false;
  39463. }
  39464. public static function mb_detect_order($encodingList = null)
  39465. {
  39466. if (null === $encodingList) {
  39467. return self::$encodingList;
  39468. }
  39469. if (!is_array($encodingList)) {
  39470. $encodingList = array_map('trim', explode(',', $encodingList));
  39471. }
  39472. $encodingList = array_map('strtoupper', $encodingList);
  39473. foreach ($encodingList as $enc) {
  39474. switch ($enc) {
  39475. default:
  39476. if (strncmp($enc, 'ISO-8859-', 9)) {
  39477. return false;
  39478. }
  39479. case 'ASCII':
  39480. case 'UTF8':
  39481. case 'UTF-8':
  39482. }
  39483. }
  39484. self::$encodingList = $encodingList;
  39485. return true;
  39486. }
  39487. public static function mb_strlen($s, $encoding = null)
  39488. {
  39489. switch ($encoding = self::getEncoding($encoding)) {
  39490. case 'ASCII':
  39491. case 'CP850':
  39492. return strlen($s);
  39493. }
  39494. return @iconv_strlen($s, $encoding);
  39495. }
  39496. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  39497. {
  39498. $encoding = self::getEncoding($encoding);
  39499. if ('' === $needle .= '') {
  39500. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  39501. return false;
  39502. }
  39503. return iconv_strpos($haystack, $needle, $offset, $encoding);
  39504. }
  39505. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  39506. {
  39507. $encoding = self::getEncoding($encoding);
  39508. if ($offset != (int) $offset) {
  39509. $offset = 0;
  39510. } elseif ($offset = (int) $offset) {
  39511. if ($offset < 0) {
  39512. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  39513. $offset = 0;
  39514. } else {
  39515. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  39516. }
  39517. }
  39518. $pos = iconv_strrpos($haystack, $needle, $encoding);
  39519. return false !== $pos ? $offset + $pos : false;
  39520. }
  39521. public static function mb_strtolower($s, $encoding = null)
  39522. {
  39523. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  39524. }
  39525. public static function mb_strtoupper($s, $encoding = null)
  39526. {
  39527. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  39528. }
  39529. public static function mb_substitute_character($c = null)
  39530. {
  39531. if (0 === strcasecmp($c, 'none')) {
  39532. return true;
  39533. }
  39534. return null !== $c ? false : 'none';
  39535. }
  39536. public static function mb_substr($s, $start, $length = null, $encoding = null)
  39537. {
  39538. $encoding = self::getEncoding($encoding);
  39539. if ($start < 0) {
  39540. $start = iconv_strlen($s, $encoding) + $start;
  39541. if ($start < 0) {
  39542. $start = 0;
  39543. }
  39544. }
  39545. if (null === $length) {
  39546. $length = 2147483647;
  39547. } elseif ($length < 0) {
  39548. $length = iconv_strlen($s, $encoding) + $length - $start;
  39549. if ($length < 0) {
  39550. return '';
  39551. }
  39552. }
  39553. return iconv_substr($s, $start, $length, $encoding).'';
  39554. }
  39555. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  39556. {
  39557. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  39558. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  39559. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  39560. }
  39561. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  39562. {
  39563. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  39564. return self::getSubpart($pos, $part, $haystack, $encoding);
  39565. }
  39566. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  39567. {
  39568. $encoding = self::getEncoding($encoding);
  39569. $needle = self::mb_substr($needle, 0, 1, $encoding);
  39570. $pos = iconv_strrpos($haystack, $needle, $encoding);
  39571. return self::getSubpart($pos, $part, $haystack, $encoding);
  39572. }
  39573. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  39574. {
  39575. $needle = self::mb_substr($needle, 0, 1, $encoding);
  39576. $pos = self::mb_strripos($haystack, $needle, $encoding);
  39577. return self::getSubpart($pos, $part, $haystack, $encoding);
  39578. }
  39579. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  39580. {
  39581. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  39582. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  39583. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  39584. }
  39585. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  39586. {
  39587. $pos = strpos($haystack, $needle);
  39588. if (false === $pos) {
  39589. return false;
  39590. }
  39591. if ($part) {
  39592. return substr($haystack, 0, $pos);
  39593. }
  39594. return substr($haystack, $pos);
  39595. }
  39596. public static function mb_get_info($type = 'all')
  39597. {
  39598. $info = array(
  39599. 'internal_encoding' => self::$internalEncoding,
  39600. 'http_output' => 'pass',
  39601. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  39602. 'func_overload' => 0,
  39603. 'func_overload_list' => 'no overload',
  39604. 'mail_charset' => 'UTF-8',
  39605. 'mail_header_encoding' => 'BASE64',
  39606. 'mail_body_encoding' => 'BASE64',
  39607. 'illegal_chars' => 0,
  39608. 'encoding_translation' => 'Off',
  39609. 'language' => self::$language,
  39610. 'detect_order' => self::$encodingList,
  39611. 'substitute_character' => 'none',
  39612. 'strict_detection' => 'Off',
  39613. );
  39614. if ('all' === $type) {
  39615. return $info;
  39616. }
  39617. if (isset($info[$type])) {
  39618. return $info[$type];
  39619. }
  39620. return false;
  39621. }
  39622. public static function mb_http_input($type = '')
  39623. {
  39624. return false;
  39625. }
  39626. public static function mb_http_output($encoding = null)
  39627. {
  39628. return null !== $encoding ? 'pass' === $encoding : 'pass';
  39629. }
  39630. public static function mb_strwidth($s, $encoding = null)
  39631. {
  39632. $encoding = self::getEncoding($encoding);
  39633. if ('UTF-8' !== $encoding) {
  39634. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  39635. }
  39636. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  39637. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  39638. }
  39639. public static function mb_substr_count($haystack, $needle, $encoding = null)
  39640. {
  39641. return substr_count($haystack, $needle);
  39642. }
  39643. public static function mb_output_handler($contents, $status)
  39644. {
  39645. return $contents;
  39646. }
  39647. public static function mb_chr($code, $encoding = null)
  39648. {
  39649. if (0x80 > $code %= 0x200000) {
  39650. $s = chr($code);
  39651. } elseif (0x800 > $code) {
  39652. $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F);
  39653. } elseif (0x10000 > $code) {
  39654. $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  39655. } else {
  39656. $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  39657. }
  39658. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  39659. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  39660. }
  39661. return $s;
  39662. }
  39663. public static function mb_ord($s, $encoding = null)
  39664. {
  39665. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  39666. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  39667. }
  39668. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  39669. if (0xF0 <= $code) {
  39670. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  39671. }
  39672. if (0xE0 <= $code) {
  39673. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  39674. }
  39675. if (0xC0 <= $code) {
  39676. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  39677. }
  39678. return $code;
  39679. }
  39680. private static function getSubpart($pos, $part, $haystack, $encoding)
  39681. {
  39682. if (false === $pos) {
  39683. return false;
  39684. }
  39685. if ($part) {
  39686. return self::mb_substr($haystack, 0, $pos, $encoding);
  39687. }
  39688. return self::mb_substr($haystack, $pos, null, $encoding);
  39689. }
  39690. private static function html_encoding_callback($m)
  39691. {
  39692. $i = 1;
  39693. $entities = '';
  39694. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  39695. while (isset($m[$i])) {
  39696. if (0x80 > $m[$i]) {
  39697. $entities .= chr($m[$i++]);
  39698. continue;
  39699. }
  39700. if (0xF0 <= $m[$i]) {
  39701. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  39702. } elseif (0xE0 <= $m[$i]) {
  39703. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  39704. } else {
  39705. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  39706. }
  39707. $entities .= '&#'.$c.';';
  39708. }
  39709. return $entities;
  39710. }
  39711. private static function title_case_lower($s)
  39712. {
  39713. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  39714. }
  39715. private static function title_case_upper($s)
  39716. {
  39717. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  39718. }
  39719. private static function getData($file)
  39720. {
  39721. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  39722. return require $file;
  39723. }
  39724. return false;
  39725. }
  39726. private static function getEncoding($encoding)
  39727. {
  39728. if (null === $encoding) {
  39729. return self::$internalEncoding;
  39730. }
  39731. $encoding = strtoupper($encoding);
  39732. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  39733. return 'CP850';
  39734. }
  39735. if ('UTF8' === $encoding) {
  39736. return 'UTF-8';
  39737. }
  39738. return $encoding;
  39739. }
  39740. }
  39741. <?php
  39742. static $data = array (
  39743. 'A' => 'a',
  39744. 'B' => 'b',
  39745. 'C' => 'c',
  39746. 'D' => 'd',
  39747. 'E' => 'e',
  39748. 'F' => 'f',
  39749. 'G' => 'g',
  39750. 'H' => 'h',
  39751. 'I' => 'i',
  39752. 'J' => 'j',
  39753. 'K' => 'k',
  39754. 'L' => 'l',
  39755. 'M' => 'm',
  39756. 'N' => 'n',
  39757. 'O' => 'o',
  39758. 'P' => 'p',
  39759. 'Q' => 'q',
  39760. 'R' => 'r',
  39761. 'S' => 's',
  39762. 'T' => 't',
  39763. 'U' => 'u',
  39764. 'V' => 'v',
  39765. 'W' => 'w',
  39766. 'X' => 'x',
  39767. 'Y' => 'y',
  39768. 'Z' => 'z',
  39769. 'À' => 'à',
  39770. '�' => 'á',
  39771. 'Â' => 'â',
  39772. 'Ã' => 'ã',
  39773. 'Ä' => 'ä',
  39774. 'Ã…' => 'Ã¥',
  39775. 'Æ' => 'æ',
  39776. 'Ç' => 'ç',
  39777. 'È' => 'è',
  39778. 'É' => 'é',
  39779. 'Ê' => 'ê',
  39780. 'Ë' => 'ë',
  39781. 'Ì' => 'ì',
  39782. '�' => 'í',
  39783. 'Î' => 'î',
  39784. '�' => 'ï',
  39785. '�' => 'ð',
  39786. 'Ñ' => 'ñ',
  39787. 'Ò' => 'ò',
  39788. 'Ó' => 'ó',
  39789. 'Ô' => 'ô',
  39790. 'Õ' => 'õ',
  39791. 'Ö' => 'ö',
  39792. 'Ø' => 'ø',
  39793. 'Ù' => 'ù',
  39794. 'Ú' => 'ú',
  39795. 'Û' => 'û',
  39796. 'Ü' => 'ü',
  39797. '�' => 'ý',
  39798. 'Þ' => 'þ',
  39799. 'Ā' => '�',
  39800. 'Ă' => 'ă',
  39801. 'Ä„' => 'Ä…',
  39802. 'Ć' => 'ć',
  39803. 'Ĉ' => 'ĉ',
  39804. 'ÄŠ' => 'Ä‹',
  39805. 'Č' => '�',
  39806. 'Ď' => '�',
  39807. '�' => 'đ',
  39808. 'Ä’' => 'Ä“',
  39809. 'Ä”' => 'Ä•',
  39810. 'Ä–' => 'Ä—',
  39811. 'Ę' => 'ę',
  39812. 'Äš' => 'Ä›',
  39813. 'Ĝ' => '�',
  39814. 'Äž' => 'ÄŸ',
  39815. 'Ä ' => 'Ä¡',
  39816. 'Ä¢' => 'Ä£',
  39817. 'Ĥ' => 'ĥ',
  39818. 'Ħ' => 'ħ',
  39819. 'Ĩ' => 'ĩ',
  39820. 'Ī' => 'ī',
  39821. 'Ĭ' => 'ĭ',
  39822. 'Į' => 'į',
  39823. 'Ä°' => 'i',
  39824. 'IJ' => 'ij',
  39825. 'Ĵ' => 'ĵ',
  39826. 'Ķ' => 'ķ',
  39827. 'Ĺ' => 'ĺ',
  39828. 'Ļ' => 'ļ',
  39829. 'Ľ' => 'ľ',
  39830. 'Ä¿' => 'Å€',
  39831. '�' => 'ł',
  39832. 'Ń' => 'ń',
  39833. 'Ņ' => 'ņ',
  39834. 'Ň' => 'ň',
  39835. 'ÅŠ' => 'Å‹',
  39836. 'Ō' => '�',
  39837. 'Ŏ' => '�',
  39838. '�' => 'ő',
  39839. 'Å’' => 'Å“',
  39840. 'Å”' => 'Å•',
  39841. 'Å–' => 'Å—',
  39842. 'Ř' => 'ř',
  39843. 'Åš' => 'Å›',
  39844. 'Ŝ' => '�',
  39845. 'Åž' => 'ÅŸ',
  39846. 'Å ' => 'Å¡',
  39847. 'Å¢' => 'Å£',
  39848. 'Ť' => 'ť',
  39849. 'Ŧ' => 'ŧ',
  39850. 'Ũ' => 'ũ',
  39851. 'Ū' => 'ū',
  39852. 'Ŭ' => 'ŭ',
  39853. 'Ů' => 'ů',
  39854. 'Ű' => 'ű',
  39855. 'Ų' => 'ų',
  39856. 'Ŵ' => 'ŵ',
  39857. 'Ŷ' => 'ŷ',
  39858. 'Ÿ' => 'ÿ',
  39859. 'Ź' => 'ź',
  39860. 'Ż' => 'ż',
  39861. 'Ž' => 'ž',
  39862. '�' => 'ɓ',
  39863. 'Ƃ' => 'ƃ',
  39864. 'Æ„' => 'Æ…',
  39865. 'Ɔ' => 'ɔ',
  39866. 'Ƈ' => 'ƈ',
  39867. 'Ɖ' => 'ɖ',
  39868. 'ÆŠ' => 'É—',
  39869. 'Ƌ' => 'ƌ',
  39870. 'Ǝ' => '�',
  39871. '�' => 'ə',
  39872. '�' => 'ɛ',
  39873. 'Æ‘' => 'Æ’',
  39874. 'Æ“' => 'É ',
  39875. 'Æ”' => 'É£',
  39876. 'Æ–' => 'É©',
  39877. 'Ɨ' => 'ɨ',
  39878. 'Ƙ' => 'ƙ',
  39879. 'Ɯ' => 'ɯ',
  39880. '�' => 'ɲ',
  39881. 'Ɵ' => 'ɵ',
  39882. 'Æ ' => 'Æ¡',
  39883. 'Æ¢' => 'Æ£',
  39884. 'Ƥ' => 'ƥ',
  39885. 'Ʀ' => 'ʀ',
  39886. 'Ƨ' => 'ƨ',
  39887. 'Ʃ' => 'ʃ',
  39888. 'Ƭ' => 'ƭ',
  39889. 'Ʈ' => 'ʈ',
  39890. 'Ư' => 'ư',
  39891. 'Ʊ' => 'ʊ',
  39892. 'Ʋ' => 'ʋ',
  39893. 'Ƴ' => 'ƴ',
  39894. 'Ƶ' => 'ƶ',
  39895. 'Æ·' => 'Ê’',
  39896. 'Ƹ' => 'ƹ',
  39897. 'Ƽ' => 'ƽ',
  39898. 'DŽ' => 'dž',
  39899. 'Dž' => 'dž',
  39900. 'LJ' => 'lj',
  39901. 'Lj' => 'lj',
  39902. 'NJ' => 'nj',
  39903. 'Nj' => 'nj',
  39904. '�' => 'ǎ',
  39905. '�' => '�',
  39906. 'Ç‘' => 'Ç’',
  39907. 'Ç“' => 'Ç”',
  39908. 'Ç•' => 'Ç–',
  39909. 'Ǘ' => 'ǘ',
  39910. 'Ç™' => 'Çš',
  39911. 'Ǜ' => 'ǜ',
  39912. 'Çž' => 'ÇŸ',
  39913. 'Ç ' => 'Ç¡',
  39914. 'Ç¢' => 'Ç£',
  39915. 'Ǥ' => 'ǥ',
  39916. 'Ǧ' => 'ǧ',
  39917. 'Ǩ' => 'ǩ',
  39918. 'Ǫ' => 'ǫ',
  39919. 'Ǭ' => 'ǭ',
  39920. 'Ǯ' => 'ǯ',
  39921. 'DZ' => 'dz',
  39922. 'Dz' => 'dz',
  39923. 'Ǵ' => 'ǵ',
  39924. 'Ƕ' => 'ƕ',
  39925. 'Ç·' => 'Æ¿',
  39926. 'Ǹ' => 'ǹ',
  39927. 'Ǻ' => 'ǻ',
  39928. 'Ǽ' => 'ǽ',
  39929. 'Ǿ' => 'ǿ',
  39930. 'Ȁ' => '�',
  39931. 'Ȃ' => 'ȃ',
  39932. 'È„' => 'È…',
  39933. 'Ȇ' => 'ȇ',
  39934. 'Ȉ' => 'ȉ',
  39935. 'ÈŠ' => 'È‹',
  39936. 'Ȍ' => '�',
  39937. 'Ȏ' => '�',
  39938. '�' => 'ȑ',
  39939. 'È’' => 'È“',
  39940. 'È”' => 'È•',
  39941. 'È–' => 'È—',
  39942. 'Ș' => 'ș',
  39943. 'Èš' => 'È›',
  39944. 'Ȝ' => '�',
  39945. 'Èž' => 'ÈŸ',
  39946. 'È ' => 'Æž',
  39947. 'È¢' => 'È£',
  39948. 'Ȥ' => 'ȥ',
  39949. 'Ȧ' => 'ȧ',
  39950. 'Ȩ' => 'ȩ',
  39951. 'Ȫ' => 'ȫ',
  39952. 'Ȭ' => 'ȭ',
  39953. 'Ȯ' => 'ȯ',
  39954. 'Ȱ' => 'ȱ',
  39955. 'Ȳ' => 'ȳ',
  39956. 'Ⱥ' => 'ⱥ',
  39957. 'Ȼ' => 'ȼ',
  39958. 'Ƚ' => 'ƚ',
  39959. 'Ⱦ' => 'ⱦ',
  39960. '�' => 'ɂ',
  39961. 'Ƀ' => 'ƀ',
  39962. 'Ʉ' => 'ʉ',
  39963. 'Ʌ' => 'ʌ',
  39964. 'Ɇ' => 'ɇ',
  39965. 'Ɉ' => 'ɉ',
  39966. 'ÉŠ' => 'É‹',
  39967. 'Ɍ' => '�',
  39968. 'Ɏ' => '�',
  39969. 'Ͱ' => 'ͱ',
  39970. 'Ͳ' => 'ͳ',
  39971. 'Ͷ' => 'ͷ',
  39972. 'Ϳ' => 'ϳ',
  39973. 'Ά' => 'ά',
  39974. 'Έ' => 'έ',
  39975. 'Ή' => 'ή',
  39976. 'Ί' => 'ί',
  39977. 'Ό' => 'ό',
  39978. 'Ύ' => '�',
  39979. '�' => 'ώ',
  39980. 'Α' => 'α',
  39981. 'Β' => 'β',
  39982. 'Γ' => 'γ',
  39983. 'Δ' => 'δ',
  39984. 'Ε' => 'ε',
  39985. 'Ζ' => 'ζ',
  39986. 'Η' => 'η',
  39987. 'Θ' => 'θ',
  39988. 'Ι' => 'ι',
  39989. 'Κ' => 'κ',
  39990. 'Λ' => 'λ',
  39991. 'Μ' => 'μ',
  39992. '�' => 'ν',
  39993. 'Ξ' => 'ξ',
  39994. 'Ο' => 'ο',
  39995. 'Π' => 'π',
  39996. 'Ρ' => '�',
  39997. 'Σ' => 'σ',
  39998. 'Τ' => 'τ',
  39999. 'Î¥' => 'Ï…',
  40000. 'Φ' => 'φ',
  40001. 'Χ' => 'χ',
  40002. 'Ψ' => 'ψ',
  40003. 'Ω' => 'ω',
  40004. 'Ϊ' => 'ϊ',
  40005. 'Ϋ' => 'ϋ',
  40006. '�' => 'ϗ',
  40007. 'Ϙ' => 'ϙ',
  40008. 'Ïš' => 'Ï›',
  40009. 'Ϝ' => '�',
  40010. 'Ïž' => 'ÏŸ',
  40011. 'Ï ' => 'Ï¡',
  40012. 'Ï¢' => 'Ï£',
  40013. 'Ϥ' => 'ϥ',
  40014. 'Ϧ' => 'ϧ',
  40015. 'Ϩ' => 'ϩ',
  40016. 'Ϫ' => 'ϫ',
  40017. 'Ϭ' => 'ϭ',
  40018. 'Ϯ' => 'ϯ',
  40019. 'ϴ' => 'θ',
  40020. 'Ϸ' => 'ϸ',
  40021. 'Ϲ' => 'ϲ',
  40022. 'Ϻ' => 'ϻ',
  40023. 'Ͻ' => 'ͻ',
  40024. 'Ͼ' => 'ͼ',
  40025. 'Ͽ' => 'ͽ',
  40026. 'Ѐ' => '�',
  40027. '�' => 'ё',
  40028. 'Ђ' => 'ђ',
  40029. 'Ѓ' => 'ѓ',
  40030. 'Є' => 'є',
  40031. 'Ð…' => 'Ñ•',
  40032. 'І' => 'і',
  40033. 'Ї' => 'ї',
  40034. 'Ј' => 'ј',
  40035. 'Љ' => 'љ',
  40036. 'Њ' => 'њ',
  40037. 'Ћ' => 'ћ',
  40038. 'Ќ' => 'ќ',
  40039. '�' => '�',
  40040. 'ÐŽ' => 'Ñž',
  40041. '�' => 'џ',
  40042. '�' => 'а',
  40043. 'Б' => 'б',
  40044. 'В' => 'в',
  40045. 'Г' => 'г',
  40046. 'Д' => 'д',
  40047. 'Е' => 'е',
  40048. 'Ж' => 'ж',
  40049. 'З' => 'з',
  40050. 'И' => 'и',
  40051. 'Й' => 'й',
  40052. 'К' => 'к',
  40053. 'Л' => 'л',
  40054. 'М' => 'м',
  40055. '�' => 'н',
  40056. 'О' => 'о',
  40057. 'П' => 'п',
  40058. 'Р' => 'р',
  40059. 'С' => '�',
  40060. 'Т' => 'т',
  40061. 'У' => 'у',
  40062. 'Ф' => 'ф',
  40063. 'Ð¥' => 'Ñ…',
  40064. 'Ц' => 'ц',
  40065. 'Ч' => 'ч',
  40066. 'Ш' => 'ш',
  40067. 'Щ' => 'щ',
  40068. 'Ъ' => 'ъ',
  40069. 'Ы' => 'ы',
  40070. 'Ь' => 'ь',
  40071. 'Э' => '�',
  40072. 'Ю' => 'ю',
  40073. 'Я' => '�',
  40074. 'Ñ ' => 'Ñ¡',
  40075. 'Ñ¢' => 'Ñ£',
  40076. 'Ѥ' => 'ѥ',
  40077. 'Ѧ' => 'ѧ',
  40078. 'Ѩ' => 'ѩ',
  40079. 'Ѫ' => 'ѫ',
  40080. 'Ѭ' => 'ѭ',
  40081. 'Ѯ' => 'ѯ',
  40082. 'Ѱ' => 'ѱ',
  40083. 'Ѳ' => 'ѳ',
  40084. 'Ѵ' => 'ѵ',
  40085. 'Ѷ' => 'ѷ',
  40086. 'Ѹ' => 'ѹ',
  40087. 'Ѻ' => 'ѻ',
  40088. 'Ѽ' => 'ѽ',
  40089. 'Ѿ' => 'ѿ',
  40090. 'Ò€' => 'Ò�',
  40091. 'ÒŠ' => 'Ò‹',
  40092. 'Ҍ' => '�',
  40093. 'ÒŽ' => 'Ò�',
  40094. 'Ò�' => 'Ò‘',
  40095. 'Ò’' => 'Ò“',
  40096. 'Ò”' => 'Ò•',
  40097. 'Ò–' => 'Ò—',
  40098. 'Ò˜' => 'Ò™',
  40099. 'Òš' => 'Ò›',
  40100. 'Ҝ' => '�',
  40101. 'Òž' => 'ÒŸ',
  40102. 'Ò ' => 'Ò¡',
  40103. 'Ò¢' => 'Ò£',
  40104. 'Ò¤' => 'Ò¥',
  40105. 'Ò¦' => 'Ò§',
  40106. 'Ò¨' => 'Ò©',
  40107. 'Òª' => 'Ò«',
  40108. 'Ò¬' => 'Ò­',
  40109. 'Ò®' => 'Ò¯',
  40110. 'Ò°' => 'Ò±',
  40111. 'Ò²' => 'Ò³',
  40112. 'Ò´' => 'Òµ',
  40113. 'Ò¶' => 'Ò·',
  40114. 'Ò¸' => 'Ò¹',
  40115. 'Òº' => 'Ò»',
  40116. 'Ò¼' => 'Ò½',
  40117. 'Ò¾' => 'Ò¿',
  40118. 'Ó€' => 'Ó�',
  40119. 'Ó�' => 'Ó‚',
  40120. 'Óƒ' => 'Ó„',
  40121. 'Ó…' => 'Ó†',
  40122. 'Ó‡' => 'Óˆ',
  40123. 'Ó‰' => 'ÓŠ',
  40124. 'Ӌ' => 'ӌ',
  40125. 'Ó�' => 'ÓŽ',
  40126. 'Ó�' => 'Ó‘',
  40127. 'Ó’' => 'Ó“',
  40128. 'Ó”' => 'Ó•',
  40129. 'Ó–' => 'Ó—',
  40130. 'Ó˜' => 'Ó™',
  40131. 'Óš' => 'Ó›',
  40132. 'Ӝ' => '�',
  40133. 'Óž' => 'ÓŸ',
  40134. 'Ó ' => 'Ó¡',
  40135. 'Ó¢' => 'Ó£',
  40136. 'Ó¤' => 'Ó¥',
  40137. 'Ó¦' => 'Ó§',
  40138. 'Ó¨' => 'Ó©',
  40139. 'Óª' => 'Ó«',
  40140. 'Ó¬' => 'Ó­',
  40141. 'Ó®' => 'Ó¯',
  40142. 'Ó°' => 'Ó±',
  40143. 'Ó²' => 'Ó³',
  40144. 'Ó´' => 'Óµ',
  40145. 'Ó¶' => 'Ó·',
  40146. 'Ó¸' => 'Ó¹',
  40147. 'Óº' => 'Ó»',
  40148. 'Ó¼' => 'Ó½',
  40149. 'Ó¾' => 'Ó¿',
  40150. 'Ô€' => 'Ô�',
  40151. 'Ô‚' => 'Ôƒ',
  40152. 'Ô„' => 'Ô…',
  40153. 'Ô†' => 'Ô‡',
  40154. 'Ôˆ' => 'Ô‰',
  40155. 'ÔŠ' => 'Ô‹',
  40156. 'Ԍ' => '�',
  40157. 'ÔŽ' => 'Ô�',
  40158. 'Ô�' => 'Ô‘',
  40159. 'Ô’' => 'Ô“',
  40160. 'Ô”' => 'Ô•',
  40161. 'Ô–' => 'Ô—',
  40162. 'Ô˜' => 'Ô™',
  40163. 'Ôš' => 'Ô›',
  40164. 'Ԝ' => '�',
  40165. 'Ôž' => 'ÔŸ',
  40166. 'Ô ' => 'Ô¡',
  40167. 'Ô¢' => 'Ô£',
  40168. 'Ô¤' => 'Ô¥',
  40169. 'Ô¦' => 'Ô§',
  40170. 'Ô¨' => 'Ô©',
  40171. 'Ôª' => 'Ô«',
  40172. 'Ô¬' => 'Ô­',
  40173. 'Ô®' => 'Ô¯',
  40174. 'Ô±' => 'Õ¡',
  40175. 'Ô²' => 'Õ¢',
  40176. 'Ô³' => 'Õ£',
  40177. 'Ô´' => 'Õ¤',
  40178. 'Ôµ' => 'Õ¥',
  40179. 'Ô¶' => 'Õ¦',
  40180. 'Ô·' => 'Õ§',
  40181. 'Ô¸' => 'Õ¨',
  40182. 'Ô¹' => 'Õ©',
  40183. 'Ôº' => 'Õª',
  40184. 'Ô»' => 'Õ«',
  40185. 'Ô¼' => 'Õ¬',
  40186. 'Ô½' => 'Õ­',
  40187. 'Ô¾' => 'Õ®',
  40188. 'Ô¿' => 'Õ¯',
  40189. 'Õ€' => 'Õ°',
  40190. 'Õ�' => 'Õ±',
  40191. 'Õ‚' => 'Õ²',
  40192. 'Õƒ' => 'Õ³',
  40193. 'Õ„' => 'Õ´',
  40194. 'Õ…' => 'Õµ',
  40195. 'Õ†' => 'Õ¶',
  40196. 'Õ‡' => 'Õ·',
  40197. 'Õˆ' => 'Õ¸',
  40198. 'Õ‰' => 'Õ¹',
  40199. 'ÕŠ' => 'Õº',
  40200. 'Õ‹' => 'Õ»',
  40201. 'Ռ' => 'ռ',
  40202. 'Õ�' => 'Õ½',
  40203. 'ÕŽ' => 'Õ¾',
  40204. 'Õ�' => 'Õ¿',
  40205. 'Õ�' => 'Ö€',
  40206. 'Õ‘' => 'Ö�',
  40207. 'Õ’' => 'Ö‚',
  40208. 'Õ“' => 'Öƒ',
  40209. 'Õ”' => 'Ö„',
  40210. 'Õ•' => 'Ö…',
  40211. 'Õ–' => 'Ö†',
  40212. 'á‚ ' => 'â´€',
  40213. 'á‚¡' => 'â´�',
  40214. 'á‚¢' => 'â´‚',
  40215. 'á‚£' => 'â´ƒ',
  40216. 'Ⴄ' => 'ⴄ',
  40217. 'á‚¥' => 'â´…',
  40218. 'Ⴆ' => 'ⴆ',
  40219. 'Ⴇ' => 'ⴇ',
  40220. 'Ⴈ' => 'ⴈ',
  40221. 'á‚©' => 'â´‰',
  40222. 'Ⴊ' => 'ⴊ',
  40223. 'á‚«' => 'â´‹',
  40224. 'Ⴌ' => 'ⴌ',
  40225. 'á‚­' => 'â´�',
  40226. 'á‚®' => 'â´Ž',
  40227. 'Ⴏ' => '�',
  40228. 'á‚°' => 'â´�',
  40229. 'Ⴑ' => 'ⴑ',
  40230. 'Ⴒ' => 'ⴒ',
  40231. 'Ⴓ' => 'ⴓ',
  40232. 'á‚´' => 'â´”',
  40233. 'Ⴕ' => 'ⴕ',
  40234. 'Ⴖ' => 'ⴖ',
  40235. 'á‚·' => 'â´—',
  40236. 'Ⴘ' => 'ⴘ',
  40237. 'Ⴙ' => 'ⴙ',
  40238. 'Ⴚ' => 'ⴚ',
  40239. 'á‚»' => 'â´›',
  40240. 'Ⴜ' => 'ⴜ',
  40241. 'Ⴝ' => '�',
  40242. 'Ⴞ' => 'ⴞ',
  40243. 'á‚¿' => 'â´Ÿ',
  40244. 'Ⴠ' => 'ⴠ',
  40245. '�' => 'ⴡ',
  40246. 'Ⴢ' => 'ⴢ',
  40247. 'Ⴣ' => 'ⴣ',
  40248. 'Ⴤ' => 'ⴤ',
  40249. 'Ⴥ' => 'ⴥ',
  40250. 'Ⴧ' => 'ⴧ',
  40251. '�' => 'ⴭ',
  40252. 'Ḁ' => '�',
  40253. 'Ḃ' => 'ḃ',
  40254. 'Ḅ' => 'ḅ',
  40255. 'Ḇ' => 'ḇ',
  40256. 'Ḉ' => 'ḉ',
  40257. 'Ḋ' => 'ḋ',
  40258. 'Ḍ' => '�',
  40259. 'Ḏ' => '�',
  40260. '�' => 'ḑ',
  40261. 'Ḓ' => 'ḓ',
  40262. 'Ḕ' => 'ḕ',
  40263. 'Ḗ' => 'ḗ',
  40264. 'Ḙ' => 'ḙ',
  40265. 'Ḛ' => 'ḛ',
  40266. 'Ḝ' => '�',
  40267. 'Ḟ' => 'ḟ',
  40268. 'Ḡ' => 'ḡ',
  40269. 'Ḣ' => 'ḣ',
  40270. 'Ḥ' => 'ḥ',
  40271. 'Ḧ' => 'ḧ',
  40272. 'Ḩ' => 'ḩ',
  40273. 'Ḫ' => 'ḫ',
  40274. 'Ḭ' => 'ḭ',
  40275. 'Ḯ' => 'ḯ',
  40276. 'Ḱ' => 'ḱ',
  40277. 'Ḳ' => 'ḳ',
  40278. 'Ḵ' => 'ḵ',
  40279. 'Ḷ' => 'ḷ',
  40280. 'Ḹ' => 'ḹ',
  40281. 'Ḻ' => 'ḻ',
  40282. 'Ḽ' => 'ḽ',
  40283. 'Ḿ' => 'ḿ',
  40284. 'Ṁ' => '�',
  40285. 'Ṃ' => 'ṃ',
  40286. 'Ṅ' => 'ṅ',
  40287. 'Ṇ' => 'ṇ',
  40288. 'Ṉ' => 'ṉ',
  40289. 'Ṋ' => 'ṋ',
  40290. 'Ṍ' => '�',
  40291. 'Ṏ' => '�',
  40292. '�' => 'ṑ',
  40293. 'Ṓ' => 'ṓ',
  40294. 'Ṕ' => 'ṕ',
  40295. 'á¹–' => 'á¹—',
  40296. 'Ṙ' => 'ṙ',
  40297. 'Ṛ' => 'ṛ',
  40298. 'Ṝ' => '�',
  40299. 'Ṟ' => 'ṟ',
  40300. 'Ṡ' => 'ṡ',
  40301. 'á¹¢' => 'á¹£',
  40302. 'Ṥ' => 'ṥ',
  40303. 'Ṧ' => 'ṧ',
  40304. 'Ṩ' => 'ṩ',
  40305. 'Ṫ' => 'ṫ',
  40306. 'Ṭ' => 'ṭ',
  40307. 'Ṯ' => 'ṯ',
  40308. 'á¹°' => 'á¹±',
  40309. 'á¹²' => 'á¹³',
  40310. 'á¹´' => 'á¹µ',
  40311. 'Ṷ' => 'ṷ',
  40312. 'Ṹ' => 'ṹ',
  40313. 'Ṻ' => 'ṻ',
  40314. 'á¹¼' => 'á¹½',
  40315. 'Ṿ' => 'ṿ',
  40316. 'Ẁ' => '�',
  40317. 'Ẃ' => 'ẃ',
  40318. 'Ẅ' => 'ẅ',
  40319. 'Ẇ' => 'ẇ',
  40320. 'Ẉ' => 'ẉ',
  40321. 'Ẋ' => 'ẋ',
  40322. 'Ẍ' => '�',
  40323. 'Ẏ' => '�',
  40324. '�' => 'ẑ',
  40325. 'Ẓ' => 'ẓ',
  40326. 'Ẕ' => 'ẕ',
  40327. 'ẞ' => 'ß',
  40328. 'Ạ' => 'ạ',
  40329. 'Ả' => 'ả',
  40330. 'Ấ' => 'ấ',
  40331. 'Ầ' => 'ầ',
  40332. 'Ẩ' => 'ẩ',
  40333. 'Ẫ' => 'ẫ',
  40334. 'Ậ' => 'ậ',
  40335. 'Ắ' => 'ắ',
  40336. 'Ằ' => 'ằ',
  40337. 'Ẳ' => 'ẳ',
  40338. 'Ẵ' => 'ẵ',
  40339. 'Ặ' => 'ặ',
  40340. 'Ẹ' => 'ẹ',
  40341. 'Ẻ' => 'ẻ',
  40342. 'Ẽ' => 'ẽ',
  40343. 'Ế' => 'ế',
  40344. 'Ề' => '�',
  40345. 'Ể' => 'ể',
  40346. 'Ễ' => 'ễ',
  40347. 'Ệ' => 'ệ',
  40348. 'Ỉ' => 'ỉ',
  40349. 'Ị' => 'ị',
  40350. 'Ọ' => '�',
  40351. 'Ỏ' => '�',
  40352. '�' => 'ố',
  40353. 'Ồ' => 'ồ',
  40354. 'Ổ' => 'ổ',
  40355. 'á»–' => 'á»—',
  40356. 'Ộ' => 'ộ',
  40357. 'Ớ' => 'ớ',
  40358. 'Ờ' => '�',
  40359. 'Ở' => 'ở',
  40360. 'Ỡ' => 'ỡ',
  40361. 'Ợ' => 'ợ',
  40362. 'Ụ' => 'ụ',
  40363. 'Ủ' => 'ủ',
  40364. 'Ứ' => 'ứ',
  40365. 'Ừ' => 'ừ',
  40366. 'Ử' => 'ử',
  40367. 'Ữ' => 'ữ',
  40368. 'á»°' => 'á»±',
  40369. 'Ỳ' => 'ỳ',
  40370. 'Ỵ' => 'ỵ',
  40371. 'Ỷ' => 'ỷ',
  40372. 'Ỹ' => 'ỹ',
  40373. 'Ỻ' => 'ỻ',
  40374. 'Ỽ' => 'ỽ',
  40375. 'Ỿ' => 'ỿ',
  40376. 'Ἀ' => 'ἀ',
  40377. 'Ἁ' => '�',
  40378. 'Ἂ' => 'ἂ',
  40379. 'Ἃ' => 'ἃ',
  40380. 'Ἄ' => 'ἄ',
  40381. '�' => 'ἅ',
  40382. 'Ἆ' => 'ἆ',
  40383. '�' => 'ἇ',
  40384. 'Ἐ' => '�',
  40385. 'Ἑ' => 'ἑ',
  40386. 'Ἒ' => 'ἒ',
  40387. 'Ἓ' => 'ἓ',
  40388. 'Ἔ' => 'ἔ',
  40389. '�' => 'ἕ',
  40390. 'Ἠ' => 'ἠ',
  40391. 'Ἡ' => 'ἡ',
  40392. 'Ἢ' => 'ἢ',
  40393. 'Ἣ' => 'ἣ',
  40394. 'Ἤ' => 'ἤ',
  40395. 'á¼­' => 'á¼¥',
  40396. 'Ἦ' => 'ἦ',
  40397. 'Ἧ' => 'ἧ',
  40398. 'Ἰ' => 'ἰ',
  40399. 'á¼¹' => 'á¼±',
  40400. 'Ἲ' => 'ἲ',
  40401. 'á¼»' => 'á¼³',
  40402. 'á¼¼' => 'á¼´',
  40403. 'á¼½' => 'á¼µ',
  40404. 'Ἶ' => 'ἶ',
  40405. 'Ἷ' => 'ἷ',
  40406. 'Ὀ' => 'ὀ',
  40407. 'Ὁ' => '�',
  40408. 'Ὂ' => 'ὂ',
  40409. 'Ὃ' => 'ὃ',
  40410. 'Ὄ' => 'ὄ',
  40411. '�' => 'ὅ',
  40412. 'Ὑ' => 'ὑ',
  40413. 'Ὓ' => 'ὓ',
  40414. '�' => 'ὕ',
  40415. 'Ὗ' => 'ὗ',
  40416. 'Ὠ' => 'ὠ',
  40417. 'Ὡ' => 'ὡ',
  40418. 'Ὢ' => 'ὢ',
  40419. 'Ὣ' => 'ὣ',
  40420. 'Ὤ' => 'ὤ',
  40421. 'á½­' => 'á½¥',
  40422. 'Ὦ' => 'ὦ',
  40423. 'Ὧ' => 'ὧ',
  40424. 'ᾈ' => 'ᾀ',
  40425. 'ᾉ' => '�',
  40426. 'ᾊ' => 'ᾂ',
  40427. 'ᾋ' => 'ᾃ',
  40428. 'ᾌ' => 'ᾄ',
  40429. '�' => 'ᾅ',
  40430. 'ᾎ' => 'ᾆ',
  40431. '�' => 'ᾇ',
  40432. 'ᾘ' => '�',
  40433. 'ᾙ' => 'ᾑ',
  40434. 'ᾚ' => 'ᾒ',
  40435. 'ᾛ' => 'ᾓ',
  40436. 'ᾜ' => 'ᾔ',
  40437. '�' => 'ᾕ',
  40438. 'ᾞ' => 'ᾖ',
  40439. 'ᾟ' => 'ᾗ',
  40440. 'ᾨ' => 'ᾠ',
  40441. 'ᾩ' => 'ᾡ',
  40442. 'ᾪ' => 'ᾢ',
  40443. 'ᾫ' => 'ᾣ',
  40444. 'ᾬ' => 'ᾤ',
  40445. 'á¾­' => 'á¾¥',
  40446. 'ᾮ' => 'ᾦ',
  40447. 'ᾯ' => 'ᾧ',
  40448. 'Ᾰ' => 'ᾰ',
  40449. 'á¾¹' => 'á¾±',
  40450. 'Ὰ' => 'ὰ',
  40451. 'á¾»' => 'á½±',
  40452. 'á¾¼' => 'á¾³',
  40453. 'Ὲ' => 'ὲ',
  40454. 'Έ' => 'έ',
  40455. 'á¿Š' => 'á½´',
  40456. 'á¿‹' => 'á½µ',
  40457. 'ῌ' => 'ῃ',
  40458. 'Ῐ' => '�',
  40459. 'á¿™' => 'á¿‘',
  40460. 'Ὶ' => 'ὶ',
  40461. 'á¿›' => 'á½·',
  40462. 'Ῠ' => 'ῠ',
  40463. 'á¿©' => 'á¿¡',
  40464. 'Ὺ' => 'ὺ',
  40465. 'á¿«' => 'á½»',
  40466. 'Ῥ' => 'ῥ',
  40467. 'Ὸ' => 'ὸ',
  40468. 'Ό' => 'ό',
  40469. 'Ὼ' => 'ὼ',
  40470. 'á¿»' => 'á½½',
  40471. 'ῼ' => 'ῳ',
  40472. 'Ω' => 'ω',
  40473. 'K' => 'k',
  40474. 'â„«' => 'Ã¥',
  40475. 'Ⅎ' => 'ⅎ',
  40476. 'â… ' => 'â…°',
  40477. 'â…¡' => 'â…±',
  40478. 'â…¢' => 'â…²',
  40479. 'â…£' => 'â…³',
  40480. 'â…¤' => 'â…´',
  40481. 'â…¥' => 'â…µ',
  40482. 'â…¦' => 'â…¶',
  40483. 'â…§' => 'â…·',
  40484. 'â…¨' => 'â…¸',
  40485. 'â…©' => 'â…¹',
  40486. 'â…ª' => 'â…º',
  40487. 'â…«' => 'â…»',
  40488. 'â…¬' => 'â…¼',
  40489. 'â…­' => 'â…½',
  40490. 'â…®' => 'â…¾',
  40491. 'â…¯' => 'â…¿',
  40492. 'Ↄ' => 'ↄ',
  40493. 'Ⓐ' => '�',
  40494. 'â’·' => 'â“‘',
  40495. 'â’¸' => 'â“’',
  40496. 'â’¹' => 'â““',
  40497. 'â’º' => 'â“”',
  40498. 'â’»' => 'â“•',
  40499. 'â’¼' => 'â“–',
  40500. 'â’½' => 'â“—',
  40501. 'Ⓘ' => 'ⓘ',
  40502. 'â’¿' => 'â“™',
  40503. 'â“€' => 'â“š',
  40504. '�' => 'ⓛ',
  40505. 'Ⓜ' => 'ⓜ',
  40506. 'Ⓝ' => '�',
  40507. 'â“„' => 'â“ž',
  40508. 'â“…' => 'â“Ÿ',
  40509. 'Ⓠ' => 'ⓠ',
  40510. 'Ⓡ' => 'ⓡ',
  40511. 'Ⓢ' => 'ⓢ',
  40512. 'Ⓣ' => 'ⓣ',
  40513. 'Ⓤ' => 'ⓤ',
  40514. 'â“‹' => 'â“¥',
  40515. 'Ⓦ' => 'ⓦ',
  40516. '�' => 'ⓧ',
  40517. 'Ⓨ' => 'ⓨ',
  40518. '�' => 'ⓩ',
  40519. 'â°€' => 'â°°',
  40520. 'â°�' => 'â°±',
  40521. 'â°‚' => 'â°²',
  40522. 'â°ƒ' => 'â°³',
  40523. 'â°„' => 'â°´',
  40524. 'â°…' => 'â°µ',
  40525. 'â°†' => 'â°¶',
  40526. 'â°‡' => 'â°·',
  40527. 'â°ˆ' => 'â°¸',
  40528. 'â°‰' => 'â°¹',
  40529. 'â°Š' => 'â°º',
  40530. 'â°‹' => 'â°»',
  40531. 'Ⰼ' => 'ⰼ',
  40532. 'â°�' => 'â°½',
  40533. 'â°Ž' => 'â°¾',
  40534. 'â°�' => 'â°¿',
  40535. 'â°�' => 'â±€',
  40536. 'Ⱁ' => '�',
  40537. 'Ⱂ' => 'ⱂ',
  40538. 'Ⱃ' => 'ⱃ',
  40539. 'Ⱄ' => 'ⱄ',
  40540. 'â°•' => 'â±…',
  40541. 'Ⱆ' => 'ⱆ',
  40542. 'Ⱇ' => 'ⱇ',
  40543. 'Ⱈ' => 'ⱈ',
  40544. 'Ⱉ' => 'ⱉ',
  40545. 'Ⱊ' => 'ⱊ',
  40546. 'Ⱋ' => 'ⱋ',
  40547. 'Ⱌ' => 'ⱌ',
  40548. '�' => '�',
  40549. 'Ⱎ' => 'ⱎ',
  40550. 'Ⱏ' => '�',
  40551. 'Ⱐ' => '�',
  40552. 'Ⱑ' => 'ⱑ',
  40553. 'â°¢' => 'â±’',
  40554. 'Ⱓ' => 'ⱓ',
  40555. 'â°¤' => 'â±”',
  40556. 'Ⱕ' => 'ⱕ',
  40557. 'â°¦' => 'â±–',
  40558. 'â°§' => 'â±—',
  40559. 'Ⱘ' => 'ⱘ',
  40560. 'â°©' => 'â±™',
  40561. 'Ⱚ' => 'ⱚ',
  40562. 'â°«' => 'â±›',
  40563. 'Ⱜ' => 'ⱜ',
  40564. 'Ⱝ' => '�',
  40565. 'Ⱞ' => 'ⱞ',
  40566. 'Ⱡ' => 'ⱡ',
  40567. 'â±¢' => 'É«',
  40568. 'â±£' => 'áµ½',
  40569. 'Ɽ' => 'ɽ',
  40570. 'Ⱨ' => 'ⱨ',
  40571. 'Ⱪ' => 'ⱪ',
  40572. 'Ⱬ' => 'ⱬ',
  40573. 'â±­' => 'É‘',
  40574. 'Ɱ' => 'ɱ',
  40575. 'Ɐ' => '�',
  40576. 'â±°' => 'É’',
  40577. 'â±²' => 'â±³',
  40578. 'Ⱶ' => 'ⱶ',
  40579. 'â±¾' => 'È¿',
  40580. 'Ɀ' => 'ɀ',
  40581. 'Ⲁ' => '�',
  40582. 'Ⲃ' => 'ⲃ',
  40583. 'Ⲅ' => 'ⲅ',
  40584. 'Ⲇ' => 'ⲇ',
  40585. 'Ⲉ' => 'ⲉ',
  40586. 'Ⲋ' => 'ⲋ',
  40587. 'Ⲍ' => '�',
  40588. 'Ⲏ' => '�',
  40589. '�' => 'ⲑ',
  40590. 'Ⲓ' => 'ⲓ',
  40591. 'Ⲕ' => 'ⲕ',
  40592. 'â²–' => 'â²—',
  40593. 'Ⲙ' => 'ⲙ',
  40594. 'Ⲛ' => 'ⲛ',
  40595. 'Ⲝ' => '�',
  40596. 'Ⲟ' => 'ⲟ',
  40597. 'Ⲡ' => 'ⲡ',
  40598. 'â²¢' => 'â²£',
  40599. 'Ⲥ' => 'ⲥ',
  40600. 'Ⲧ' => 'ⲧ',
  40601. 'Ⲩ' => 'ⲩ',
  40602. 'Ⲫ' => 'ⲫ',
  40603. 'Ⲭ' => 'ⲭ',
  40604. 'Ⲯ' => 'ⲯ',
  40605. 'â²°' => 'â²±',
  40606. 'â²²' => 'â²³',
  40607. 'â²´' => 'â²µ',
  40608. 'Ⲷ' => 'ⲷ',
  40609. 'Ⲹ' => 'ⲹ',
  40610. 'Ⲻ' => 'ⲻ',
  40611. 'â²¼' => 'â²½',
  40612. 'Ⲿ' => 'ⲿ',
  40613. 'Ⳁ' => '�',
  40614. 'Ⳃ' => 'ⳃ',
  40615. 'Ⳅ' => 'ⳅ',
  40616. 'Ⳇ' => 'ⳇ',
  40617. 'Ⳉ' => 'ⳉ',
  40618. 'Ⳋ' => 'ⳋ',
  40619. 'Ⳍ' => '�',
  40620. 'Ⳏ' => '�',
  40621. '�' => 'ⳑ',
  40622. 'Ⳓ' => 'ⳓ',
  40623. 'Ⳕ' => 'ⳕ',
  40624. 'â³–' => 'â³—',
  40625. 'Ⳙ' => 'ⳙ',
  40626. 'Ⳛ' => 'ⳛ',
  40627. 'Ⳝ' => '�',
  40628. 'Ⳟ' => 'ⳟ',
  40629. 'Ⳡ' => 'ⳡ',
  40630. 'â³¢' => 'â³£',
  40631. 'Ⳬ' => 'ⳬ',
  40632. 'â³­' => 'â³®',
  40633. 'â³²' => 'â³³',
  40634. 'Ꙁ' => '�',
  40635. 'Ꙃ' => 'ꙃ',
  40636. 'Ꙅ' => 'ꙅ',
  40637. 'Ꙇ' => 'ꙇ',
  40638. 'Ꙉ' => 'ꙉ',
  40639. 'Ꙋ' => 'ꙋ',
  40640. 'Ꙍ' => '�',
  40641. 'Ꙏ' => '�',
  40642. '�' => 'ꙑ',
  40643. 'Ꙓ' => 'ꙓ',
  40644. 'Ꙕ' => 'ꙕ',
  40645. 'ê™–' => 'ê™—',
  40646. 'Ꙙ' => 'ꙙ',
  40647. 'Ꙛ' => 'ꙛ',
  40648. 'Ꙝ' => '�',
  40649. 'Ꙟ' => 'ꙟ',
  40650. 'Ꙡ' => 'ꙡ',
  40651. 'Ꙣ' => 'ꙣ',
  40652. 'Ꙥ' => 'ꙥ',
  40653. 'Ꙧ' => 'ꙧ',
  40654. 'Ꙩ' => 'ꙩ',
  40655. 'Ꙫ' => 'ꙫ',
  40656. 'Ꙭ' => 'ꙭ',
  40657. 'Ꚁ' => '�',
  40658. 'Ꚃ' => 'ꚃ',
  40659. 'êš„' => 'êš…',
  40660. 'Ꚇ' => 'ꚇ',
  40661. 'Ꚉ' => 'ꚉ',
  40662. 'Ꚋ' => 'ꚋ',
  40663. 'Ꚍ' => '�',
  40664. 'Ꚏ' => '�',
  40665. '�' => 'ꚑ',
  40666. 'êš’' => 'êš“',
  40667. 'êš”' => 'êš•',
  40668. 'êš–' => 'êš—',
  40669. 'Ꚙ' => 'ꚙ',
  40670. 'êšš' => 'êš›',
  40671. 'Ꜣ' => 'ꜣ',
  40672. 'Ꜥ' => 'ꜥ',
  40673. 'Ꜧ' => 'ꜧ',
  40674. 'Ꜩ' => 'ꜩ',
  40675. 'Ꜫ' => 'ꜫ',
  40676. 'Ꜭ' => 'ꜭ',
  40677. 'Ꜯ' => 'ꜯ',
  40678. 'Ꜳ' => 'ꜳ',
  40679. 'Ꜵ' => 'ꜵ',
  40680. 'Ꜷ' => 'ꜷ',
  40681. 'Ꜹ' => 'ꜹ',
  40682. 'Ꜻ' => 'ꜻ',
  40683. 'Ꜽ' => 'ꜽ',
  40684. 'Ꜿ' => 'ꜿ',
  40685. '�' => '�',
  40686. '�' => '�',
  40687. '�' => '�',
  40688. '�' => '�',
  40689. '�' => '�',
  40690. '�' => '�',
  40691. '�' => '�',
  40692. '�' => '�',
  40693. '�' => '�',
  40694. '�' => '�',
  40695. '�' => '�',
  40696. '�' => '�',
  40697. '�' => '�',
  40698. '�' => '�',
  40699. '�' => '�',
  40700. '�' => '�',
  40701. '�' => '�',
  40702. '�' => '�',
  40703. '�' => '�',
  40704. '�' => '�',
  40705. '�' => '�',
  40706. '�' => '�',
  40707. '�' => '�',
  40708. '�' => '�',
  40709. '�' => '�',
  40710. '�' => '�',
  40711. '�' => 'ᵹ',
  40712. '�' => '�',
  40713. 'Ꞁ' => '�',
  40714. 'Ꞃ' => 'ꞃ',
  40715. 'êž„' => 'êž…',
  40716. 'Ꞇ' => 'ꞇ',
  40717. 'Ꞌ' => 'ꞌ',
  40718. '�' => 'ɥ',
  40719. '�' => 'ꞑ',
  40720. 'êž’' => 'êž“',
  40721. 'êž–' => 'êž—',
  40722. 'Ꞙ' => 'ꞙ',
  40723. 'êžš' => 'êž›',
  40724. 'Ꞝ' => '�',
  40725. 'Ꞟ' => 'ꞟ',
  40726. 'êž ' => 'êž¡',
  40727. 'Ꞣ' => 'ꞣ',
  40728. 'Ꞥ' => 'ꞥ',
  40729. 'Ꞧ' => 'ꞧ',
  40730. 'Ꞩ' => 'ꞩ',
  40731. 'Ɦ' => 'ɦ',
  40732. 'Ɜ' => 'ɜ',
  40733. 'Ɡ' => 'ɡ',
  40734. 'Ɬ' => 'ɬ',
  40735. 'êž°' => 'Êž',
  40736. 'Ʇ' => 'ʇ',
  40737. 'A' => '�',
  40738. 'B' => 'b',
  40739. 'C' => 'c',
  40740. 'D' => 'd',
  40741. 'ï¼¥' => 'ï½…',
  40742. 'F' => 'f',
  40743. 'G' => 'g',
  40744. 'H' => 'h',
  40745. 'I' => 'i',
  40746. 'J' => 'j',
  40747. 'K' => 'k',
  40748. 'L' => 'l',
  40749. 'M' => '�',
  40750. 'N' => 'n',
  40751. 'O' => '�',
  40752. 'P' => '�',
  40753. 'Q' => 'q',
  40754. 'ï¼²' => 'ï½’',
  40755. 'S' => 's',
  40756. 'ï¼´' => 'ï½”',
  40757. 'U' => 'u',
  40758. 'V' => 'v',
  40759. 'ï¼·' => 'ï½—',
  40760. 'X' => 'x',
  40761. 'ï¼¹' => 'ï½™',
  40762. 'Z' => 'z',
  40763. '�' => '�',
  40764. '�' => '�',
  40765. '�' => '�',
  40766. '�' => '�',
  40767. '�' => '�',
  40768. '�' => '�',
  40769. '�' => '�',
  40770. '�' => '�',
  40771. '�' => '�',
  40772. '�' => '�',
  40773. '�' => '�',
  40774. '�' => '�',
  40775. '�' => '�',
  40776. '�' => '�',
  40777. '�' => '�',
  40778. '�' => '�',
  40779. '�' => '�',
  40780. '�' => '�',
  40781. '�' => '�',
  40782. '�' => '�',
  40783. '�' => '�',
  40784. '�' => '�',
  40785. '�' => '�',
  40786. '�' => '�',
  40787. '�' => '�',
  40788. '�' => '�',
  40789. '�' => '�',
  40790. '�' => '�',
  40791. '�' => '�',
  40792. '�' => '�',
  40793. '�' => '�',
  40794. '�' => '�',
  40795. '�' => '�',
  40796. '�' => '�',
  40797. '�' => '�',
  40798. '�' => '�',
  40799. '�' => '�',
  40800. '�' => '�',
  40801. '�' => '�',
  40802. '�' => '�',
  40803. 'ð‘¢ ' => 'ð‘£€',
  40804. '𑢡' => '�',
  40805. '𑢢' => '𑣂',
  40806. '𑢣' => '𑣃',
  40807. '𑢤' => '𑣄',
  40808. 'ð‘¢¥' => 'ð‘£…',
  40809. '𑢦' => '𑣆',
  40810. '𑢧' => '𑣇',
  40811. '𑢨' => '𑣈',
  40812. '𑢩' => '𑣉',
  40813. '𑢪' => '𑣊',
  40814. '𑢫' => '𑣋',
  40815. '𑢬' => '𑣌',
  40816. '𑢭' => '�',
  40817. '𑢮' => '𑣎',
  40818. '𑢯' => '�',
  40819. '𑢰' => '�',
  40820. '𑢱' => '𑣑',
  40821. 'ð‘¢²' => 'ð‘£’',
  40822. '𑢳' => '𑣓',
  40823. 'ð‘¢´' => 'ð‘£”',
  40824. '𑢵' => '𑣕',
  40825. '𑢶' => '𑣖',
  40826. 'ð‘¢·' => 'ð‘£—',
  40827. '𑢸' => '𑣘',
  40828. 'ð‘¢¹' => 'ð‘£™',
  40829. '𑢺' => '𑣚',
  40830. 'ð‘¢»' => 'ð‘£›',
  40831. '𑢼' => '𑣜',
  40832. '𑢽' => '�',
  40833. '𑢾' => '𑣞',
  40834. '𑢿' => '𑣟',
  40835. );
  40836. $result =& $data;
  40837. unset($data);
  40838. return $result;
  40839. <?php
  40840. static $data = array (
  40841. 'a' => 'A',
  40842. 'b' => 'B',
  40843. 'c' => 'C',
  40844. 'd' => 'D',
  40845. 'e' => 'E',
  40846. 'f' => 'F',
  40847. 'g' => 'G',
  40848. 'h' => 'H',
  40849. 'i' => 'I',
  40850. 'j' => 'J',
  40851. 'k' => 'K',
  40852. 'l' => 'L',
  40853. 'm' => 'M',
  40854. 'n' => 'N',
  40855. 'o' => 'O',
  40856. 'p' => 'P',
  40857. 'q' => 'Q',
  40858. 'r' => 'R',
  40859. 's' => 'S',
  40860. 't' => 'T',
  40861. 'u' => 'U',
  40862. 'v' => 'V',
  40863. 'w' => 'W',
  40864. 'x' => 'X',
  40865. 'y' => 'Y',
  40866. 'z' => 'Z',
  40867. 'µ' => 'Μ',
  40868. 'à' => 'À',
  40869. 'á' => '�',
  40870. 'â' => 'Â',
  40871. 'ã' => 'Ã',
  40872. 'ä' => 'Ä',
  40873. 'Ã¥' => 'Ã…',
  40874. 'æ' => 'Æ',
  40875. 'ç' => 'Ç',
  40876. 'è' => 'È',
  40877. 'é' => 'É',
  40878. 'ê' => 'Ê',
  40879. 'ë' => 'Ë',
  40880. 'ì' => 'Ì',
  40881. 'í' => '�',
  40882. 'î' => 'Î',
  40883. 'ï' => '�',
  40884. 'ð' => '�',
  40885. 'ñ' => 'Ñ',
  40886. 'ò' => 'Ò',
  40887. 'ó' => 'Ó',
  40888. 'ô' => 'Ô',
  40889. 'õ' => 'Õ',
  40890. 'ö' => 'Ö',
  40891. 'ø' => 'Ø',
  40892. 'ù' => 'Ù',
  40893. 'ú' => 'Ú',
  40894. 'û' => 'Û',
  40895. 'ü' => 'Ü',
  40896. 'ý' => '�',
  40897. 'þ' => 'Þ',
  40898. 'ÿ' => 'Ÿ',
  40899. '�' => 'Ā',
  40900. 'ă' => 'Ă',
  40901. 'Ä…' => 'Ä„',
  40902. 'ć' => 'Ć',
  40903. 'ĉ' => 'Ĉ',
  40904. 'Ä‹' => 'ÄŠ',
  40905. '�' => 'Č',
  40906. '�' => 'Ď',
  40907. 'đ' => '�',
  40908. 'Ä“' => 'Ä’',
  40909. 'Ä•' => 'Ä”',
  40910. 'Ä—' => 'Ä–',
  40911. 'ę' => 'Ę',
  40912. 'Ä›' => 'Äš',
  40913. '�' => 'Ĝ',
  40914. 'ÄŸ' => 'Äž',
  40915. 'Ä¡' => 'Ä ',
  40916. 'Ä£' => 'Ä¢',
  40917. 'ĥ' => 'Ĥ',
  40918. 'ħ' => 'Ħ',
  40919. 'ĩ' => 'Ĩ',
  40920. 'ī' => 'Ī',
  40921. 'ĭ' => 'Ĭ',
  40922. 'į' => 'Į',
  40923. 'ı' => 'I',
  40924. 'ij' => 'IJ',
  40925. 'ĵ' => 'Ĵ',
  40926. 'ķ' => 'Ķ',
  40927. 'ĺ' => 'Ĺ',
  40928. 'ļ' => 'Ļ',
  40929. 'ľ' => 'Ľ',
  40930. 'Å€' => 'Ä¿',
  40931. 'ł' => '�',
  40932. 'ń' => 'Ń',
  40933. 'ņ' => 'Ņ',
  40934. 'ň' => 'Ň',
  40935. 'Å‹' => 'ÅŠ',
  40936. '�' => 'Ō',
  40937. '�' => 'Ŏ',
  40938. 'ő' => '�',
  40939. 'Å“' => 'Å’',
  40940. 'Å•' => 'Å”',
  40941. 'Å—' => 'Å–',
  40942. 'ř' => 'Ř',
  40943. 'Å›' => 'Åš',
  40944. '�' => 'Ŝ',
  40945. 'ÅŸ' => 'Åž',
  40946. 'Å¡' => 'Å ',
  40947. 'Å£' => 'Å¢',
  40948. 'ť' => 'Ť',
  40949. 'ŧ' => 'Ŧ',
  40950. 'ũ' => 'Ũ',
  40951. 'ū' => 'Ū',
  40952. 'ŭ' => 'Ŭ',
  40953. 'ů' => 'Ů',
  40954. 'ű' => 'Ű',
  40955. 'ų' => 'Ų',
  40956. 'ŵ' => 'Ŵ',
  40957. 'ŷ' => 'Ŷ',
  40958. 'ź' => 'Ź',
  40959. 'ż' => 'Ż',
  40960. 'ž' => 'Ž',
  40961. 'Å¿' => 'S',
  40962. 'ƀ' => 'Ƀ',
  40963. 'ƃ' => 'Ƃ',
  40964. 'Æ…' => 'Æ„',
  40965. 'ƈ' => 'Ƈ',
  40966. 'ƌ' => 'Ƌ',
  40967. 'Æ’' => 'Æ‘',
  40968. 'ƕ' => 'Ƕ',
  40969. 'ƙ' => 'Ƙ',
  40970. 'ƚ' => 'Ƚ',
  40971. 'Æž' => 'È ',
  40972. 'Æ¡' => 'Æ ',
  40973. 'Æ£' => 'Æ¢',
  40974. 'ƥ' => 'Ƥ',
  40975. 'ƨ' => 'Ƨ',
  40976. 'ƭ' => 'Ƭ',
  40977. 'ư' => 'Ư',
  40978. 'ƴ' => 'Ƴ',
  40979. 'ƶ' => 'Ƶ',
  40980. 'ƹ' => 'Ƹ',
  40981. 'ƽ' => 'Ƽ',
  40982. 'Æ¿' => 'Ç·',
  40983. 'Ç…' => 'Ç„',
  40984. 'dž' => 'DŽ',
  40985. 'Lj' => 'LJ',
  40986. 'lj' => 'LJ',
  40987. 'Ç‹' => 'ÇŠ',
  40988. 'nj' => 'NJ',
  40989. 'ǎ' => '�',
  40990. '�' => '�',
  40991. 'Ç’' => 'Ç‘',
  40992. 'Ç”' => 'Ç“',
  40993. 'Ç–' => 'Ç•',
  40994. 'ǘ' => 'Ǘ',
  40995. 'Çš' => 'Ç™',
  40996. 'ǜ' => 'Ǜ',
  40997. '�' => 'Ǝ',
  40998. 'ÇŸ' => 'Çž',
  40999. 'Ç¡' => 'Ç ',
  41000. 'Ç£' => 'Ç¢',
  41001. 'ǥ' => 'Ǥ',
  41002. 'ǧ' => 'Ǧ',
  41003. 'ǩ' => 'Ǩ',
  41004. 'ǫ' => 'Ǫ',
  41005. 'ǭ' => 'Ǭ',
  41006. 'ǯ' => 'Ǯ',
  41007. 'Dz' => 'DZ',
  41008. 'dz' => 'DZ',
  41009. 'ǵ' => 'Ǵ',
  41010. 'ǹ' => 'Ǹ',
  41011. 'ǻ' => 'Ǻ',
  41012. 'ǽ' => 'Ǽ',
  41013. 'ǿ' => 'Ǿ',
  41014. '�' => 'Ȁ',
  41015. 'ȃ' => 'Ȃ',
  41016. 'È…' => 'È„',
  41017. 'ȇ' => 'Ȇ',
  41018. 'ȉ' => 'Ȉ',
  41019. 'È‹' => 'ÈŠ',
  41020. '�' => 'Ȍ',
  41021. '�' => 'Ȏ',
  41022. 'ȑ' => '�',
  41023. 'È“' => 'È’',
  41024. 'È•' => 'È”',
  41025. 'È—' => 'È–',
  41026. 'ș' => 'Ș',
  41027. 'È›' => 'Èš',
  41028. '�' => 'Ȝ',
  41029. 'ÈŸ' => 'Èž',
  41030. 'È£' => 'È¢',
  41031. 'ȥ' => 'Ȥ',
  41032. 'ȧ' => 'Ȧ',
  41033. 'ȩ' => 'Ȩ',
  41034. 'ȫ' => 'Ȫ',
  41035. 'ȭ' => 'Ȭ',
  41036. 'ȯ' => 'Ȯ',
  41037. 'ȱ' => 'Ȱ',
  41038. 'ȳ' => 'Ȳ',
  41039. 'ȼ' => 'Ȼ',
  41040. 'È¿' => 'â±¾',
  41041. 'ɀ' => 'Ɀ',
  41042. 'ɂ' => '�',
  41043. 'ɇ' => 'Ɇ',
  41044. 'ɉ' => 'Ɉ',
  41045. 'É‹' => 'ÉŠ',
  41046. '�' => 'Ɍ',
  41047. '�' => 'Ɏ',
  41048. '�' => 'Ɐ',
  41049. 'É‘' => 'â±­',
  41050. 'É’' => 'â±°',
  41051. 'ɓ' => '�',
  41052. 'ɔ' => 'Ɔ',
  41053. 'ɖ' => 'Ɖ',
  41054. 'É—' => 'ÆŠ',
  41055. 'ə' => '�',
  41056. 'ɛ' => '�',
  41057. 'ɜ' => 'Ɜ',
  41058. 'É ' => 'Æ“',
  41059. 'ɡ' => 'Ɡ',
  41060. 'É£' => 'Æ”',
  41061. 'ɥ' => '�',
  41062. 'ɦ' => 'Ɦ',
  41063. 'ɨ' => 'Ɨ',
  41064. 'É©' => 'Æ–',
  41065. 'É«' => 'â±¢',
  41066. 'ɬ' => 'Ɬ',
  41067. 'ɯ' => 'Ɯ',
  41068. 'ɱ' => 'Ɱ',
  41069. 'ɲ' => '�',
  41070. 'ɵ' => 'Ɵ',
  41071. 'ɽ' => 'Ɽ',
  41072. 'ʀ' => 'Ʀ',
  41073. 'ʃ' => 'Ʃ',
  41074. 'ʇ' => 'Ʇ',
  41075. 'ʈ' => 'Ʈ',
  41076. 'ʉ' => 'Ʉ',
  41077. 'ʊ' => 'Ʊ',
  41078. 'ʋ' => 'Ʋ',
  41079. 'ʌ' => 'Ʌ',
  41080. 'Ê’' => 'Æ·',
  41081. 'Êž' => 'êž°',
  41082. 'ͅ' => 'Ι',
  41083. 'ͱ' => 'Ͱ',
  41084. 'ͳ' => 'Ͳ',
  41085. 'ͷ' => 'Ͷ',
  41086. 'ͻ' => 'Ͻ',
  41087. 'ͼ' => 'Ͼ',
  41088. 'ͽ' => 'Ͽ',
  41089. 'ά' => 'Ά',
  41090. 'έ' => 'Έ',
  41091. 'ή' => 'Ή',
  41092. 'ί' => 'Ί',
  41093. 'α' => 'Α',
  41094. 'β' => 'Β',
  41095. 'γ' => 'Γ',
  41096. 'δ' => 'Δ',
  41097. 'ε' => 'Ε',
  41098. 'ζ' => 'Ζ',
  41099. 'η' => 'Η',
  41100. 'θ' => 'Θ',
  41101. 'ι' => 'Ι',
  41102. 'κ' => 'Κ',
  41103. 'λ' => 'Λ',
  41104. 'μ' => 'Μ',
  41105. 'ν' => '�',
  41106. 'ξ' => 'Ξ',
  41107. 'ο' => 'Ο',
  41108. 'π' => 'Π',
  41109. '�' => 'Ρ',
  41110. 'ς' => 'Σ',
  41111. 'σ' => 'Σ',
  41112. 'τ' => 'Τ',
  41113. 'Ï…' => 'Î¥',
  41114. 'φ' => 'Φ',
  41115. 'χ' => 'Χ',
  41116. 'ψ' => 'Ψ',
  41117. 'ω' => 'Ω',
  41118. 'ϊ' => 'Ϊ',
  41119. 'ϋ' => 'Ϋ',
  41120. 'ό' => 'Ό',
  41121. '�' => 'Ύ',
  41122. 'ώ' => '�',
  41123. '�' => 'Β',
  41124. 'ϑ' => 'Θ',
  41125. 'ϕ' => 'Φ',
  41126. 'ϖ' => 'Π',
  41127. 'ϗ' => '�',
  41128. 'ϙ' => 'Ϙ',
  41129. 'Ï›' => 'Ïš',
  41130. '�' => 'Ϝ',
  41131. 'ÏŸ' => 'Ïž',
  41132. 'Ï¡' => 'Ï ',
  41133. 'Ï£' => 'Ï¢',
  41134. 'ϥ' => 'Ϥ',
  41135. 'ϧ' => 'Ϧ',
  41136. 'ϩ' => 'Ϩ',
  41137. 'ϫ' => 'Ϫ',
  41138. 'ϭ' => 'Ϭ',
  41139. 'ϯ' => 'Ϯ',
  41140. 'ϰ' => 'Κ',
  41141. 'ϱ' => 'Ρ',
  41142. 'ϲ' => 'Ϲ',
  41143. 'ϳ' => 'Ϳ',
  41144. 'ϵ' => 'Ε',
  41145. 'ϸ' => 'Ϸ',
  41146. 'ϻ' => 'Ϻ',
  41147. 'а' => '�',
  41148. 'б' => 'Б',
  41149. 'в' => 'В',
  41150. 'г' => 'Г',
  41151. 'д' => 'Д',
  41152. 'е' => 'Е',
  41153. 'ж' => 'Ж',
  41154. 'з' => 'З',
  41155. 'и' => 'И',
  41156. 'й' => 'Й',
  41157. 'к' => 'К',
  41158. 'л' => 'Л',
  41159. 'м' => 'М',
  41160. 'н' => '�',
  41161. 'о' => 'О',
  41162. 'п' => 'П',
  41163. 'р' => 'Р',
  41164. '�' => 'С',
  41165. 'т' => 'Т',
  41166. 'у' => 'У',
  41167. 'ф' => 'Ф',
  41168. 'Ñ…' => 'Ð¥',
  41169. 'ц' => 'Ц',
  41170. 'ч' => 'Ч',
  41171. 'ш' => 'Ш',
  41172. 'щ' => 'Щ',
  41173. 'ъ' => 'Ъ',
  41174. 'ы' => 'Ы',
  41175. 'ь' => 'Ь',
  41176. '�' => 'Э',
  41177. 'ю' => 'Ю',
  41178. '�' => 'Я',
  41179. '�' => 'Ѐ',
  41180. 'ё' => '�',
  41181. 'ђ' => 'Ђ',
  41182. 'ѓ' => 'Ѓ',
  41183. 'є' => 'Є',
  41184. 'Ñ•' => 'Ð…',
  41185. 'і' => 'І',
  41186. 'ї' => 'Ї',
  41187. 'ј' => 'Ј',
  41188. 'љ' => 'Љ',
  41189. 'њ' => 'Њ',
  41190. 'ћ' => 'Ћ',
  41191. 'ќ' => 'Ќ',
  41192. '�' => '�',
  41193. 'Ñž' => 'ÐŽ',
  41194. 'џ' => '�',
  41195. 'Ñ¡' => 'Ñ ',
  41196. 'Ñ£' => 'Ñ¢',
  41197. 'ѥ' => 'Ѥ',
  41198. 'ѧ' => 'Ѧ',
  41199. 'ѩ' => 'Ѩ',
  41200. 'ѫ' => 'Ѫ',
  41201. 'ѭ' => 'Ѭ',
  41202. 'ѯ' => 'Ѯ',
  41203. 'ѱ' => 'Ѱ',
  41204. 'ѳ' => 'Ѳ',
  41205. 'ѵ' => 'Ѵ',
  41206. 'ѷ' => 'Ѷ',
  41207. 'ѹ' => 'Ѹ',
  41208. 'ѻ' => 'Ѻ',
  41209. 'ѽ' => 'Ѽ',
  41210. 'ѿ' => 'Ѿ',
  41211. 'Ò�' => 'Ò€',
  41212. 'Ò‹' => 'ÒŠ',
  41213. '�' => 'Ҍ',
  41214. 'Ò�' => 'ÒŽ',
  41215. 'Ò‘' => 'Ò�',
  41216. 'Ò“' => 'Ò’',
  41217. 'Ò•' => 'Ò”',
  41218. 'Ò—' => 'Ò–',
  41219. 'Ò™' => 'Ò˜',
  41220. 'Ò›' => 'Òš',
  41221. '�' => 'Ҝ',
  41222. 'ÒŸ' => 'Òž',
  41223. 'Ò¡' => 'Ò ',
  41224. 'Ò£' => 'Ò¢',
  41225. 'Ò¥' => 'Ò¤',
  41226. 'Ò§' => 'Ò¦',
  41227. 'Ò©' => 'Ò¨',
  41228. 'Ò«' => 'Òª',
  41229. 'Ò­' => 'Ò¬',
  41230. 'Ò¯' => 'Ò®',
  41231. 'Ò±' => 'Ò°',
  41232. 'Ò³' => 'Ò²',
  41233. 'Òµ' => 'Ò´',
  41234. 'Ò·' => 'Ò¶',
  41235. 'Ò¹' => 'Ò¸',
  41236. 'Ò»' => 'Òº',
  41237. 'Ò½' => 'Ò¼',
  41238. 'Ò¿' => 'Ò¾',
  41239. 'Ó‚' => 'Ó�',
  41240. 'Ó„' => 'Óƒ',
  41241. 'Ó†' => 'Ó…',
  41242. 'Óˆ' => 'Ó‡',
  41243. 'ÓŠ' => 'Ó‰',
  41244. 'ӌ' => 'Ӌ',
  41245. 'ÓŽ' => 'Ó�',
  41246. 'Ó�' => 'Ó€',
  41247. 'Ó‘' => 'Ó�',
  41248. 'Ó“' => 'Ó’',
  41249. 'Ó•' => 'Ó”',
  41250. 'Ó—' => 'Ó–',
  41251. 'Ó™' => 'Ó˜',
  41252. 'Ó›' => 'Óš',
  41253. '�' => 'Ӝ',
  41254. 'ÓŸ' => 'Óž',
  41255. 'Ó¡' => 'Ó ',
  41256. 'Ó£' => 'Ó¢',
  41257. 'Ó¥' => 'Ó¤',
  41258. 'Ó§' => 'Ó¦',
  41259. 'Ó©' => 'Ó¨',
  41260. 'Ó«' => 'Óª',
  41261. 'Ó­' => 'Ó¬',
  41262. 'Ó¯' => 'Ó®',
  41263. 'Ó±' => 'Ó°',
  41264. 'Ó³' => 'Ó²',
  41265. 'Óµ' => 'Ó´',
  41266. 'Ó·' => 'Ó¶',
  41267. 'Ó¹' => 'Ó¸',
  41268. 'Ó»' => 'Óº',
  41269. 'Ó½' => 'Ó¼',
  41270. 'Ó¿' => 'Ó¾',
  41271. 'Ô�' => 'Ô€',
  41272. 'Ôƒ' => 'Ô‚',
  41273. 'Ô…' => 'Ô„',
  41274. 'Ô‡' => 'Ô†',
  41275. 'Ô‰' => 'Ôˆ',
  41276. 'Ô‹' => 'ÔŠ',
  41277. '�' => 'Ԍ',
  41278. 'Ô�' => 'ÔŽ',
  41279. 'Ô‘' => 'Ô�',
  41280. 'Ô“' => 'Ô’',
  41281. 'Ô•' => 'Ô”',
  41282. 'Ô—' => 'Ô–',
  41283. 'Ô™' => 'Ô˜',
  41284. 'Ô›' => 'Ôš',
  41285. '�' => 'Ԝ',
  41286. 'ÔŸ' => 'Ôž',
  41287. 'Ô¡' => 'Ô ',
  41288. 'Ô£' => 'Ô¢',
  41289. 'Ô¥' => 'Ô¤',
  41290. 'Ô§' => 'Ô¦',
  41291. 'Ô©' => 'Ô¨',
  41292. 'Ô«' => 'Ôª',
  41293. 'Ô­' => 'Ô¬',
  41294. 'Ô¯' => 'Ô®',
  41295. 'Õ¡' => 'Ô±',
  41296. 'Õ¢' => 'Ô²',
  41297. 'Õ£' => 'Ô³',
  41298. 'Õ¤' => 'Ô´',
  41299. 'Õ¥' => 'Ôµ',
  41300. 'Õ¦' => 'Ô¶',
  41301. 'Õ§' => 'Ô·',
  41302. 'Õ¨' => 'Ô¸',
  41303. 'Õ©' => 'Ô¹',
  41304. 'Õª' => 'Ôº',
  41305. 'Õ«' => 'Ô»',
  41306. 'Õ¬' => 'Ô¼',
  41307. 'Õ­' => 'Ô½',
  41308. 'Õ®' => 'Ô¾',
  41309. 'Õ¯' => 'Ô¿',
  41310. 'Õ°' => 'Õ€',
  41311. 'Õ±' => 'Õ�',
  41312. 'Õ²' => 'Õ‚',
  41313. 'Õ³' => 'Õƒ',
  41314. 'Õ´' => 'Õ„',
  41315. 'Õµ' => 'Õ…',
  41316. 'Õ¶' => 'Õ†',
  41317. 'Õ·' => 'Õ‡',
  41318. 'Õ¸' => 'Õˆ',
  41319. 'Õ¹' => 'Õ‰',
  41320. 'Õº' => 'ÕŠ',
  41321. 'Õ»' => 'Õ‹',
  41322. 'ռ' => 'Ռ',
  41323. 'Õ½' => 'Õ�',
  41324. 'Õ¾' => 'ÕŽ',
  41325. 'Õ¿' => 'Õ�',
  41326. 'Ö€' => 'Õ�',
  41327. 'Ö�' => 'Õ‘',
  41328. 'Ö‚' => 'Õ’',
  41329. 'Öƒ' => 'Õ“',
  41330. 'Ö„' => 'Õ”',
  41331. 'Ö…' => 'Õ•',
  41332. 'Ö†' => 'Õ–',
  41333. 'ᵹ' => '�',
  41334. 'áµ½' => 'â±£',
  41335. '�' => 'Ḁ',
  41336. 'ḃ' => 'Ḃ',
  41337. 'ḅ' => 'Ḅ',
  41338. 'ḇ' => 'Ḇ',
  41339. 'ḉ' => 'Ḉ',
  41340. 'ḋ' => 'Ḋ',
  41341. '�' => 'Ḍ',
  41342. '�' => 'Ḏ',
  41343. 'ḑ' => '�',
  41344. 'ḓ' => 'Ḓ',
  41345. 'ḕ' => 'Ḕ',
  41346. 'ḗ' => 'Ḗ',
  41347. 'ḙ' => 'Ḙ',
  41348. 'ḛ' => 'Ḛ',
  41349. '�' => 'Ḝ',
  41350. 'ḟ' => 'Ḟ',
  41351. 'ḡ' => 'Ḡ',
  41352. 'ḣ' => 'Ḣ',
  41353. 'ḥ' => 'Ḥ',
  41354. 'ḧ' => 'Ḧ',
  41355. 'ḩ' => 'Ḩ',
  41356. 'ḫ' => 'Ḫ',
  41357. 'ḭ' => 'Ḭ',
  41358. 'ḯ' => 'Ḯ',
  41359. 'ḱ' => 'Ḱ',
  41360. 'ḳ' => 'Ḳ',
  41361. 'ḵ' => 'Ḵ',
  41362. 'ḷ' => 'Ḷ',
  41363. 'ḹ' => 'Ḹ',
  41364. 'ḻ' => 'Ḻ',
  41365. 'ḽ' => 'Ḽ',
  41366. 'ḿ' => 'Ḿ',
  41367. '�' => 'Ṁ',
  41368. 'ṃ' => 'Ṃ',
  41369. 'ṅ' => 'Ṅ',
  41370. 'ṇ' => 'Ṇ',
  41371. 'ṉ' => 'Ṉ',
  41372. 'ṋ' => 'Ṋ',
  41373. '�' => 'Ṍ',
  41374. '�' => 'Ṏ',
  41375. 'ṑ' => '�',
  41376. 'ṓ' => 'Ṓ',
  41377. 'ṕ' => 'Ṕ',
  41378. 'á¹—' => 'á¹–',
  41379. 'ṙ' => 'Ṙ',
  41380. 'ṛ' => 'Ṛ',
  41381. '�' => 'Ṝ',
  41382. 'ṟ' => 'Ṟ',
  41383. 'ṡ' => 'Ṡ',
  41384. 'á¹£' => 'á¹¢',
  41385. 'ṥ' => 'Ṥ',
  41386. 'ṧ' => 'Ṧ',
  41387. 'ṩ' => 'Ṩ',
  41388. 'ṫ' => 'Ṫ',
  41389. 'ṭ' => 'Ṭ',
  41390. 'ṯ' => 'Ṯ',
  41391. 'á¹±' => 'á¹°',
  41392. 'á¹³' => 'á¹²',
  41393. 'á¹µ' => 'á¹´',
  41394. 'ṷ' => 'Ṷ',
  41395. 'ṹ' => 'Ṹ',
  41396. 'ṻ' => 'Ṻ',
  41397. 'á¹½' => 'á¹¼',
  41398. 'ṿ' => 'Ṿ',
  41399. '�' => 'Ẁ',
  41400. 'ẃ' => 'Ẃ',
  41401. 'ẅ' => 'Ẅ',
  41402. 'ẇ' => 'Ẇ',
  41403. 'ẉ' => 'Ẉ',
  41404. 'ẋ' => 'Ẋ',
  41405. '�' => 'Ẍ',
  41406. '�' => 'Ẏ',
  41407. 'ẑ' => '�',
  41408. 'ẓ' => 'Ẓ',
  41409. 'ẕ' => 'Ẕ',
  41410. 'ẛ' => 'Ṡ',
  41411. 'ạ' => 'Ạ',
  41412. 'ả' => 'Ả',
  41413. 'ấ' => 'Ấ',
  41414. 'ầ' => 'Ầ',
  41415. 'ẩ' => 'Ẩ',
  41416. 'ẫ' => 'Ẫ',
  41417. 'ậ' => 'Ậ',
  41418. 'ắ' => 'Ắ',
  41419. 'ằ' => 'Ằ',
  41420. 'ẳ' => 'Ẳ',
  41421. 'ẵ' => 'Ẵ',
  41422. 'ặ' => 'Ặ',
  41423. 'ẹ' => 'Ẹ',
  41424. 'ẻ' => 'Ẻ',
  41425. 'ẽ' => 'Ẽ',
  41426. 'ế' => 'Ế',
  41427. '�' => 'Ề',
  41428. 'ể' => 'Ể',
  41429. 'ễ' => 'Ễ',
  41430. 'ệ' => 'Ệ',
  41431. 'ỉ' => 'Ỉ',
  41432. 'ị' => 'Ị',
  41433. '�' => 'Ọ',
  41434. '�' => 'Ỏ',
  41435. 'ố' => '�',
  41436. 'ồ' => 'Ồ',
  41437. 'ổ' => 'Ổ',
  41438. 'á»—' => 'á»–',
  41439. 'ộ' => 'Ộ',
  41440. 'ớ' => 'Ớ',
  41441. '�' => 'Ờ',
  41442. 'ở' => 'Ở',
  41443. 'ỡ' => 'Ỡ',
  41444. 'ợ' => 'Ợ',
  41445. 'ụ' => 'Ụ',
  41446. 'ủ' => 'Ủ',
  41447. 'ứ' => 'Ứ',
  41448. 'ừ' => 'Ừ',
  41449. 'ử' => 'Ử',
  41450. 'ữ' => 'Ữ',
  41451. 'á»±' => 'á»°',
  41452. 'ỳ' => 'Ỳ',
  41453. 'ỵ' => 'Ỵ',
  41454. 'ỷ' => 'Ỷ',
  41455. 'ỹ' => 'Ỹ',
  41456. 'ỻ' => 'Ỻ',
  41457. 'ỽ' => 'Ỽ',
  41458. 'ỿ' => 'Ỿ',
  41459. 'ἀ' => 'Ἀ',
  41460. '�' => 'Ἁ',
  41461. 'ἂ' => 'Ἂ',
  41462. 'ἃ' => 'Ἃ',
  41463. 'ἄ' => 'Ἄ',
  41464. 'ἅ' => '�',
  41465. 'ἆ' => 'Ἆ',
  41466. 'ἇ' => '�',
  41467. '�' => 'Ἐ',
  41468. 'ἑ' => 'Ἑ',
  41469. 'ἒ' => 'Ἒ',
  41470. 'ἓ' => 'Ἓ',
  41471. 'ἔ' => 'Ἔ',
  41472. 'ἕ' => '�',
  41473. 'ἠ' => 'Ἠ',
  41474. 'ἡ' => 'Ἡ',
  41475. 'ἢ' => 'Ἢ',
  41476. 'ἣ' => 'Ἣ',
  41477. 'ἤ' => 'Ἤ',
  41478. 'á¼¥' => 'á¼­',
  41479. 'ἦ' => 'Ἦ',
  41480. 'ἧ' => 'Ἧ',
  41481. 'ἰ' => 'Ἰ',
  41482. 'á¼±' => 'á¼¹',
  41483. 'ἲ' => 'Ἲ',
  41484. 'á¼³' => 'á¼»',
  41485. 'á¼´' => 'á¼¼',
  41486. 'á¼µ' => 'á¼½',
  41487. 'ἶ' => 'Ἶ',
  41488. 'ἷ' => 'Ἷ',
  41489. 'ὀ' => 'Ὀ',
  41490. '�' => 'Ὁ',
  41491. 'ὂ' => 'Ὂ',
  41492. 'ὃ' => 'Ὃ',
  41493. 'ὄ' => 'Ὄ',
  41494. 'ὅ' => '�',
  41495. 'ὑ' => 'Ὑ',
  41496. 'ὓ' => 'Ὓ',
  41497. 'ὕ' => '�',
  41498. 'ὗ' => 'Ὗ',
  41499. 'ὠ' => 'Ὠ',
  41500. 'ὡ' => 'Ὡ',
  41501. 'ὢ' => 'Ὢ',
  41502. 'ὣ' => 'Ὣ',
  41503. 'ὤ' => 'Ὤ',
  41504. 'á½¥' => 'á½­',
  41505. 'ὦ' => 'Ὦ',
  41506. 'ὧ' => 'Ὧ',
  41507. 'ὰ' => 'Ὰ',
  41508. 'á½±' => 'á¾»',
  41509. 'ὲ' => 'Ὲ',
  41510. 'έ' => 'Έ',
  41511. 'á½´' => 'á¿Š',
  41512. 'á½µ' => 'á¿‹',
  41513. 'ὶ' => 'Ὶ',
  41514. 'á½·' => 'á¿›',
  41515. 'ὸ' => 'Ὸ',
  41516. 'ό' => 'Ό',
  41517. 'ὺ' => 'Ὺ',
  41518. 'á½»' => 'á¿«',
  41519. 'ὼ' => 'Ὼ',
  41520. 'á½½' => 'á¿»',
  41521. 'ᾀ' => 'ᾈ',
  41522. '�' => 'ᾉ',
  41523. 'ᾂ' => 'ᾊ',
  41524. 'ᾃ' => 'ᾋ',
  41525. 'ᾄ' => 'ᾌ',
  41526. 'ᾅ' => '�',
  41527. 'ᾆ' => 'ᾎ',
  41528. 'ᾇ' => '�',
  41529. '�' => 'ᾘ',
  41530. 'ᾑ' => 'ᾙ',
  41531. 'ᾒ' => 'ᾚ',
  41532. 'ᾓ' => 'ᾛ',
  41533. 'ᾔ' => 'ᾜ',
  41534. 'ᾕ' => '�',
  41535. 'ᾖ' => 'ᾞ',
  41536. 'ᾗ' => 'ᾟ',
  41537. 'ᾠ' => 'ᾨ',
  41538. 'ᾡ' => 'ᾩ',
  41539. 'ᾢ' => 'ᾪ',
  41540. 'ᾣ' => 'ᾫ',
  41541. 'ᾤ' => 'ᾬ',
  41542. 'á¾¥' => 'á¾­',
  41543. 'ᾦ' => 'ᾮ',
  41544. 'ᾧ' => 'ᾯ',
  41545. 'ᾰ' => 'Ᾰ',
  41546. 'á¾±' => 'á¾¹',
  41547. 'á¾³' => 'á¾¼',
  41548. 'ι' => 'Ι',
  41549. 'ῃ' => 'ῌ',
  41550. '�' => 'Ῐ',
  41551. 'á¿‘' => 'á¿™',
  41552. 'ῠ' => 'Ῠ',
  41553. 'á¿¡' => 'á¿©',
  41554. 'ῥ' => 'Ῥ',
  41555. 'ῳ' => 'ῼ',
  41556. 'ⅎ' => 'Ⅎ',
  41557. 'â…°' => 'â… ',
  41558. 'â…±' => 'â…¡',
  41559. 'â…²' => 'â…¢',
  41560. 'â…³' => 'â…£',
  41561. 'â…´' => 'â…¤',
  41562. 'â…µ' => 'â…¥',
  41563. 'â…¶' => 'â…¦',
  41564. 'â…·' => 'â…§',
  41565. 'â…¸' => 'â…¨',
  41566. 'â…¹' => 'â…©',
  41567. 'â…º' => 'â…ª',
  41568. 'â…»' => 'â…«',
  41569. 'â…¼' => 'â…¬',
  41570. 'â…½' => 'â…­',
  41571. 'â…¾' => 'â…®',
  41572. 'â…¿' => 'â…¯',
  41573. 'ↄ' => 'Ↄ',
  41574. '�' => 'Ⓐ',
  41575. 'â“‘' => 'â’·',
  41576. 'â“’' => 'â’¸',
  41577. 'â““' => 'â’¹',
  41578. 'â“”' => 'â’º',
  41579. 'â“•' => 'â’»',
  41580. 'â“–' => 'â’¼',
  41581. 'â“—' => 'â’½',
  41582. 'ⓘ' => 'Ⓘ',
  41583. 'â“™' => 'â’¿',
  41584. 'â“š' => 'â“€',
  41585. 'ⓛ' => '�',
  41586. 'ⓜ' => 'Ⓜ',
  41587. '�' => 'Ⓝ',
  41588. 'â“ž' => 'â“„',
  41589. 'â“Ÿ' => 'â“…',
  41590. 'ⓠ' => 'Ⓠ',
  41591. 'ⓡ' => 'Ⓡ',
  41592. 'ⓢ' => 'Ⓢ',
  41593. 'ⓣ' => 'Ⓣ',
  41594. 'ⓤ' => 'Ⓤ',
  41595. 'â“¥' => 'â“‹',
  41596. 'ⓦ' => 'Ⓦ',
  41597. 'ⓧ' => '�',
  41598. 'ⓨ' => 'Ⓨ',
  41599. 'ⓩ' => '�',
  41600. 'â°°' => 'â°€',
  41601. 'â°±' => 'â°�',
  41602. 'â°²' => 'â°‚',
  41603. 'â°³' => 'â°ƒ',
  41604. 'â°´' => 'â°„',
  41605. 'â°µ' => 'â°…',
  41606. 'â°¶' => 'â°†',
  41607. 'â°·' => 'â°‡',
  41608. 'â°¸' => 'â°ˆ',
  41609. 'â°¹' => 'â°‰',
  41610. 'â°º' => 'â°Š',
  41611. 'â°»' => 'â°‹',
  41612. 'ⰼ' => 'Ⰼ',
  41613. 'â°½' => 'â°�',
  41614. 'â°¾' => 'â°Ž',
  41615. 'â°¿' => 'â°�',
  41616. 'â±€' => 'â°�',
  41617. '�' => 'Ⱁ',
  41618. 'ⱂ' => 'Ⱂ',
  41619. 'ⱃ' => 'Ⱃ',
  41620. 'ⱄ' => 'Ⱄ',
  41621. 'â±…' => 'â°•',
  41622. 'ⱆ' => 'Ⱆ',
  41623. 'ⱇ' => 'Ⱇ',
  41624. 'ⱈ' => 'Ⱈ',
  41625. 'ⱉ' => 'Ⱉ',
  41626. 'ⱊ' => 'Ⱊ',
  41627. 'ⱋ' => 'Ⱋ',
  41628. 'ⱌ' => 'Ⱌ',
  41629. '�' => '�',
  41630. 'ⱎ' => 'Ⱎ',
  41631. '�' => 'Ⱏ',
  41632. '�' => 'Ⱐ',
  41633. 'ⱑ' => 'Ⱑ',
  41634. 'â±’' => 'â°¢',
  41635. 'ⱓ' => 'Ⱓ',
  41636. 'â±”' => 'â°¤',
  41637. 'ⱕ' => 'Ⱕ',
  41638. 'â±–' => 'â°¦',
  41639. 'â±—' => 'â°§',
  41640. 'ⱘ' => 'Ⱘ',
  41641. 'â±™' => 'â°©',
  41642. 'ⱚ' => 'Ⱚ',
  41643. 'â±›' => 'â°«',
  41644. 'ⱜ' => 'Ⱜ',
  41645. '�' => 'Ⱝ',
  41646. 'ⱞ' => 'Ⱞ',
  41647. 'ⱡ' => 'Ⱡ',
  41648. 'ⱥ' => 'Ⱥ',
  41649. 'ⱦ' => 'Ⱦ',
  41650. 'ⱨ' => 'Ⱨ',
  41651. 'ⱪ' => 'Ⱪ',
  41652. 'ⱬ' => 'Ⱬ',
  41653. 'â±³' => 'â±²',
  41654. 'ⱶ' => 'Ⱶ',
  41655. '�' => 'Ⲁ',
  41656. 'ⲃ' => 'Ⲃ',
  41657. 'ⲅ' => 'Ⲅ',
  41658. 'ⲇ' => 'Ⲇ',
  41659. 'ⲉ' => 'Ⲉ',
  41660. 'ⲋ' => 'Ⲋ',
  41661. '�' => 'Ⲍ',
  41662. '�' => 'Ⲏ',
  41663. 'ⲑ' => '�',
  41664. 'ⲓ' => 'Ⲓ',
  41665. 'ⲕ' => 'Ⲕ',
  41666. 'â²—' => 'â²–',
  41667. 'ⲙ' => 'Ⲙ',
  41668. 'ⲛ' => 'Ⲛ',
  41669. '�' => 'Ⲝ',
  41670. 'ⲟ' => 'Ⲟ',
  41671. 'ⲡ' => 'Ⲡ',
  41672. 'â²£' => 'â²¢',
  41673. 'ⲥ' => 'Ⲥ',
  41674. 'ⲧ' => 'Ⲧ',
  41675. 'ⲩ' => 'Ⲩ',
  41676. 'ⲫ' => 'Ⲫ',
  41677. 'ⲭ' => 'Ⲭ',
  41678. 'ⲯ' => 'Ⲯ',
  41679. 'â²±' => 'â²°',
  41680. 'â²³' => 'â²²',
  41681. 'â²µ' => 'â²´',
  41682. 'ⲷ' => 'Ⲷ',
  41683. 'ⲹ' => 'Ⲹ',
  41684. 'ⲻ' => 'Ⲻ',
  41685. 'â²½' => 'â²¼',
  41686. 'ⲿ' => 'Ⲿ',
  41687. '�' => 'Ⳁ',
  41688. 'ⳃ' => 'Ⳃ',
  41689. 'ⳅ' => 'Ⳅ',
  41690. 'ⳇ' => 'Ⳇ',
  41691. 'ⳉ' => 'Ⳉ',
  41692. 'ⳋ' => 'Ⳋ',
  41693. '�' => 'Ⳍ',
  41694. '�' => 'Ⳏ',
  41695. 'ⳑ' => '�',
  41696. 'ⳓ' => 'Ⳓ',
  41697. 'ⳕ' => 'Ⳕ',
  41698. 'â³—' => 'â³–',
  41699. 'ⳙ' => 'Ⳙ',
  41700. 'ⳛ' => 'Ⳛ',
  41701. '�' => 'Ⳝ',
  41702. 'ⳟ' => 'Ⳟ',
  41703. 'ⳡ' => 'Ⳡ',
  41704. 'â³£' => 'â³¢',
  41705. 'ⳬ' => 'Ⳬ',
  41706. 'â³®' => 'â³­',
  41707. 'â³³' => 'â³²',
  41708. 'â´€' => 'á‚ ',
  41709. 'â´�' => 'á‚¡',
  41710. 'â´‚' => 'á‚¢',
  41711. 'â´ƒ' => 'á‚£',
  41712. 'ⴄ' => 'Ⴄ',
  41713. 'â´…' => 'á‚¥',
  41714. 'ⴆ' => 'Ⴆ',
  41715. 'ⴇ' => 'Ⴇ',
  41716. 'ⴈ' => 'Ⴈ',
  41717. 'â´‰' => 'á‚©',
  41718. 'ⴊ' => 'Ⴊ',
  41719. 'â´‹' => 'á‚«',
  41720. 'ⴌ' => 'Ⴌ',
  41721. 'â´�' => 'á‚­',
  41722. 'â´Ž' => 'á‚®',
  41723. '�' => 'Ⴏ',
  41724. 'â´�' => 'á‚°',
  41725. 'ⴑ' => 'Ⴑ',
  41726. 'ⴒ' => 'Ⴒ',
  41727. 'ⴓ' => 'Ⴓ',
  41728. 'â´”' => 'á‚´',
  41729. 'ⴕ' => 'Ⴕ',
  41730. 'ⴖ' => 'Ⴖ',
  41731. 'â´—' => 'á‚·',
  41732. 'ⴘ' => 'Ⴘ',
  41733. 'ⴙ' => 'Ⴙ',
  41734. 'ⴚ' => 'Ⴚ',
  41735. 'â´›' => 'á‚»',
  41736. 'ⴜ' => 'Ⴜ',
  41737. '�' => 'Ⴝ',
  41738. 'ⴞ' => 'Ⴞ',
  41739. 'â´Ÿ' => 'á‚¿',
  41740. 'ⴠ' => 'Ⴠ',
  41741. 'ⴡ' => '�',
  41742. 'ⴢ' => 'Ⴢ',
  41743. 'ⴣ' => 'Ⴣ',
  41744. 'ⴤ' => 'Ⴤ',
  41745. 'ⴥ' => 'Ⴥ',
  41746. 'ⴧ' => 'Ⴧ',
  41747. 'ⴭ' => '�',
  41748. '�' => 'Ꙁ',
  41749. 'ꙃ' => 'Ꙃ',
  41750. 'ꙅ' => 'Ꙅ',
  41751. 'ꙇ' => 'Ꙇ',
  41752. 'ꙉ' => 'Ꙉ',
  41753. 'ꙋ' => 'Ꙋ',
  41754. '�' => 'Ꙍ',
  41755. '�' => 'Ꙏ',
  41756. 'ꙑ' => '�',
  41757. 'ꙓ' => 'Ꙓ',
  41758. 'ꙕ' => 'Ꙕ',
  41759. 'ê™—' => 'ê™–',
  41760. 'ꙙ' => 'Ꙙ',
  41761. 'ꙛ' => 'Ꙛ',
  41762. '�' => 'Ꙝ',
  41763. 'ꙟ' => 'Ꙟ',
  41764. 'ꙡ' => 'Ꙡ',
  41765. 'ꙣ' => 'Ꙣ',
  41766. 'ꙥ' => 'Ꙥ',
  41767. 'ꙧ' => 'Ꙧ',
  41768. 'ꙩ' => 'Ꙩ',
  41769. 'ꙫ' => 'Ꙫ',
  41770. 'ꙭ' => 'Ꙭ',
  41771. '�' => 'Ꚁ',
  41772. 'ꚃ' => 'Ꚃ',
  41773. 'êš…' => 'êš„',
  41774. 'ꚇ' => 'Ꚇ',
  41775. 'ꚉ' => 'Ꚉ',
  41776. 'ꚋ' => 'Ꚋ',
  41777. '�' => 'Ꚍ',
  41778. '�' => 'Ꚏ',
  41779. 'ꚑ' => '�',
  41780. 'êš“' => 'êš’',
  41781. 'êš•' => 'êš”',
  41782. 'êš—' => 'êš–',
  41783. 'ꚙ' => 'Ꚙ',
  41784. 'êš›' => 'êšš',
  41785. 'ꜣ' => 'Ꜣ',
  41786. 'ꜥ' => 'Ꜥ',
  41787. 'ꜧ' => 'Ꜧ',
  41788. 'ꜩ' => 'Ꜩ',
  41789. 'ꜫ' => 'Ꜫ',
  41790. 'ꜭ' => 'Ꜭ',
  41791. 'ꜯ' => 'Ꜯ',
  41792. 'ꜳ' => 'Ꜳ',
  41793. 'ꜵ' => 'Ꜵ',
  41794. 'ꜷ' => 'Ꜷ',
  41795. 'ꜹ' => 'Ꜹ',
  41796. 'ꜻ' => 'Ꜻ',
  41797. 'ꜽ' => 'Ꜽ',
  41798. 'ꜿ' => 'Ꜿ',
  41799. '�' => '�',
  41800. '�' => '�',
  41801. '�' => '�',
  41802. '�' => '�',
  41803. '�' => '�',
  41804. '�' => '�',
  41805. '�' => '�',
  41806. '�' => '�',
  41807. '�' => '�',
  41808. '�' => '�',
  41809. '�' => '�',
  41810. '�' => '�',
  41811. '�' => '�',
  41812. '�' => '�',
  41813. '�' => '�',
  41814. '�' => '�',
  41815. '�' => '�',
  41816. '�' => '�',
  41817. '�' => '�',
  41818. '�' => '�',
  41819. '�' => '�',
  41820. '�' => '�',
  41821. '�' => '�',
  41822. '�' => '�',
  41823. '�' => '�',
  41824. '�' => '�',
  41825. '�' => '�',
  41826. '�' => 'Ꞁ',
  41827. 'ꞃ' => 'Ꞃ',
  41828. 'êž…' => 'êž„',
  41829. 'ꞇ' => 'Ꞇ',
  41830. 'ꞌ' => 'Ꞌ',
  41831. 'ꞑ' => '�',
  41832. 'êž“' => 'êž’',
  41833. 'êž—' => 'êž–',
  41834. 'ꞙ' => 'Ꞙ',
  41835. 'êž›' => 'êžš',
  41836. '�' => 'Ꞝ',
  41837. 'ꞟ' => 'Ꞟ',
  41838. 'êž¡' => 'êž ',
  41839. 'ꞣ' => 'Ꞣ',
  41840. 'ꞥ' => 'Ꞥ',
  41841. 'ꞧ' => 'Ꞧ',
  41842. 'ꞩ' => 'Ꞩ',
  41843. '�' => 'A',
  41844. 'b' => 'B',
  41845. 'c' => 'C',
  41846. 'd' => 'D',
  41847. 'ï½…' => 'ï¼¥',
  41848. 'f' => 'F',
  41849. 'g' => 'G',
  41850. 'h' => 'H',
  41851. 'i' => 'I',
  41852. 'j' => 'J',
  41853. 'k' => 'K',
  41854. 'l' => 'L',
  41855. '�' => 'M',
  41856. 'n' => 'N',
  41857. '�' => 'O',
  41858. '�' => 'P',
  41859. 'q' => 'Q',
  41860. 'ï½’' => 'ï¼²',
  41861. 's' => 'S',
  41862. 'ï½”' => 'ï¼´',
  41863. 'u' => 'U',
  41864. 'v' => 'V',
  41865. 'ï½—' => 'ï¼·',
  41866. 'x' => 'X',
  41867. 'ï½™' => 'ï¼¹',
  41868. 'z' => 'Z',
  41869. '�' => '�',
  41870. '�' => '�',
  41871. '�' => '�',
  41872. '�' => '�',
  41873. '�' => '�',
  41874. '�' => '�',
  41875. '�' => '�',
  41876. '�' => '�',
  41877. '�' => '�',
  41878. '�' => '�',
  41879. '�' => '�',
  41880. '�' => '�',
  41881. '�' => '�',
  41882. '�' => '�',
  41883. '�' => '�',
  41884. '�' => '�',
  41885. '�' => '�',
  41886. '�' => '�',
  41887. '�' => '�',
  41888. '�' => '�',
  41889. '�' => '�',
  41890. '�' => '�',
  41891. '�' => '�',
  41892. '�' => '�',
  41893. '�' => '�',
  41894. '�' => '�',
  41895. '�' => '�',
  41896. '�' => '�',
  41897. '�' => '�',
  41898. '�' => '�',
  41899. '�' => '�',
  41900. '�' => '�',
  41901. '�' => '�',
  41902. '�' => '�',
  41903. '�' => '�',
  41904. '�' => '�',
  41905. '�' => '�',
  41906. '�' => '�',
  41907. '�' => '�',
  41908. '�' => '�',
  41909. 'ð‘£€' => 'ð‘¢ ',
  41910. '�' => '𑢡',
  41911. '𑣂' => '𑢢',
  41912. '𑣃' => '𑢣',
  41913. '𑣄' => '𑢤',
  41914. 'ð‘£…' => 'ð‘¢¥',
  41915. '𑣆' => '𑢦',
  41916. '𑣇' => '𑢧',
  41917. '𑣈' => '𑢨',
  41918. '𑣉' => '𑢩',
  41919. '𑣊' => '𑢪',
  41920. '𑣋' => '𑢫',
  41921. '𑣌' => '𑢬',
  41922. '�' => '𑢭',
  41923. '𑣎' => '𑢮',
  41924. '�' => '𑢯',
  41925. '�' => '𑢰',
  41926. '𑣑' => '𑢱',
  41927. 'ð‘£’' => 'ð‘¢²',
  41928. '𑣓' => '𑢳',
  41929. 'ð‘£”' => 'ð‘¢´',
  41930. '𑣕' => '𑢵',
  41931. '𑣖' => '𑢶',
  41932. 'ð‘£—' => 'ð‘¢·',
  41933. '𑣘' => '𑢸',
  41934. 'ð‘£™' => 'ð‘¢¹',
  41935. '𑣚' => '𑢺',
  41936. 'ð‘£›' => 'ð‘¢»',
  41937. '𑣜' => '𑢼',
  41938. '�' => '𑢽',
  41939. '𑣞' => '𑢾',
  41940. '𑣟' => '𑢿',
  41941. );
  41942. $result =& $data;
  41943. unset($data);
  41944. return $result;
  41945. <?php
  41946. use Symfony\Polyfill\Mbstring as p;
  41947. if (!function_exists('mb_strlen')) {
  41948. define('MB_CASE_UPPER', 0);
  41949. define('MB_CASE_LOWER', 1);
  41950. define('MB_CASE_TITLE', 2);
  41951. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  41952. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  41953. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  41954. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  41955. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  41956. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  41957. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  41958. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  41959. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  41960. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  41961. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  41962. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  41963. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  41964. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  41965. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  41966. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  41967. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  41968. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  41969. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  41970. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  41971. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  41972. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  41973. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  41974. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  41975. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  41976. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  41977. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  41978. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  41979. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  41980. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  41981. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  41982. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  41983. }
  41984. if (!function_exists('mb_chr')) {
  41985. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  41986. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  41987. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  41988. }
  41989. <?php
  41990. namespace Symfony\Component\Process\Exception;
  41991. interface ExceptionInterface
  41992. {
  41993. }
  41994. <?php
  41995. namespace Symfony\Component\Process\Exception;
  41996. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  41997. {
  41998. }
  41999. <?php
  42000. namespace Symfony\Component\Process\Exception;
  42001. class LogicException extends \LogicException implements ExceptionInterface
  42002. {
  42003. }
  42004. <?php
  42005. namespace Symfony\Component\Process\Exception;
  42006. use Symfony\Component\Process\Process;
  42007. class ProcessFailedException extends RuntimeException
  42008. {
  42009. private $process;
  42010. public function __construct(Process $process)
  42011. {
  42012. if ($process->isSuccessful()) {
  42013. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  42014. }
  42015. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  42016. $process->getCommandLine(),
  42017. $process->getExitCode(),
  42018. $process->getExitCodeText(),
  42019. $process->getWorkingDirectory()
  42020. );
  42021. if (!$process->isOutputDisabled()) {
  42022. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  42023. $process->getOutput(),
  42024. $process->getErrorOutput()
  42025. );
  42026. }
  42027. parent::__construct($error);
  42028. $this->process = $process;
  42029. }
  42030. public function getProcess()
  42031. {
  42032. return $this->process;
  42033. }
  42034. }
  42035. <?php
  42036. namespace Symfony\Component\Process\Exception;
  42037. use Symfony\Component\Process\Process;
  42038. class ProcessTimedOutException extends RuntimeException
  42039. {
  42040. const TYPE_GENERAL = 1;
  42041. const TYPE_IDLE = 2;
  42042. private $process;
  42043. private $timeoutType;
  42044. public function __construct(Process $process, $timeoutType)
  42045. {
  42046. $this->process = $process;
  42047. $this->timeoutType = $timeoutType;
  42048. parent::__construct(sprintf(
  42049. 'The process "%s" exceeded the timeout of %s seconds.',
  42050. $process->getCommandLine(),
  42051. $this->getExceededTimeout()
  42052. ));
  42053. }
  42054. public function getProcess()
  42055. {
  42056. return $this->process;
  42057. }
  42058. public function isGeneralTimeout()
  42059. {
  42060. return $this->timeoutType === self::TYPE_GENERAL;
  42061. }
  42062. public function isIdleTimeout()
  42063. {
  42064. return $this->timeoutType === self::TYPE_IDLE;
  42065. }
  42066. public function getExceededTimeout()
  42067. {
  42068. switch ($this->timeoutType) {
  42069. case self::TYPE_GENERAL:
  42070. return $this->process->getTimeout();
  42071. case self::TYPE_IDLE:
  42072. return $this->process->getIdleTimeout();
  42073. default:
  42074. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  42075. }
  42076. }
  42077. }
  42078. <?php
  42079. namespace Symfony\Component\Process\Exception;
  42080. class RuntimeException extends \RuntimeException implements ExceptionInterface
  42081. {
  42082. }
  42083. <?php
  42084. namespace Symfony\Component\Process;
  42085. class ExecutableFinder
  42086. {
  42087. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  42088. public function setSuffixes(array $suffixes)
  42089. {
  42090. $this->suffixes = $suffixes;
  42091. }
  42092. public function addSuffix($suffix)
  42093. {
  42094. $this->suffixes[] = $suffix;
  42095. }
  42096. public function find($name, $default = null, array $extraDirs = array())
  42097. {
  42098. if (ini_get('open_basedir')) {
  42099. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  42100. $dirs = array();
  42101. foreach ($searchPath as $path) {
  42102. if (@is_dir($path)) {
  42103. $dirs[] = $path;
  42104. } else {
  42105. if (basename($path) == $name && @is_executable($path)) {
  42106. return $path;
  42107. }
  42108. }
  42109. }
  42110. } else {
  42111. $dirs = array_merge(
  42112. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  42113. $extraDirs
  42114. );
  42115. }
  42116. $suffixes = array('');
  42117. if ('\\' === DIRECTORY_SEPARATOR) {
  42118. $pathExt = getenv('PATHEXT');
  42119. $suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
  42120. }
  42121. foreach ($suffixes as $suffix) {
  42122. foreach ($dirs as $dir) {
  42123. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  42124. return $file;
  42125. }
  42126. }
  42127. }
  42128. return $default;
  42129. }
  42130. }
  42131. Copyright (c) 2004-2016 Fabien Potencier
  42132. Permission is hereby granted, free of charge, to any person obtaining a copy
  42133. of this software and associated documentation files (the "Software"), to deal
  42134. in the Software without restriction, including without limitation the rights
  42135. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42136. copies of the Software, and to permit persons to whom the Software is furnished
  42137. to do so, subject to the following conditions:
  42138. The above copyright notice and this permission notice shall be included in all
  42139. copies or substantial portions of the Software.
  42140. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42141. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42142. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42143. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42144. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42145. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42146. THE SOFTWARE.
  42147. <?php
  42148. namespace Symfony\Component\Process;
  42149. class PhpExecutableFinder
  42150. {
  42151. private $executableFinder;
  42152. public function __construct()
  42153. {
  42154. $this->executableFinder = new ExecutableFinder();
  42155. }
  42156. public function find($includeArgs = true)
  42157. {
  42158. $args = $this->findArguments();
  42159. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  42160. if (defined('HHVM_VERSION')) {
  42161. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  42162. }
  42163. if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
  42164. return PHP_BINARY.$args;
  42165. }
  42166. if ($php = getenv('PHP_PATH')) {
  42167. if (!is_executable($php)) {
  42168. return false;
  42169. }
  42170. return $php;
  42171. }
  42172. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  42173. if (is_executable($php)) {
  42174. return $php;
  42175. }
  42176. }
  42177. $dirs = array(PHP_BINDIR);
  42178. if ('\\' === DIRECTORY_SEPARATOR) {
  42179. $dirs[] = 'C:\xampp\php\\';
  42180. }
  42181. return $this->executableFinder->find('php', false, $dirs);
  42182. }
  42183. public function findArguments()
  42184. {
  42185. $arguments = array();
  42186. if (defined('HHVM_VERSION')) {
  42187. $arguments[] = '--php';
  42188. } elseif ('phpdbg' === PHP_SAPI) {
  42189. $arguments[] = '-qrr';
  42190. }
  42191. return $arguments;
  42192. }
  42193. }
  42194. <?php
  42195. namespace Symfony\Component\Process;
  42196. use Symfony\Component\Process\Exception\RuntimeException;
  42197. class PhpProcess extends Process
  42198. {
  42199. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  42200. {
  42201. $executableFinder = new PhpExecutableFinder();
  42202. if (false === $php = $executableFinder->find()) {
  42203. $php = null;
  42204. }
  42205. if ('phpdbg' === PHP_SAPI) {
  42206. $file = tempnam(sys_get_temp_dir(), 'dbg');
  42207. file_put_contents($file, $script);
  42208. register_shutdown_function('unlink', $file);
  42209. $php .= ' '.ProcessUtils::escapeArgument($file);
  42210. $script = null;
  42211. }
  42212. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  42213. $php = 'exec '.$php;
  42214. }
  42215. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  42216. }
  42217. public function setPhpBinary($php)
  42218. {
  42219. $this->setCommandLine($php);
  42220. }
  42221. public function start($callback = null)
  42222. {
  42223. if (null === $this->getCommandLine()) {
  42224. throw new RuntimeException('Unable to find the PHP executable.');
  42225. }
  42226. parent::start($callback);
  42227. }
  42228. }
  42229. <?php
  42230. namespace Symfony\Component\Process\Pipes;
  42231. abstract class AbstractPipes implements PipesInterface
  42232. {
  42233. public $pipes = array();
  42234. private $inputBuffer = '';
  42235. private $input;
  42236. private $blocked = true;
  42237. public function __construct($input)
  42238. {
  42239. if (is_resource($input)) {
  42240. $this->input = $input;
  42241. } elseif (is_string($input)) {
  42242. $this->inputBuffer = $input;
  42243. } else {
  42244. $this->inputBuffer = (string) $input;
  42245. }
  42246. }
  42247. public function close()
  42248. {
  42249. foreach ($this->pipes as $pipe) {
  42250. fclose($pipe);
  42251. }
  42252. $this->pipes = array();
  42253. }
  42254. protected function hasSystemCallBeenInterrupted()
  42255. {
  42256. $lastError = error_get_last();
  42257. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  42258. }
  42259. protected function unblock()
  42260. {
  42261. if (!$this->blocked) {
  42262. return;
  42263. }
  42264. foreach ($this->pipes as $pipe) {
  42265. stream_set_blocking($pipe, 0);
  42266. }
  42267. if (null !== $this->input) {
  42268. stream_set_blocking($this->input, 0);
  42269. }
  42270. $this->blocked = false;
  42271. }
  42272. protected function write()
  42273. {
  42274. if (!isset($this->pipes[0])) {
  42275. return;
  42276. }
  42277. $input = $this->input;
  42278. $r = $e = array();
  42279. $w = array($this->pipes[0]);
  42280. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
  42281. return;
  42282. }
  42283. foreach ($w as $stdin) {
  42284. if (isset($this->inputBuffer[0])) {
  42285. $written = fwrite($stdin, $this->inputBuffer);
  42286. $this->inputBuffer = substr($this->inputBuffer, $written);
  42287. if (isset($this->inputBuffer[0])) {
  42288. return array($this->pipes[0]);
  42289. }
  42290. }
  42291. if ($input) {
  42292. for (;;) {
  42293. $data = fread($input, self::CHUNK_SIZE);
  42294. if (!isset($data[0])) {
  42295. break;
  42296. }
  42297. $written = fwrite($stdin, $data);
  42298. $data = substr($data, $written);
  42299. if (isset($data[0])) {
  42300. $this->inputBuffer = $data;
  42301. return array($this->pipes[0]);
  42302. }
  42303. }
  42304. if (feof($input)) {
  42305. $this->input = null;
  42306. }
  42307. }
  42308. }
  42309. if (null === $this->input && !isset($this->inputBuffer[0])) {
  42310. fclose($this->pipes[0]);
  42311. unset($this->pipes[0]);
  42312. } elseif (!$w) {
  42313. return array($this->pipes[0]);
  42314. }
  42315. }
  42316. }
  42317. <?php
  42318. namespace Symfony\Component\Process\Pipes;
  42319. interface PipesInterface
  42320. {
  42321. const CHUNK_SIZE = 16384;
  42322. public function getDescriptors();
  42323. public function getFiles();
  42324. public function readAndWrite($blocking, $close = false);
  42325. public function areOpen();
  42326. public function close();
  42327. }
  42328. <?php
  42329. namespace Symfony\Component\Process\Pipes;
  42330. use Symfony\Component\Process\Process;
  42331. class UnixPipes extends AbstractPipes
  42332. {
  42333. private $ttyMode;
  42334. private $ptyMode;
  42335. private $disableOutput;
  42336. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  42337. {
  42338. $this->ttyMode = (bool) $ttyMode;
  42339. $this->ptyMode = (bool) $ptyMode;
  42340. $this->disableOutput = (bool) $disableOutput;
  42341. parent::__construct($input);
  42342. }
  42343. public function __destruct()
  42344. {
  42345. $this->close();
  42346. }
  42347. public function getDescriptors()
  42348. {
  42349. if ($this->disableOutput) {
  42350. $nullstream = fopen('/dev/null', 'c');
  42351. return array(
  42352. array('pipe', 'r'),
  42353. $nullstream,
  42354. $nullstream,
  42355. );
  42356. }
  42357. if ($this->ttyMode) {
  42358. return array(
  42359. array('file', '/dev/tty', 'r'),
  42360. array('file', '/dev/tty', 'w'),
  42361. array('file', '/dev/tty', 'w'),
  42362. );
  42363. }
  42364. if ($this->ptyMode && Process::isPtySupported()) {
  42365. return array(
  42366. array('pty'),
  42367. array('pty'),
  42368. array('pty'),
  42369. );
  42370. }
  42371. return array(
  42372. array('pipe', 'r'),
  42373. array('pipe', 'w'),
  42374. array('pipe', 'w'),
  42375. );
  42376. }
  42377. public function getFiles()
  42378. {
  42379. return array();
  42380. }
  42381. public function readAndWrite($blocking, $close = false)
  42382. {
  42383. $this->unblock();
  42384. $w = $this->write();
  42385. $read = $e = array();
  42386. $r = $this->pipes;
  42387. unset($r[0]);
  42388. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  42389. if (!$this->hasSystemCallBeenInterrupted()) {
  42390. $this->pipes = array();
  42391. }
  42392. return $read;
  42393. }
  42394. foreach ($r as $pipe) {
  42395. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  42396. do {
  42397. $data = fread($pipe, self::CHUNK_SIZE);
  42398. $read[$type] .= $data;
  42399. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  42400. if (!isset($read[$type][0])) {
  42401. unset($read[$type]);
  42402. }
  42403. if ($close && feof($pipe)) {
  42404. fclose($pipe);
  42405. unset($this->pipes[$type]);
  42406. }
  42407. }
  42408. return $read;
  42409. }
  42410. public function areOpen()
  42411. {
  42412. return (bool) $this->pipes;
  42413. }
  42414. public static function create(Process $process, $input)
  42415. {
  42416. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  42417. }
  42418. }
  42419. <?php
  42420. namespace Symfony\Component\Process\Pipes;
  42421. use Symfony\Component\Process\Process;
  42422. use Symfony\Component\Process\Exception\RuntimeException;
  42423. class WindowsPipes extends AbstractPipes
  42424. {
  42425. private $files = array();
  42426. private $fileHandles = array();
  42427. private $readBytes = array(
  42428. Process::STDOUT => 0,
  42429. Process::STDERR => 0,
  42430. );
  42431. private $disableOutput;
  42432. public function __construct($disableOutput, $input)
  42433. {
  42434. $this->disableOutput = (bool) $disableOutput;
  42435. if (!$this->disableOutput) {
  42436. $pipes = array(
  42437. Process::STDOUT => Process::OUT,
  42438. Process::STDERR => Process::ERR,
  42439. );
  42440. $tmpCheck = false;
  42441. $tmpDir = sys_get_temp_dir();
  42442. $lastError = 'unknown reason';
  42443. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  42444. for ($i = 0;; ++$i) {
  42445. foreach ($pipes as $pipe => $name) {
  42446. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  42447. if (file_exists($file) && !unlink($file)) {
  42448. continue 2;
  42449. }
  42450. $h = fopen($file, 'xb');
  42451. if (!$h) {
  42452. $error = $lastError;
  42453. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  42454. continue;
  42455. }
  42456. restore_error_handler();
  42457. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  42458. }
  42459. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  42460. continue 2;
  42461. }
  42462. if (isset($this->files[$pipe])) {
  42463. unlink($this->files[$pipe]);
  42464. }
  42465. $this->files[$pipe] = $file;
  42466. }
  42467. break;
  42468. }
  42469. restore_error_handler();
  42470. }
  42471. parent::__construct($input);
  42472. }
  42473. public function __destruct()
  42474. {
  42475. $this->close();
  42476. $this->removeFiles();
  42477. }
  42478. public function getDescriptors()
  42479. {
  42480. if ($this->disableOutput) {
  42481. $nullstream = fopen('NUL', 'c');
  42482. return array(
  42483. array('pipe', 'r'),
  42484. $nullstream,
  42485. $nullstream,
  42486. );
  42487. }
  42488. return array(
  42489. array('pipe', 'r'),
  42490. array('file', 'NUL', 'w'),
  42491. array('file', 'NUL', 'w'),
  42492. );
  42493. }
  42494. public function getFiles()
  42495. {
  42496. return $this->files;
  42497. }
  42498. public function readAndWrite($blocking, $close = false)
  42499. {
  42500. $this->unblock();
  42501. $w = $this->write();
  42502. $read = $r = $e = array();
  42503. if ($blocking) {
  42504. if ($w) {
  42505. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  42506. } elseif ($this->fileHandles) {
  42507. usleep(Process::TIMEOUT_PRECISION * 1E6);
  42508. }
  42509. }
  42510. foreach ($this->fileHandles as $type => $fileHandle) {
  42511. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  42512. if (isset($data[0])) {
  42513. $this->readBytes[$type] += strlen($data);
  42514. $read[$type] = $data;
  42515. }
  42516. if ($close) {
  42517. fclose($fileHandle);
  42518. unset($this->fileHandles[$type]);
  42519. }
  42520. }
  42521. return $read;
  42522. }
  42523. public function areOpen()
  42524. {
  42525. return $this->pipes && $this->fileHandles;
  42526. }
  42527. public function close()
  42528. {
  42529. parent::close();
  42530. foreach ($this->fileHandles as $handle) {
  42531. fclose($handle);
  42532. }
  42533. $this->fileHandles = array();
  42534. }
  42535. public static function create(Process $process, $input)
  42536. {
  42537. return new static($process->isOutputDisabled(), $input);
  42538. }
  42539. private function removeFiles()
  42540. {
  42541. foreach ($this->files as $filename) {
  42542. if (file_exists($filename)) {
  42543. @unlink($filename);
  42544. }
  42545. }
  42546. $this->files = array();
  42547. }
  42548. }
  42549. <?php
  42550. namespace Symfony\Component\Process;
  42551. use Symfony\Component\Process\Exception\InvalidArgumentException;
  42552. use Symfony\Component\Process\Exception\LogicException;
  42553. use Symfony\Component\Process\Exception\ProcessFailedException;
  42554. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  42555. use Symfony\Component\Process\Exception\RuntimeException;
  42556. use Symfony\Component\Process\Pipes\PipesInterface;
  42557. use Symfony\Component\Process\Pipes\UnixPipes;
  42558. use Symfony\Component\Process\Pipes\WindowsPipes;
  42559. class Process
  42560. {
  42561. const ERR = 'err';
  42562. const OUT = 'out';
  42563. const STATUS_READY = 'ready';
  42564. const STATUS_STARTED = 'started';
  42565. const STATUS_TERMINATED = 'terminated';
  42566. const STDIN = 0;
  42567. const STDOUT = 1;
  42568. const STDERR = 2;
  42569. const TIMEOUT_PRECISION = 0.2;
  42570. private $callback;
  42571. private $commandline;
  42572. private $cwd;
  42573. private $env;
  42574. private $input;
  42575. private $starttime;
  42576. private $lastOutputTime;
  42577. private $timeout;
  42578. private $idleTimeout;
  42579. private $options;
  42580. private $exitcode;
  42581. private $fallbackStatus = array();
  42582. private $processInformation;
  42583. private $outputDisabled = false;
  42584. private $stdout;
  42585. private $stderr;
  42586. private $enhanceWindowsCompatibility = true;
  42587. private $enhanceSigchildCompatibility;
  42588. private $process;
  42589. private $status = self::STATUS_READY;
  42590. private $incrementalOutputOffset = 0;
  42591. private $incrementalErrorOutputOffset = 0;
  42592. private $tty;
  42593. private $pty;
  42594. private $useFileHandles = false;
  42595. private $processPipes;
  42596. private $latestSignal;
  42597. private static $sigchild;
  42598. public static $exitCodes = array(
  42599. 0 => 'OK',
  42600. 1 => 'General error',
  42601. 2 => 'Misuse of shell builtins',
  42602. 126 => 'Invoked command cannot execute',
  42603. 127 => 'Command not found',
  42604. 128 => 'Invalid exit argument',
  42605. 129 => 'Hangup',
  42606. 130 => 'Interrupt',
  42607. 131 => 'Quit and dump core',
  42608. 132 => 'Illegal instruction',
  42609. 133 => 'Trace/breakpoint trap',
  42610. 134 => 'Process aborted',
  42611. 135 => 'Bus error: "access to undefined portion of memory object"',
  42612. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  42613. 137 => 'Kill (terminate immediately)',
  42614. 138 => 'User-defined 1',
  42615. 139 => 'Segmentation violation',
  42616. 140 => 'User-defined 2',
  42617. 141 => 'Write to pipe with no one reading',
  42618. 142 => 'Signal raised by alarm',
  42619. 143 => 'Termination (request to terminate)',
  42620. 145 => 'Child process terminated, stopped (or continued*)',
  42621. 146 => 'Continue if stopped',
  42622. 147 => 'Stop executing temporarily',
  42623. 148 => 'Terminal stop signal',
  42624. 149 => 'Background process attempting to read from tty ("in")',
  42625. 150 => 'Background process attempting to write to tty ("out")',
  42626. 151 => 'Urgent data available on socket',
  42627. 152 => 'CPU time limit exceeded',
  42628. 153 => 'File size limit exceeded',
  42629. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  42630. 155 => 'Profiling timer expired',
  42631. 157 => 'Pollable event',
  42632. 159 => 'Bad syscall',
  42633. );
  42634. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  42635. {
  42636. if (!function_exists('proc_open')) {
  42637. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  42638. }
  42639. $this->commandline = $commandline;
  42640. $this->cwd = $cwd;
  42641. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  42642. $this->cwd = getcwd();
  42643. }
  42644. if (null !== $env) {
  42645. $this->setEnv($env);
  42646. }
  42647. $this->setInput($input);
  42648. $this->setTimeout($timeout);
  42649. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  42650. $this->pty = false;
  42651. $this->enhanceWindowsCompatibility = true;
  42652. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  42653. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  42654. }
  42655. public function __destruct()
  42656. {
  42657. $this->stop(0);
  42658. }
  42659. public function __clone()
  42660. {
  42661. $this->resetProcessData();
  42662. }
  42663. public function run($callback = null)
  42664. {
  42665. $this->start($callback);
  42666. return $this->wait();
  42667. }
  42668. public function mustRun($callback = null)
  42669. {
  42670. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  42671. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  42672. }
  42673. if (0 !== $this->run($callback)) {
  42674. throw new ProcessFailedException($this);
  42675. }
  42676. return $this;
  42677. }
  42678. public function start($callback = null)
  42679. {
  42680. if ($this->isRunning()) {
  42681. throw new RuntimeException('Process is already running');
  42682. }
  42683. if ($this->outputDisabled && null !== $callback) {
  42684. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  42685. }
  42686. $this->resetProcessData();
  42687. $this->starttime = $this->lastOutputTime = microtime(true);
  42688. $this->callback = $this->buildCallback($callback);
  42689. $descriptors = $this->getDescriptors();
  42690. $commandline = $this->commandline;
  42691. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  42692. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  42693. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  42694. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  42695. }
  42696. $commandline .= '"';
  42697. if (!isset($this->options['bypass_shell'])) {
  42698. $this->options['bypass_shell'] = true;
  42699. }
  42700. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  42701. $descriptors[3] = array('pipe', 'w');
  42702. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  42703. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  42704. $ptsWorkaround = fopen(__FILE__, 'r');
  42705. }
  42706. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  42707. if (!is_resource($this->process)) {
  42708. throw new RuntimeException('Unable to launch a new process.');
  42709. }
  42710. $this->status = self::STATUS_STARTED;
  42711. if (isset($descriptors[3])) {
  42712. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  42713. }
  42714. if ($this->tty) {
  42715. return;
  42716. }
  42717. $this->updateStatus(false);
  42718. $this->checkTimeout();
  42719. }
  42720. public function restart($callback = null)
  42721. {
  42722. if ($this->isRunning()) {
  42723. throw new RuntimeException('Process is already running');
  42724. }
  42725. $process = clone $this;
  42726. $process->start($callback);
  42727. return $process;
  42728. }
  42729. public function wait($callback = null)
  42730. {
  42731. $this->requireProcessIsStarted(__FUNCTION__);
  42732. $this->updateStatus(false);
  42733. if (null !== $callback) {
  42734. $this->callback = $this->buildCallback($callback);
  42735. }
  42736. do {
  42737. $this->checkTimeout();
  42738. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  42739. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  42740. } while ($running);
  42741. while ($this->isRunning()) {
  42742. usleep(1000);
  42743. }
  42744. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  42745. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  42746. }
  42747. return $this->exitcode;
  42748. }
  42749. public function getPid()
  42750. {
  42751. return $this->isRunning() ? $this->processInformation['pid'] : null;
  42752. }
  42753. public function signal($signal)
  42754. {
  42755. $this->doSignal($signal, true);
  42756. return $this;
  42757. }
  42758. public function disableOutput()
  42759. {
  42760. if ($this->isRunning()) {
  42761. throw new RuntimeException('Disabling output while the process is running is not possible.');
  42762. }
  42763. if (null !== $this->idleTimeout) {
  42764. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  42765. }
  42766. $this->outputDisabled = true;
  42767. return $this;
  42768. }
  42769. public function enableOutput()
  42770. {
  42771. if ($this->isRunning()) {
  42772. throw new RuntimeException('Enabling output while the process is running is not possible.');
  42773. }
  42774. $this->outputDisabled = false;
  42775. return $this;
  42776. }
  42777. public function isOutputDisabled()
  42778. {
  42779. return $this->outputDisabled;
  42780. }
  42781. public function getOutput()
  42782. {
  42783. $this->readPipesForOutput(__FUNCTION__);
  42784. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  42785. return '';
  42786. }
  42787. return $ret;
  42788. }
  42789. public function getIncrementalOutput()
  42790. {
  42791. $this->readPipesForOutput(__FUNCTION__);
  42792. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  42793. $this->incrementalOutputOffset = ftell($this->stdout);
  42794. if (false === $latest) {
  42795. return '';
  42796. }
  42797. return $latest;
  42798. }
  42799. public function clearOutput()
  42800. {
  42801. ftruncate($this->stdout, 0);
  42802. fseek($this->stdout, 0);
  42803. $this->incrementalOutputOffset = 0;
  42804. return $this;
  42805. }
  42806. public function getErrorOutput()
  42807. {
  42808. $this->readPipesForOutput(__FUNCTION__);
  42809. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  42810. return '';
  42811. }
  42812. return $ret;
  42813. }
  42814. public function getIncrementalErrorOutput()
  42815. {
  42816. $this->readPipesForOutput(__FUNCTION__);
  42817. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  42818. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  42819. if (false === $latest) {
  42820. return '';
  42821. }
  42822. return $latest;
  42823. }
  42824. public function clearErrorOutput()
  42825. {
  42826. ftruncate($this->stderr, 0);
  42827. fseek($this->stderr, 0);
  42828. $this->incrementalErrorOutputOffset = 0;
  42829. return $this;
  42830. }
  42831. public function getExitCode()
  42832. {
  42833. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  42834. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  42835. }
  42836. $this->updateStatus(false);
  42837. return $this->exitcode;
  42838. }
  42839. public function getExitCodeText()
  42840. {
  42841. if (null === $exitcode = $this->getExitCode()) {
  42842. return;
  42843. }
  42844. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  42845. }
  42846. public function isSuccessful()
  42847. {
  42848. return 0 === $this->getExitCode();
  42849. }
  42850. public function hasBeenSignaled()
  42851. {
  42852. $this->requireProcessIsTerminated(__FUNCTION__);
  42853. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  42854. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  42855. }
  42856. return $this->processInformation['signaled'];
  42857. }
  42858. public function getTermSignal()
  42859. {
  42860. $this->requireProcessIsTerminated(__FUNCTION__);
  42861. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  42862. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  42863. }
  42864. return $this->processInformation['termsig'];
  42865. }
  42866. public function hasBeenStopped()
  42867. {
  42868. $this->requireProcessIsTerminated(__FUNCTION__);
  42869. return $this->processInformation['stopped'];
  42870. }
  42871. public function getStopSignal()
  42872. {
  42873. $this->requireProcessIsTerminated(__FUNCTION__);
  42874. return $this->processInformation['stopsig'];
  42875. }
  42876. public function isRunning()
  42877. {
  42878. if (self::STATUS_STARTED !== $this->status) {
  42879. return false;
  42880. }
  42881. $this->updateStatus(false);
  42882. return $this->processInformation['running'];
  42883. }
  42884. public function isStarted()
  42885. {
  42886. return $this->status != self::STATUS_READY;
  42887. }
  42888. public function isTerminated()
  42889. {
  42890. $this->updateStatus(false);
  42891. return $this->status == self::STATUS_TERMINATED;
  42892. }
  42893. public function getStatus()
  42894. {
  42895. $this->updateStatus(false);
  42896. return $this->status;
  42897. }
  42898. public function stop($timeout = 10, $signal = null)
  42899. {
  42900. $timeoutMicro = microtime(true) + $timeout;
  42901. if ($this->isRunning()) {
  42902. $this->doSignal(15, false);
  42903. do {
  42904. usleep(1000);
  42905. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  42906. if ($this->isRunning()) {
  42907. $this->doSignal($signal ?: 9, false);
  42908. }
  42909. }
  42910. if ($this->isRunning()) {
  42911. if (isset($this->fallbackStatus['pid'])) {
  42912. unset($this->fallbackStatus['pid']);
  42913. return $this->stop(0, $signal);
  42914. }
  42915. $this->close();
  42916. }
  42917. return $this->exitcode;
  42918. }
  42919. public function addOutput($line)
  42920. {
  42921. $this->lastOutputTime = microtime(true);
  42922. fseek($this->stdout, 0, SEEK_END);
  42923. fwrite($this->stdout, $line);
  42924. fseek($this->stdout, $this->incrementalOutputOffset);
  42925. }
  42926. public function addErrorOutput($line)
  42927. {
  42928. $this->lastOutputTime = microtime(true);
  42929. fseek($this->stderr, 0, SEEK_END);
  42930. fwrite($this->stderr, $line);
  42931. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  42932. }
  42933. public function getCommandLine()
  42934. {
  42935. return $this->commandline;
  42936. }
  42937. public function setCommandLine($commandline)
  42938. {
  42939. $this->commandline = $commandline;
  42940. return $this;
  42941. }
  42942. public function getTimeout()
  42943. {
  42944. return $this->timeout;
  42945. }
  42946. public function getIdleTimeout()
  42947. {
  42948. return $this->idleTimeout;
  42949. }
  42950. public function setTimeout($timeout)
  42951. {
  42952. $this->timeout = $this->validateTimeout($timeout);
  42953. return $this;
  42954. }
  42955. public function setIdleTimeout($timeout)
  42956. {
  42957. if (null !== $timeout && $this->outputDisabled) {
  42958. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  42959. }
  42960. $this->idleTimeout = $this->validateTimeout($timeout);
  42961. return $this;
  42962. }
  42963. public function setTty($tty)
  42964. {
  42965. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  42966. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  42967. }
  42968. if ($tty) {
  42969. static $isTtySupported;
  42970. if (null === $isTtySupported) {
  42971. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  42972. }
  42973. if (!$isTtySupported) {
  42974. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  42975. }
  42976. }
  42977. $this->tty = (bool) $tty;
  42978. return $this;
  42979. }
  42980. public function isTty()
  42981. {
  42982. return $this->tty;
  42983. }
  42984. public function setPty($bool)
  42985. {
  42986. $this->pty = (bool) $bool;
  42987. return $this;
  42988. }
  42989. public function isPty()
  42990. {
  42991. return $this->pty;
  42992. }
  42993. public function getWorkingDirectory()
  42994. {
  42995. if (null === $this->cwd) {
  42996. return getcwd() ?: null;
  42997. }
  42998. return $this->cwd;
  42999. }
  43000. public function setWorkingDirectory($cwd)
  43001. {
  43002. $this->cwd = $cwd;
  43003. return $this;
  43004. }
  43005. public function getEnv()
  43006. {
  43007. return $this->env;
  43008. }
  43009. public function setEnv(array $env)
  43010. {
  43011. $env = array_filter($env, function ($value) {
  43012. return !is_array($value);
  43013. });
  43014. $this->env = array();
  43015. foreach ($env as $key => $value) {
  43016. $this->env[$key] = (string) $value;
  43017. }
  43018. return $this;
  43019. }
  43020. public function getStdin()
  43021. {
  43022. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  43023. return $this->getInput();
  43024. }
  43025. public function getInput()
  43026. {
  43027. return $this->input;
  43028. }
  43029. public function setStdin($stdin)
  43030. {
  43031. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  43032. return $this->setInput($stdin);
  43033. }
  43034. public function setInput($input)
  43035. {
  43036. if ($this->isRunning()) {
  43037. throw new LogicException('Input can not be set while the process is running.');
  43038. }
  43039. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  43040. return $this;
  43041. }
  43042. public function getOptions()
  43043. {
  43044. return $this->options;
  43045. }
  43046. public function setOptions(array $options)
  43047. {
  43048. $this->options = $options;
  43049. return $this;
  43050. }
  43051. public function getEnhanceWindowsCompatibility()
  43052. {
  43053. return $this->enhanceWindowsCompatibility;
  43054. }
  43055. public function setEnhanceWindowsCompatibility($enhance)
  43056. {
  43057. $this->enhanceWindowsCompatibility = (bool) $enhance;
  43058. return $this;
  43059. }
  43060. public function getEnhanceSigchildCompatibility()
  43061. {
  43062. return $this->enhanceSigchildCompatibility;
  43063. }
  43064. public function setEnhanceSigchildCompatibility($enhance)
  43065. {
  43066. $this->enhanceSigchildCompatibility = (bool) $enhance;
  43067. return $this;
  43068. }
  43069. public function checkTimeout()
  43070. {
  43071. if ($this->status !== self::STATUS_STARTED) {
  43072. return;
  43073. }
  43074. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  43075. $this->stop(0);
  43076. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  43077. }
  43078. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  43079. $this->stop(0);
  43080. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  43081. }
  43082. }
  43083. public static function isPtySupported()
  43084. {
  43085. static $result;
  43086. if (null !== $result) {
  43087. return $result;
  43088. }
  43089. if ('\\' === DIRECTORY_SEPARATOR) {
  43090. return $result = false;
  43091. }
  43092. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  43093. }
  43094. private function getDescriptors()
  43095. {
  43096. if ('\\' === DIRECTORY_SEPARATOR) {
  43097. $this->processPipes = WindowsPipes::create($this, $this->input);
  43098. } else {
  43099. $this->processPipes = UnixPipes::create($this, $this->input);
  43100. }
  43101. return $this->processPipes->getDescriptors();
  43102. }
  43103. protected function buildCallback($callback)
  43104. {
  43105. $that = $this;
  43106. $out = self::OUT;
  43107. $callback = function ($type, $data) use ($that, $callback, $out) {
  43108. if ($out == $type) {
  43109. $that->addOutput($data);
  43110. } else {
  43111. $that->addErrorOutput($data);
  43112. }
  43113. if (null !== $callback) {
  43114. call_user_func($callback, $type, $data);
  43115. }
  43116. };
  43117. return $callback;
  43118. }
  43119. protected function updateStatus($blocking)
  43120. {
  43121. if (self::STATUS_STARTED !== $this->status) {
  43122. return;
  43123. }
  43124. $this->processInformation = proc_get_status($this->process);
  43125. $running = $this->processInformation['running'];
  43126. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  43127. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43128. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  43129. }
  43130. if (!$running) {
  43131. $this->close();
  43132. }
  43133. }
  43134. protected function isSigchildEnabled()
  43135. {
  43136. if (null !== self::$sigchild) {
  43137. return self::$sigchild;
  43138. }
  43139. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  43140. return self::$sigchild = false;
  43141. }
  43142. ob_start();
  43143. phpinfo(INFO_GENERAL);
  43144. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  43145. }
  43146. private function readPipesForOutput($caller)
  43147. {
  43148. if ($this->outputDisabled) {
  43149. throw new LogicException('Output has been disabled.');
  43150. }
  43151. $this->requireProcessIsStarted($caller);
  43152. $this->updateStatus(false);
  43153. }
  43154. private function validateTimeout($timeout)
  43155. {
  43156. $timeout = (float) $timeout;
  43157. if (0.0 === $timeout) {
  43158. $timeout = null;
  43159. } elseif ($timeout < 0) {
  43160. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  43161. }
  43162. return $timeout;
  43163. }
  43164. private function readPipes($blocking, $close)
  43165. {
  43166. $result = $this->processPipes->readAndWrite($blocking, $close);
  43167. $callback = $this->callback;
  43168. foreach ($result as $type => $data) {
  43169. if (3 !== $type) {
  43170. $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
  43171. } elseif (!isset($this->fallbackStatus['signaled'])) {
  43172. $this->fallbackStatus['exitcode'] = (int) $data;
  43173. }
  43174. }
  43175. }
  43176. private function close()
  43177. {
  43178. $this->processPipes->close();
  43179. if (is_resource($this->process)) {
  43180. proc_close($this->process);
  43181. }
  43182. $this->exitcode = $this->processInformation['exitcode'];
  43183. $this->status = self::STATUS_TERMINATED;
  43184. if (-1 === $this->exitcode) {
  43185. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  43186. $this->exitcode = 128 + $this->processInformation['termsig'];
  43187. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43188. $this->processInformation['signaled'] = true;
  43189. $this->processInformation['termsig'] = -1;
  43190. }
  43191. }
  43192. $this->callback = null;
  43193. return $this->exitcode;
  43194. }
  43195. private function resetProcessData()
  43196. {
  43197. $this->starttime = null;
  43198. $this->callback = null;
  43199. $this->exitcode = null;
  43200. $this->fallbackStatus = array();
  43201. $this->processInformation = null;
  43202. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  43203. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  43204. $this->process = null;
  43205. $this->latestSignal = null;
  43206. $this->status = self::STATUS_READY;
  43207. $this->incrementalOutputOffset = 0;
  43208. $this->incrementalErrorOutputOffset = 0;
  43209. }
  43210. private function doSignal($signal, $throwException)
  43211. {
  43212. if (null === $pid = $this->getPid()) {
  43213. if ($throwException) {
  43214. throw new LogicException('Can not send signal on a non running process.');
  43215. }
  43216. return false;
  43217. }
  43218. if ('\\' === DIRECTORY_SEPARATOR) {
  43219. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  43220. if ($exitCode && $this->isRunning()) {
  43221. if ($throwException) {
  43222. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  43223. }
  43224. return false;
  43225. }
  43226. } else {
  43227. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  43228. $ok = @proc_terminate($this->process, $signal);
  43229. } elseif (function_exists('posix_kill')) {
  43230. $ok = @posix_kill($pid, $signal);
  43231. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  43232. $ok = false === fgets($pipes[2]);
  43233. }
  43234. if (!$ok) {
  43235. if ($throwException) {
  43236. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  43237. }
  43238. return false;
  43239. }
  43240. }
  43241. $this->latestSignal = (int) $signal;
  43242. $this->fallbackStatus['signaled'] = true;
  43243. $this->fallbackStatus['exitcode'] = -1;
  43244. $this->fallbackStatus['termsig'] = $this->latestSignal;
  43245. return true;
  43246. }
  43247. private function requireProcessIsStarted($functionName)
  43248. {
  43249. if (!$this->isStarted()) {
  43250. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  43251. }
  43252. }
  43253. private function requireProcessIsTerminated($functionName)
  43254. {
  43255. if (!$this->isTerminated()) {
  43256. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  43257. }
  43258. }
  43259. }
  43260. <?php
  43261. namespace Symfony\Component\Process;
  43262. use Symfony\Component\Process\Exception\InvalidArgumentException;
  43263. use Symfony\Component\Process\Exception\LogicException;
  43264. class ProcessBuilder
  43265. {
  43266. private $arguments;
  43267. private $cwd;
  43268. private $env = array();
  43269. private $input;
  43270. private $timeout = 60;
  43271. private $options = array();
  43272. private $inheritEnv = true;
  43273. private $prefix = array();
  43274. private $outputDisabled = false;
  43275. public function __construct(array $arguments = array())
  43276. {
  43277. $this->arguments = $arguments;
  43278. }
  43279. public static function create(array $arguments = array())
  43280. {
  43281. return new static($arguments);
  43282. }
  43283. public function add($argument)
  43284. {
  43285. $this->arguments[] = $argument;
  43286. return $this;
  43287. }
  43288. public function setPrefix($prefix)
  43289. {
  43290. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  43291. return $this;
  43292. }
  43293. public function setArguments(array $arguments)
  43294. {
  43295. $this->arguments = $arguments;
  43296. return $this;
  43297. }
  43298. public function setWorkingDirectory($cwd)
  43299. {
  43300. $this->cwd = $cwd;
  43301. return $this;
  43302. }
  43303. public function inheritEnvironmentVariables($inheritEnv = true)
  43304. {
  43305. $this->inheritEnv = $inheritEnv;
  43306. return $this;
  43307. }
  43308. public function setEnv($name, $value)
  43309. {
  43310. $this->env[$name] = $value;
  43311. return $this;
  43312. }
  43313. public function addEnvironmentVariables(array $variables)
  43314. {
  43315. $this->env = array_replace($this->env, $variables);
  43316. return $this;
  43317. }
  43318. public function setInput($input)
  43319. {
  43320. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  43321. return $this;
  43322. }
  43323. public function setTimeout($timeout)
  43324. {
  43325. if (null === $timeout) {
  43326. $this->timeout = null;
  43327. return $this;
  43328. }
  43329. $timeout = (float) $timeout;
  43330. if ($timeout < 0) {
  43331. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  43332. }
  43333. $this->timeout = $timeout;
  43334. return $this;
  43335. }
  43336. public function setOption($name, $value)
  43337. {
  43338. $this->options[$name] = $value;
  43339. return $this;
  43340. }
  43341. public function disableOutput()
  43342. {
  43343. $this->outputDisabled = true;
  43344. return $this;
  43345. }
  43346. public function enableOutput()
  43347. {
  43348. $this->outputDisabled = false;
  43349. return $this;
  43350. }
  43351. public function getProcess()
  43352. {
  43353. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  43354. throw new LogicException('You must add() command arguments before calling getProcess().');
  43355. }
  43356. $options = $this->options;
  43357. $arguments = array_merge($this->prefix, $this->arguments);
  43358. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  43359. if ($this->inheritEnv) {
  43360. $env = array_replace($_ENV, $_SERVER, $this->env);
  43361. } else {
  43362. $env = $this->env;
  43363. }
  43364. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  43365. if ($this->outputDisabled) {
  43366. $process->disableOutput();
  43367. }
  43368. return $process;
  43369. }
  43370. }
  43371. <?php
  43372. namespace Symfony\Component\Process;
  43373. use Symfony\Component\Process\Exception\InvalidArgumentException;
  43374. class ProcessUtils
  43375. {
  43376. private function __construct()
  43377. {
  43378. }
  43379. public static function escapeArgument($argument)
  43380. {
  43381. if ('\\' === DIRECTORY_SEPARATOR) {
  43382. if ('' === $argument) {
  43383. return escapeshellarg($argument);
  43384. }
  43385. $escapedArgument = '';
  43386. $quote = false;
  43387. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  43388. if ('"' === $part) {
  43389. $escapedArgument .= '\\"';
  43390. } elseif (self::isSurroundedBy($part, '%')) {
  43391. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  43392. } else {
  43393. if ('\\' === substr($part, -1)) {
  43394. $part .= '\\';
  43395. }
  43396. $quote = true;
  43397. $escapedArgument .= $part;
  43398. }
  43399. }
  43400. if ($quote) {
  43401. $escapedArgument = '"'.$escapedArgument.'"';
  43402. }
  43403. return $escapedArgument;
  43404. }
  43405. return escapeshellarg($argument);
  43406. }
  43407. public static function validateInput($caller, $input)
  43408. {
  43409. if (null !== $input) {
  43410. if (is_resource($input)) {
  43411. return $input;
  43412. }
  43413. if (is_string($input)) {
  43414. return $input;
  43415. }
  43416. if (is_scalar($input)) {
  43417. return (string) $input;
  43418. }
  43419. if (is_object($input) && method_exists($input, '__toString')) {
  43420. @trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  43421. return (string) $input;
  43422. }
  43423. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  43424. }
  43425. return $input;
  43426. }
  43427. private static function isSurroundedBy($arg, $char)
  43428. {
  43429. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  43430. }
  43431. }
  43432. Copyright (c) 2011 Jordi Boggiano
  43433. Permission is hereby granted, free of charge, to any person obtaining a copy
  43434. of this software and associated documentation files (the "Software"), to deal
  43435. in the Software without restriction, including without limitation the rights
  43436. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43437. copies of the Software, and to permit persons to whom the Software is furnished
  43438. to do so, subject to the following conditions:
  43439. The above copyright notice and this permission notice shall be included in all
  43440. copies or substantial portions of the Software.
  43441. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43442. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43443. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43444. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43445. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43446. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43447. THE SOFTWARE.
  43448. <?php
  43449. namespace Seld\JsonLint;
  43450. class DuplicateKeyException extends ParsingException
  43451. {
  43452. public function __construct($message, $key, array $details = array())
  43453. {
  43454. $details['key'] = $key;
  43455. parent::__construct($message, $details);
  43456. }
  43457. public function getKey()
  43458. {
  43459. return $this->details['key'];
  43460. }
  43461. }
  43462. <?php
  43463. namespace Seld\JsonLint;
  43464. use stdClass;
  43465. class JsonParser
  43466. {
  43467. const DETECT_KEY_CONFLICTS = 1;
  43468. const ALLOW_DUPLICATE_KEYS = 2;
  43469. const PARSE_TO_ASSOC = 4;
  43470. private $lexer;
  43471. private $flags;
  43472. private $stack;
  43473. private $vstack;
  43474. private $lstack;
  43475. private $symbols = array(
  43476. 'error' => 2,
  43477. 'JSONString' => 3,
  43478. 'STRING' => 4,
  43479. 'JSONNumber' => 5,
  43480. 'NUMBER' => 6,
  43481. 'JSONNullLiteral' => 7,
  43482. 'NULL' => 8,
  43483. 'JSONBooleanLiteral' => 9,
  43484. 'TRUE' => 10,
  43485. 'FALSE' => 11,
  43486. 'JSONText' => 12,
  43487. 'JSONValue' => 13,
  43488. 'EOF' => 14,
  43489. 'JSONObject' => 15,
  43490. 'JSONArray' => 16,
  43491. '{' => 17,
  43492. '}' => 18,
  43493. 'JSONMemberList' => 19,
  43494. 'JSONMember' => 20,
  43495. ':' => 21,
  43496. ',' => 22,
  43497. '[' => 23,
  43498. ']' => 24,
  43499. 'JSONElementList' => 25,
  43500. '$accept' => 0,
  43501. '$end' => 1,
  43502. );
  43503. private $terminals_ = array(
  43504. 2 => "error",
  43505. 4 => "STRING",
  43506. 6 => "NUMBER",
  43507. 8 => "NULL",
  43508. 10 => "TRUE",
  43509. 11 => "FALSE",
  43510. 14 => "EOF",
  43511. 17 => "{",
  43512. 18 => "}",
  43513. 21 => ":",
  43514. 22 => ",",
  43515. 23 => "[",
  43516. 24 => "]",
  43517. );
  43518. private $productions_ = array(
  43519. 0,
  43520. array(3, 1),
  43521. array(5, 1),
  43522. array(7, 1),
  43523. array(9, 1),
  43524. array(9, 1),
  43525. array(12, 2),
  43526. array(13, 1),
  43527. array(13, 1),
  43528. array(13, 1),
  43529. array(13, 1),
  43530. array(13, 1),
  43531. array(13, 1),
  43532. array(15, 2),
  43533. array(15, 3),
  43534. array(20, 3),
  43535. array(19, 1),
  43536. array(19, 3),
  43537. array(16, 2),
  43538. array(16, 3),
  43539. array(25, 1),
  43540. array(25, 3)
  43541. );
  43542. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  43543. );
  43544. private $defaultActions = array(
  43545. 16 => array(2, 6)
  43546. );
  43547. public function lint($input)
  43548. {
  43549. try {
  43550. $this->parse($input);
  43551. } catch (ParsingException $e) {
  43552. return $e;
  43553. }
  43554. }
  43555. public function parse($input, $flags = 0)
  43556. {
  43557. $this->failOnBOM($input);
  43558. $this->flags = $flags;
  43559. $this->stack = array(0);
  43560. $this->vstack = array(null);
  43561. $this->lstack = array();
  43562. $yytext = '';
  43563. $yylineno = 0;
  43564. $yyleng = 0;
  43565. $recovering = 0;
  43566. $TERROR = 2;
  43567. $EOF = 1;
  43568. $this->lexer = new Lexer();
  43569. $this->lexer->setInput($input);
  43570. $yyloc = $this->lexer->yylloc;
  43571. $this->lstack[] = $yyloc;
  43572. $symbol = null;
  43573. $preErrorSymbol = null;
  43574. $state = null;
  43575. $action = null;
  43576. $a = null;
  43577. $r = null;
  43578. $yyval = new stdClass;
  43579. $p = null;
  43580. $len = null;
  43581. $newState = null;
  43582. $expected = null;
  43583. $errStr = null;
  43584. while (true) {
  43585. $state = $this->stack[count($this->stack)-1];
  43586. if (isset($this->defaultActions[$state])) {
  43587. $action = $this->defaultActions[$state];
  43588. } else {
  43589. if ($symbol == null) {
  43590. $symbol = $this->lex();
  43591. }
  43592. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  43593. }
  43594. if (!$action || !$action[0]) {
  43595. if (!$recovering) {
  43596. $expected = array();
  43597. foreach ($this->table[$state] as $p => $ignore) {
  43598. if (isset($this->terminals_[$p]) && $p > 2) {
  43599. $expected[] = "'" . $this->terminals_[$p] . "'";
  43600. }
  43601. }
  43602. $message = null;
  43603. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  43604. $message = "Invalid string";
  43605. if ("'" === substr($this->lexer->match, 0, 1)) {
  43606. $message .= ", it appears you used single quotes instead of double quotes";
  43607. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  43608. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  43609. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  43610. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  43611. }
  43612. }
  43613. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  43614. $errStr .= $this->lexer->showPosition() . "\n";
  43615. if ($message) {
  43616. $errStr .= $message;
  43617. } else {
  43618. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  43619. $errStr .= implode(', ', $expected);
  43620. }
  43621. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  43622. $errStr .= " - It appears you have an extra trailing comma";
  43623. }
  43624. $this->parseError($errStr, array(
  43625. 'text' => $this->lexer->match,
  43626. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  43627. 'line' => $this->lexer->yylineno,
  43628. 'loc' => $yyloc,
  43629. 'expected' => $expected,
  43630. ));
  43631. }
  43632. if ($recovering == 3) {
  43633. if ($symbol == $EOF) {
  43634. throw new ParsingException($errStr ?: 'Parsing halted.');
  43635. }
  43636. $yyleng = $this->lexer->yyleng;
  43637. $yytext = $this->lexer->yytext;
  43638. $yylineno = $this->lexer->yylineno;
  43639. $yyloc = $this->lexer->yylloc;
  43640. $symbol = $this->lex();
  43641. }
  43642. while (true) {
  43643. if (array_key_exists($TERROR, $this->table[$state])) {
  43644. break;
  43645. }
  43646. if ($state == 0) {
  43647. throw new ParsingException($errStr ?: 'Parsing halted.');
  43648. }
  43649. $this->popStack(1);
  43650. $state = $this->stack[count($this->stack)-1];
  43651. }
  43652. $preErrorSymbol = $symbol;
  43653. $symbol = $TERROR;
  43654. $state = $this->stack[count($this->stack)-1];
  43655. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  43656. $recovering = 3;
  43657. }
  43658. if (is_array($action[0]) && count($action) > 1) {
  43659. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  43660. }
  43661. switch ($action[0]) {
  43662. case 1:
  43663. $this->stack[] = $symbol;
  43664. $this->vstack[] = $this->lexer->yytext;
  43665. $this->lstack[] = $this->lexer->yylloc;
  43666. $this->stack[] = $action[1];
  43667. $symbol = null;
  43668. if (!$preErrorSymbol) {
  43669. $yyleng = $this->lexer->yyleng;
  43670. $yytext = $this->lexer->yytext;
  43671. $yylineno = $this->lexer->yylineno;
  43672. $yyloc = $this->lexer->yylloc;
  43673. if ($recovering > 0) {
  43674. $recovering--;
  43675. }
  43676. } else {
  43677. $symbol = $preErrorSymbol;
  43678. $preErrorSymbol = null;
  43679. }
  43680. break;
  43681. case 2:
  43682. $len = $this->productions_[$action[1]][1];
  43683. $yyval->token = $this->vstack[count($this->vstack) - $len];
  43684. $yyval->store = array(
  43685. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  43686. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  43687. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  43688. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  43689. );
  43690. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  43691. if (!$r instanceof Undefined) {
  43692. return $r;
  43693. }
  43694. if ($len) {
  43695. $this->popStack($len);
  43696. }
  43697. $this->stack[] = $this->productions_[$action[1]][0];
  43698. $this->vstack[] = $yyval->token;
  43699. $this->lstack[] = $yyval->store;
  43700. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  43701. $this->stack[] = $newState;
  43702. break;
  43703. case 3:
  43704. return true;
  43705. }
  43706. }
  43707. return true;
  43708. }
  43709. protected function parseError($str, $hash)
  43710. {
  43711. throw new ParsingException($str, $hash);
  43712. }
  43713. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  43714. {
  43715. $len = count($tokens) - 1;
  43716. switch ($yystate) {
  43717. case 1:
  43718. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  43719. $yyval->token = $yytext;
  43720. break;
  43721. case 2:
  43722. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  43723. $yyval->token = floatval($yytext);
  43724. } else {
  43725. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  43726. }
  43727. break;
  43728. case 3:
  43729. $yyval->token = null;
  43730. break;
  43731. case 4:
  43732. $yyval->token = true;
  43733. break;
  43734. case 5:
  43735. $yyval->token = false;
  43736. break;
  43737. case 6:
  43738. return $yyval->token = $tokens[$len-1];
  43739. case 13:
  43740. if ($this->flags & self::PARSE_TO_ASSOC) {
  43741. $yyval->token = array();
  43742. } else {
  43743. $yyval->token = new stdClass;
  43744. }
  43745. break;
  43746. case 14:
  43747. $yyval->token = $tokens[$len-1];
  43748. break;
  43749. case 15:
  43750. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  43751. break;
  43752. case 16:
  43753. if (PHP_VERSION_ID < 70100) {
  43754. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  43755. } else {
  43756. $property = $tokens[$len][0];
  43757. }
  43758. if ($this->flags & self::PARSE_TO_ASSOC) {
  43759. $yyval->token = array();
  43760. $yyval->token[$property] = $tokens[$len][1];
  43761. } else {
  43762. $yyval->token = new stdClass;
  43763. $yyval->token->$property = $tokens[$len][1];
  43764. }
  43765. break;
  43766. case 17:
  43767. if ($this->flags & self::PARSE_TO_ASSOC) {
  43768. $yyval->token =& $tokens[$len-2];
  43769. $key = $tokens[$len][0];
  43770. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  43771. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  43772. $errStr .= $this->lexer->showPosition() . "\n";
  43773. $errStr .= "Duplicate key: ".$tokens[$len][0];
  43774. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  43775. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  43776. $duplicateCount = 1;
  43777. do {
  43778. $duplicateKey = $key . '.' . $duplicateCount++;
  43779. } while (isset($tokens[$len-2][$duplicateKey]));
  43780. $key = $duplicateKey;
  43781. }
  43782. $tokens[$len-2][$key] = $tokens[$len][1];
  43783. } else {
  43784. $yyval->token = $tokens[$len-2];
  43785. if (PHP_VERSION_ID < 70100) {
  43786. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  43787. } else {
  43788. $key = $tokens[$len][0];
  43789. }
  43790. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  43791. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  43792. $errStr .= $this->lexer->showPosition() . "\n";
  43793. $errStr .= "Duplicate key: ".$tokens[$len][0];
  43794. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  43795. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  43796. $duplicateCount = 1;
  43797. do {
  43798. $duplicateKey = $key . '.' . $duplicateCount++;
  43799. } while (isset($tokens[$len-2]->$duplicateKey));
  43800. $key = $duplicateKey;
  43801. }
  43802. $tokens[$len-2]->$key = $tokens[$len][1];
  43803. }
  43804. break;
  43805. case 18:
  43806. $yyval->token = array();
  43807. break;
  43808. case 19:
  43809. $yyval->token = $tokens[$len-1];
  43810. break;
  43811. case 20:
  43812. $yyval->token = array($tokens[$len]);
  43813. break;
  43814. case 21:
  43815. $tokens[$len-2][] = $tokens[$len];
  43816. $yyval->token = $tokens[$len-2];
  43817. break;
  43818. }
  43819. return new Undefined();
  43820. }
  43821. private function stringInterpolation($match)
  43822. {
  43823. switch ($match[0]) {
  43824. case '\\\\':
  43825. return '\\';
  43826. case '\"':
  43827. return '"';
  43828. case '\b':
  43829. return chr(8);
  43830. case '\f':
  43831. return chr(12);
  43832. case '\n':
  43833. return "\n";
  43834. case '\r':
  43835. return "\r";
  43836. case '\t':
  43837. return "\t";
  43838. case '\/':
  43839. return "/";
  43840. default:
  43841. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  43842. }
  43843. }
  43844. private function popStack($n)
  43845. {
  43846. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  43847. $this->vstack = array_slice($this->vstack, 0, - $n);
  43848. $this->lstack = array_slice($this->lstack, 0, - $n);
  43849. }
  43850. private function lex()
  43851. {
  43852. $token = $this->lexer->lex() ?: 1;
  43853. if (!is_numeric($token)) {
  43854. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  43855. }
  43856. return $token;
  43857. }
  43858. private function failOnBOM($input)
  43859. {
  43860. $bom = "\xEF\xBB\xBF";
  43861. if (substr($input, 0, 3) === $bom) {
  43862. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  43863. }
  43864. }
  43865. }
  43866. <?php
  43867. namespace Seld\JsonLint;
  43868. class Lexer
  43869. {
  43870. private $EOF = 1;
  43871. private $rules = array(
  43872. 0 => '/^\s+/',
  43873. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  43874. 2 => '{^"(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x09\x0a-\x1f\\\\"]+)*"}',
  43875. 3 => '/^\{/',
  43876. 4 => '/^\}/',
  43877. 5 => '/^\[/',
  43878. 6 => '/^\]/',
  43879. 7 => '/^,/',
  43880. 8 => '/^:/',
  43881. 9 => '/^true\b/',
  43882. 10 => '/^false\b/',
  43883. 11 => '/^null\b/',
  43884. 12 => '/^$/',
  43885. 13 => '/^./',
  43886. );
  43887. private $conditions = array(
  43888. "INITIAL" => array(
  43889. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  43890. "inclusive" => true,
  43891. ),
  43892. );
  43893. private $conditionStack;
  43894. private $input;
  43895. private $more;
  43896. private $done;
  43897. private $matched;
  43898. public $match;
  43899. public $yylineno;
  43900. public $yyleng;
  43901. public $yytext;
  43902. public $yylloc;
  43903. public function lex()
  43904. {
  43905. $r = $this->next();
  43906. if (!$r instanceof Undefined) {
  43907. return $r;
  43908. }
  43909. return $this->lex();
  43910. }
  43911. public function setInput($input)
  43912. {
  43913. $this->input = $input;
  43914. $this->more = false;
  43915. $this->done = false;
  43916. $this->yylineno = $this->yyleng = 0;
  43917. $this->yytext = $this->matched = $this->match = '';
  43918. $this->conditionStack = array('INITIAL');
  43919. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  43920. return $this;
  43921. }
  43922. public function showPosition()
  43923. {
  43924. $pre = str_replace("\n", '', $this->getPastInput());
  43925. $c = str_repeat('-', max(0, strlen($pre) - 1));
  43926. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  43927. }
  43928. public function getPastInput()
  43929. {
  43930. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  43931. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  43932. }
  43933. public function getUpcomingInput()
  43934. {
  43935. $next = $this->match;
  43936. if (strlen($next) < 20) {
  43937. $next .= substr($this->input, 0, 20 - strlen($next));
  43938. }
  43939. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  43940. }
  43941. protected function parseError($str, $hash)
  43942. {
  43943. throw new \Exception($str);
  43944. }
  43945. private function next()
  43946. {
  43947. if ($this->done) {
  43948. return $this->EOF;
  43949. }
  43950. if (!$this->input) {
  43951. $this->done = true;
  43952. }
  43953. $token = null;
  43954. $match = null;
  43955. $col = null;
  43956. $lines = null;
  43957. if (!$this->more) {
  43958. $this->yytext = '';
  43959. $this->match = '';
  43960. }
  43961. $rules = $this->getCurrentRules();
  43962. $rulesLen = count($rules);
  43963. for ($i=0; $i < $rulesLen; $i++) {
  43964. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  43965. preg_match_all('/\n.*/', $match[0], $lines);
  43966. $lines = $lines[0];
  43967. if ($lines) {
  43968. $this->yylineno += count($lines);
  43969. }
  43970. $this->yylloc = array(
  43971. 'first_line' => $this->yylloc['last_line'],
  43972. 'last_line' => $this->yylineno+1,
  43973. 'first_column' => $this->yylloc['last_column'],
  43974. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  43975. );
  43976. $this->yytext .= $match[0];
  43977. $this->match .= $match[0];
  43978. $this->yyleng = strlen($this->yytext);
  43979. $this->more = false;
  43980. $this->input = substr($this->input, strlen($match[0]));
  43981. $this->matched .= $match[0];
  43982. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  43983. if ($token) {
  43984. return $token;
  43985. }
  43986. return new Undefined();
  43987. }
  43988. }
  43989. if ($this->input === "") {
  43990. return $this->EOF;
  43991. }
  43992. $this->parseError(
  43993. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  43994. array(
  43995. 'text' => "",
  43996. 'token' => null,
  43997. 'line' => $this->yylineno,
  43998. )
  43999. );
  44000. }
  44001. private function getCurrentRules()
  44002. {
  44003. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  44004. }
  44005. private function performAction($avoiding_name_collisions, $YY_START)
  44006. {
  44007. switch ($avoiding_name_collisions) {
  44008. case 0:
  44009. break;
  44010. case 1:
  44011. return 6;
  44012. break;
  44013. case 2:
  44014. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  44015. return 4;
  44016. case 3:
  44017. return 17;
  44018. case 4:
  44019. return 18;
  44020. case 5:
  44021. return 23;
  44022. case 6:
  44023. return 24;
  44024. case 7:
  44025. return 22;
  44026. case 8:
  44027. return 21;
  44028. case 9:
  44029. return 10;
  44030. case 10:
  44031. return 11;
  44032. case 11:
  44033. return 8;
  44034. case 12:
  44035. return 14;
  44036. case 13:
  44037. return 'INVALID';
  44038. }
  44039. }
  44040. }
  44041. <?php
  44042. namespace Seld\JsonLint;
  44043. class ParsingException extends \Exception
  44044. {
  44045. protected $details;
  44046. public function __construct($message, $details = array())
  44047. {
  44048. $this->details = $details;
  44049. parent::__construct($message);
  44050. }
  44051. public function getDetails()
  44052. {
  44053. return $this->details;
  44054. }
  44055. }
  44056. <?php
  44057. namespace Seld\JsonLint;
  44058. class Undefined
  44059. {
  44060. }
  44061. Copyright (c) 2015 Jordi Boggiano
  44062. Permission is hereby granted, free of charge, to any person obtaining a copy
  44063. of this software and associated documentation files (the "Software"), to deal
  44064. in the Software without restriction, including without limitation the rights
  44065. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44066. copies of the Software, and to permit persons to whom the Software is furnished
  44067. to do so, subject to the following conditions:
  44068. The above copyright notice and this permission notice shall be included in all
  44069. copies or substantial portions of the Software.
  44070. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44071. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44072. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44073. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44074. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44075. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44076. THE SOFTWARE.
  44077. <?php
  44078. require __DIR__.'/../vendor/autoload.php';
  44079. echo 'Say hello (visible): ';
  44080. $answer = Seld\CliPrompt\CliPrompt::prompt();
  44081. echo 'You answered: '.$answer . PHP_EOL;
  44082. echo 'Say hello (hidden): ';
  44083. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  44084. echo 'You answered: '.$answer . PHP_EOL;
  44085. <?php
  44086. namespace Seld\CliPrompt;
  44087. class CliPrompt
  44088. {
  44089. public static function prompt()
  44090. {
  44091. $stdin = fopen('php://stdin', 'r');
  44092. $answer = self::trimAnswer(fgets($stdin, 4096));
  44093. fclose($stdin);
  44094. return $answer;
  44095. }
  44096. public static function hiddenPrompt($allowFallback = false)
  44097. {
  44098. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  44099. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  44100. if ('phar:' === substr(__FILE__, 0, 5)) {
  44101. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  44102. $source = fopen($exe, 'r');
  44103. $target = fopen($tmpExe, 'w+');
  44104. stream_copy_to_stream($source, $target);
  44105. fclose($source);
  44106. fclose($target);
  44107. unset($source, $target);
  44108. $exe = $tmpExe;
  44109. }
  44110. $answer = self::trimAnswer(shell_exec($exe));
  44111. if (isset($tmpExe)) {
  44112. unlink($tmpExe);
  44113. }
  44114. echo PHP_EOL;
  44115. return $answer;
  44116. }
  44117. if (file_exists('/usr/bin/env')) {
  44118. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  44119. foreach (array('bash', 'zsh', 'ksh', 'csh', 'sh') as $sh) {
  44120. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  44121. $shell = $sh;
  44122. break;
  44123. }
  44124. }
  44125. if (isset($shell)) {
  44126. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  44127. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  44128. $value = self::trimAnswer(shell_exec($command));
  44129. echo PHP_EOL;
  44130. return $value;
  44131. }
  44132. }
  44133. if (!$allowFallback) {
  44134. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  44135. }
  44136. return self::prompt();
  44137. }
  44138. private static function trimAnswer($str)
  44139. {
  44140. return preg_replace('{\r?\n$}D', '', $str);
  44141. }
  44142. }
  44143. MIT License
  44144. Copyright (c) 2016
  44145. Permission is hereby granted, free of charge, to any person obtaining a copy
  44146. of this software and associated documentation files (the "Software"), to deal
  44147. in the Software without restriction, including without limitation the rights
  44148. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44149. copies of the Software, and to permit persons to whom the Software is
  44150. furnished to do so, subject to the following conditions:
  44151. The above copyright notice and this permission notice shall be included in all
  44152. copies or substantial portions of the Software.
  44153. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44154. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44155. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44156. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44157. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44158. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  44159. SOFTWARE.
  44160. <?php
  44161. require(__DIR__ . '/../vendor/autoload.php');
  44162. $data = json_decode(file_get_contents('data.json'));
  44163. $validator = new JsonSchema\Validator;
  44164. $validator->check($data, (object)['$ref' => 'file://' . realpath('schema.json')]);
  44165. if ($validator->isValid()) {
  44166. echo "The supplied JSON validates against the schema.\n";
  44167. } else {
  44168. echo "JSON does not validate. Violations:\n";
  44169. foreach ($validator->getErrors() as $error) {
  44170. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  44171. }
  44172. }
  44173. <?php
  44174. namespace JsonSchema\Constraints;
  44175. use JsonSchema\Entity\JsonPointer;
  44176. class CollectionConstraint extends Constraint
  44177. {
  44178. public function check($value, $schema = null, JsonPointer $path = null, $i = null)
  44179. {
  44180. $this->_check($value, $schema, $path, $i);
  44181. }
  44182. public function coerce(&$value, $schema = null, JsonPointer $path = null, $i = null)
  44183. {
  44184. $this->_check($value, $schema, $path, $i, true);
  44185. }
  44186. protected function _check(&$value, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  44187. {
  44188. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  44189. $this->addError($path, "There must be a minimum of " . $schema->minItems . " items in the array", 'minItems', array('minItems' => $schema->minItems,));
  44190. }
  44191. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  44192. $this->addError($path, "There must be a maximum of " . $schema->maxItems . " items in the array", 'maxItems', array('maxItems' => $schema->maxItems,));
  44193. }
  44194. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  44195. $unique = $value;
  44196. if (is_array($value) && count($value)) {
  44197. $unique = array_map(function($e) { return var_export($e, true); }, $value);
  44198. }
  44199. if (count(array_unique($unique)) != count($value)) {
  44200. $this->addError($path, "There are no duplicates allowed in the array", 'uniqueItems');
  44201. }
  44202. }
  44203. if (isset($schema->items)) {
  44204. $this->validateItems($value, $schema, $path, $i, $coerce);
  44205. }
  44206. }
  44207. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  44208. {
  44209. if (is_object($schema->items)) {
  44210. if (isset($schema->items->type)
  44211. && (
  44212. $schema->items->type == 'string'
  44213. || $schema->items->type == 'number'
  44214. || $schema->items->type == 'integer'
  44215. )
  44216. && !isset($schema->additionalItems)
  44217. ) {
  44218. $type = $schema->items->type;
  44219. $typeValidator = $this->factory->createInstanceFor('type');
  44220. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  44221. foreach ($value as $k => $v) {
  44222. $k_path = $this->incrementPath($path, $k);
  44223. if($coerce) {
  44224. $typeValidator->coerce($v, $schema->items, $k_path, $i);
  44225. } else {
  44226. $typeValidator->check($v, $schema->items, $k_path, $i);
  44227. }
  44228. $validator->check($v, $schema->items, $k_path, $i);
  44229. }
  44230. $this->addErrors($typeValidator->getErrors());
  44231. $this->addErrors($validator->getErrors());
  44232. } else {
  44233. foreach ($value as $k => $v) {
  44234. $initErrors = $this->getErrors();
  44235. $this->checkUndefined($v, $schema->items, $path, $k, $coerce);
  44236. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  44237. $secondErrors = $this->getErrors();
  44238. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  44239. }
  44240. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  44241. $this->errors = $secondErrors;
  44242. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  44243. $this->errors = $initErrors;
  44244. }
  44245. }
  44246. }
  44247. } else {
  44248. foreach ($value as $k => $v) {
  44249. if (array_key_exists($k, $schema->items)) {
  44250. $this->checkUndefined($v, $schema->items[$k], $path, $k, $coerce);
  44251. } else {
  44252. if (property_exists($schema, 'additionalItems')) {
  44253. if ($schema->additionalItems !== false) {
  44254. $this->checkUndefined($v, $schema->additionalItems, $path, $k, $coerce);
  44255. } else {
  44256. $this->addError(
  44257. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems,));
  44258. }
  44259. } else {
  44260. $this->checkUndefined($v, new \stdClass(), $path, $k, $coerce);
  44261. }
  44262. }
  44263. }
  44264. if (count($value) > 0) {
  44265. for ($k = count($value); $k < count($schema->items); $k++) {
  44266. $this->checkUndefined($this->factory->createInstanceFor('undefined'), $schema->items[$k], $path, $k, $coerce);
  44267. }
  44268. }
  44269. }
  44270. }
  44271. }
  44272. <?php
  44273. namespace JsonSchema\Constraints;
  44274. use JsonSchema\SchemaStorage;
  44275. use JsonSchema\Uri\UriRetriever;
  44276. use JsonSchema\UriRetrieverInterface;
  44277. use JsonSchema\Entity\JsonPointer;
  44278. abstract class Constraint implements ConstraintInterface
  44279. {
  44280. protected $errors = array();
  44281. protected $inlineSchemaProperty = '$schema';
  44282. const CHECK_MODE_NORMAL = 0x00000001;
  44283. const CHECK_MODE_TYPE_CAST = 0x00000002;
  44284. protected $factory;
  44285. public function __construct(Factory $factory = null)
  44286. {
  44287. $this->factory = $factory ? : new Factory();
  44288. }
  44289. public function addError(JsonPointer $path = null, $message, $constraint='', array $more=null)
  44290. {
  44291. $error = array(
  44292. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  44293. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  44294. 'message' => $message,
  44295. 'constraint' => $constraint,
  44296. );
  44297. if (is_array($more) && count($more) > 0)
  44298. {
  44299. $error += $more;
  44300. }
  44301. $this->errors[] = $error;
  44302. }
  44303. public function addErrors(array $errors)
  44304. {
  44305. if ($errors) {
  44306. $this->errors = array_merge($this->errors, $errors);
  44307. }
  44308. }
  44309. public function getErrors()
  44310. {
  44311. return $this->errors;
  44312. }
  44313. public function isValid()
  44314. {
  44315. return !$this->getErrors();
  44316. }
  44317. public function reset()
  44318. {
  44319. $this->errors = array();
  44320. }
  44321. protected function incrementPath(JsonPointer $path = null, $i)
  44322. {
  44323. $path = $path ?: new JsonPointer('');
  44324. $path = $path->withPropertyPaths(
  44325. array_merge(
  44326. $path->getPropertyPaths(),
  44327. array_filter(array($i), 'strlen')
  44328. )
  44329. );
  44330. return $path;
  44331. }
  44332. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  44333. {
  44334. $validator = $this->factory->createInstanceFor('collection');
  44335. if($coerce) {
  44336. $validator->coerce($value, $schema, $path, $i);
  44337. } else {
  44338. $validator->check($value, $schema, $path, $i);
  44339. }
  44340. $this->addErrors($validator->getErrors());
  44341. }
  44342. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $i = null, $patternProperties = null, $coerce = false)
  44343. {
  44344. $validator = $this->factory->createInstanceFor('object');
  44345. if($coerce){
  44346. $validator->coerce($value, $schema, $path, $i, $patternProperties);
  44347. } else {
  44348. $validator->check($value, $schema, $path, $i, $patternProperties);
  44349. }
  44350. $this->addErrors($validator->getErrors());
  44351. }
  44352. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  44353. {
  44354. $validator = $this->factory->createInstanceFor('type');
  44355. if($coerce) {
  44356. $validator->coerce($value, $schema, $path, $i);
  44357. } else {
  44358. $validator->check($value, $schema, $path, $i);
  44359. }
  44360. $this->addErrors($validator->getErrors());
  44361. }
  44362. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  44363. {
  44364. $validator = $this->factory->createInstanceFor('undefined');
  44365. if($coerce){
  44366. $validator->coerce($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i);
  44367. } else {
  44368. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i);
  44369. }
  44370. $this->addErrors($validator->getErrors());
  44371. }
  44372. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  44373. {
  44374. $validator = $this->factory->createInstanceFor('string');
  44375. $validator->check($value, $schema, $path, $i);
  44376. $this->addErrors($validator->getErrors());
  44377. }
  44378. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  44379. {
  44380. $validator = $this->factory->createInstanceFor('number');
  44381. $validator->check($value, $schema, $path, $i);
  44382. $this->addErrors($validator->getErrors());
  44383. }
  44384. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  44385. {
  44386. $validator = $this->factory->createInstanceFor('enum');
  44387. $validator->check($value, $schema, $path, $i);
  44388. $this->addErrors($validator->getErrors());
  44389. }
  44390. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  44391. {
  44392. $validator = $this->factory->createInstanceFor('format');
  44393. $validator->check($value, $schema, $path, $i);
  44394. $this->addErrors($validator->getErrors());
  44395. }
  44396. protected function getTypeCheck()
  44397. {
  44398. return $this->factory->getTypeCheck();
  44399. }
  44400. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  44401. {
  44402. $result = array_map(
  44403. function($path) {
  44404. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  44405. },
  44406. $pointer->getPropertyPaths()
  44407. );
  44408. return trim(implode('', $result), '.');
  44409. }
  44410. }
  44411. <?php
  44412. namespace JsonSchema\Constraints;
  44413. use JsonSchema\Entity\JsonPointer;
  44414. interface ConstraintInterface
  44415. {
  44416. public function getErrors();
  44417. public function addErrors(array $errors);
  44418. public function addError(JsonPointer $path = null, $message, $constraint='', array $more=null);
  44419. public function isValid();
  44420. public function check($value, $schema = null, JsonPointer $path = null, $i = null);
  44421. }<?php
  44422. namespace JsonSchema\Constraints;
  44423. use JsonSchema\Entity\JsonPointer;
  44424. class EnumConstraint extends Constraint
  44425. {
  44426. public function check($element, $schema = null, JsonPointer $path = null, $i = null)
  44427. {
  44428. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  44429. return;
  44430. }
  44431. $type = gettype($element);
  44432. foreach ($schema->enum as $enum) {
  44433. $enumType = gettype($enum);
  44434. if (($this->factory->getCheckMode() & self::CHECK_MODE_TYPE_CAST) && $type == "array" && $enumType == "object") {
  44435. if ((object)$element == $enum) {
  44436. return;
  44437. }
  44438. }
  44439. if ($type === gettype($enum)) {
  44440. if ($type == "object") {
  44441. if ($element == $enum) {
  44442. return;
  44443. }
  44444. } elseif ($element === $enum) {
  44445. return;
  44446. }
  44447. }
  44448. }
  44449. $this->addError($path, "Does not have a value in the enumeration " . json_encode($schema->enum), 'enum', array('enum' => $schema->enum,));
  44450. }
  44451. }
  44452. <?php
  44453. namespace JsonSchema\Constraints;
  44454. use JsonSchema\Exception\InvalidArgumentException;
  44455. use JsonSchema\SchemaStorage;
  44456. use JsonSchema\SchemaStorageInterface;
  44457. use JsonSchema\Uri\UriRetriever;
  44458. use JsonSchema\UriRetrieverInterface;
  44459. class Factory
  44460. {
  44461. protected $schemaStorage;
  44462. protected $uriRetriever;
  44463. private $checkMode;
  44464. private $typeCheck = array();
  44465. protected $constraintMap = array(
  44466. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  44467. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  44468. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  44469. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  44470. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  44471. 'string' => 'JsonSchema\Constraints\StringConstraint',
  44472. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  44473. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  44474. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  44475. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  44476. 'validator' => 'JsonSchema\Validator',
  44477. 'coercer' => 'JsonSchema\Coerce'
  44478. );
  44479. private $instanceCache = array();
  44480. public function __construct(
  44481. SchemaStorageInterface $schemaStorage = null,
  44482. UriRetrieverInterface $uriRetriever = null,
  44483. $checkMode = Constraint::CHECK_MODE_NORMAL
  44484. ) {
  44485. $this->uriRetriever = $uriRetriever ?: new UriRetriever;
  44486. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  44487. $this->checkMode = $checkMode;
  44488. }
  44489. public function getUriRetriever()
  44490. {
  44491. return $this->uriRetriever;
  44492. }
  44493. public function getSchemaStorage()
  44494. {
  44495. return $this->schemaStorage;
  44496. }
  44497. public function getTypeCheck()
  44498. {
  44499. if (!isset($this->typeCheck[$this->checkMode])) {
  44500. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  44501. ? new TypeCheck\LooseTypeCheck
  44502. : new TypeCheck\StrictTypeCheck;
  44503. }
  44504. return $this->typeCheck[$this->checkMode];
  44505. }
  44506. public function setConstraintClass($name, $class)
  44507. {
  44508. if (!class_exists($class)) {
  44509. throw new InvalidArgumentException('Unknown constraint ' . $name);
  44510. }
  44511. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  44512. throw new InvalidArgumentException('Invalid class ' . $name);
  44513. }
  44514. $this->constraintMap[$name] = $class;
  44515. return $this;
  44516. }
  44517. public function createInstanceFor($constraintName)
  44518. {
  44519. if (!isset($this->constraintMap[$constraintName])) {
  44520. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  44521. }
  44522. if (!isset($this->instanceCache[$constraintName])) {
  44523. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  44524. }
  44525. return clone $this->instanceCache[$constraintName];
  44526. }
  44527. public function getCheckMode()
  44528. {
  44529. return $this->checkMode;
  44530. }
  44531. }
  44532. <?php
  44533. namespace JsonSchema\Constraints;
  44534. use JsonSchema\Rfc3339;
  44535. use JsonSchema\Entity\JsonPointer;
  44536. class FormatConstraint extends Constraint
  44537. {
  44538. public function check($element, $schema = null, JsonPointer $path = null, $i = null)
  44539. {
  44540. if (!isset($schema->format)) {
  44541. return;
  44542. }
  44543. switch ($schema->format) {
  44544. case 'date':
  44545. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  44546. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format,));
  44547. }
  44548. break;
  44549. case 'time':
  44550. if (!$this->validateDateTime($element, 'H:i:s')) {
  44551. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format,));
  44552. }
  44553. break;
  44554. case 'date-time':
  44555. if (null === Rfc3339::createFromString($element)) {
  44556. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format,));
  44557. }
  44558. break;
  44559. case 'utc-millisec':
  44560. if (!$this->validateDateTime($element, 'U')) {
  44561. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format,));
  44562. }
  44563. break;
  44564. case 'regex':
  44565. if (!$this->validateRegex($element)) {
  44566. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format,));
  44567. }
  44568. break;
  44569. case 'color':
  44570. if (!$this->validateColor($element)) {
  44571. $this->addError($path, "Invalid color", 'format', array('format' => $schema->format,));
  44572. }
  44573. break;
  44574. case 'style':
  44575. if (!$this->validateStyle($element)) {
  44576. $this->addError($path, "Invalid style", 'format', array('format' => $schema->format,));
  44577. }
  44578. break;
  44579. case 'phone':
  44580. if (!$this->validatePhone($element)) {
  44581. $this->addError($path, "Invalid phone number", 'format', array('format' => $schema->format,));
  44582. }
  44583. break;
  44584. case 'uri':
  44585. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  44586. $this->addError($path, "Invalid URL format", 'format', array('format' => $schema->format,));
  44587. }
  44588. break;
  44589. case 'email':
  44590. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) {
  44591. $this->addError($path, "Invalid email", 'format', array('format' => $schema->format,));
  44592. }
  44593. break;
  44594. case 'ip-address':
  44595. case 'ipv4':
  44596. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  44597. $this->addError($path, "Invalid IP address", 'format', array('format' => $schema->format,));
  44598. }
  44599. break;
  44600. case 'ipv6':
  44601. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  44602. $this->addError($path, "Invalid IP address", 'format', array('format' => $schema->format,));
  44603. }
  44604. break;
  44605. case 'host-name':
  44606. case 'hostname':
  44607. if (!$this->validateHostname($element)) {
  44608. $this->addError($path, "Invalid hostname", 'format', array('format' => $schema->format,));
  44609. }
  44610. break;
  44611. default:
  44612. break;
  44613. }
  44614. }
  44615. protected function validateDateTime($datetime, $format)
  44616. {
  44617. $dt = \DateTime::createFromFormat($format, $datetime);
  44618. if (!$dt) {
  44619. return false;
  44620. }
  44621. if ($datetime === $dt->format($format)) {
  44622. return true;
  44623. }
  44624. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  44625. return true;
  44626. }
  44627. return false;
  44628. }
  44629. protected function validateRegex($regex)
  44630. {
  44631. return false !== @preg_match('/' . $regex . '/u', '');
  44632. }
  44633. protected function validateColor($color)
  44634. {
  44635. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  44636. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  44637. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  44638. return true;
  44639. }
  44640. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  44641. }
  44642. protected function validateStyle($style)
  44643. {
  44644. $properties = explode(';', rtrim($style, ';'));
  44645. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  44646. return empty($invalidEntries);
  44647. }
  44648. protected function validatePhone($phone)
  44649. {
  44650. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  44651. }
  44652. protected function validateHostname($host)
  44653. {
  44654. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  44655. return preg_match($hostnameRegex, $host);
  44656. }
  44657. }
  44658. <?php
  44659. namespace JsonSchema\Constraints;
  44660. use JsonSchema\Entity\JsonPointer;
  44661. class NumberConstraint extends Constraint
  44662. {
  44663. public function check($element, $schema = null, JsonPointer $path = null, $i = null)
  44664. {
  44665. if (isset($schema->exclusiveMinimum)) {
  44666. if (isset($schema->minimum)) {
  44667. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  44668. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum,));
  44669. } elseif ($element < $schema->minimum) {
  44670. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
  44671. }
  44672. } else {
  44673. $this->addError($path, "Use of exclusiveMinimum requires presence of minimum", 'missingMinimum');
  44674. }
  44675. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  44676. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
  44677. }
  44678. if (isset($schema->exclusiveMaximum)) {
  44679. if (isset($schema->maximum)) {
  44680. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  44681. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum,));
  44682. } elseif ($element > $schema->maximum) {
  44683. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
  44684. }
  44685. } else {
  44686. $this->addError($path, "Use of exclusiveMaximum requires presence of maximum", 'missingMaximum');
  44687. }
  44688. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  44689. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
  44690. }
  44691. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  44692. $this->addError($path, "Is not divisible by " . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy,));
  44693. }
  44694. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  44695. $this->addError($path, "Must be a multiple of " . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf,));
  44696. }
  44697. $this->checkFormat($element, $schema, $path, $i);
  44698. }
  44699. private function fmod($number1, $number2)
  44700. {
  44701. $number1 = abs($number1);
  44702. $modulus = fmod($number1, $number2);
  44703. $precision = abs(0.0000000001);
  44704. $diff = (float)($modulus - $number2);
  44705. if (-$precision < $diff && $diff < $precision) {
  44706. return 0.0;
  44707. }
  44708. $decimals1 = mb_strpos($number1, ".") ? mb_strlen($number1) - mb_strpos($number1, ".") - 1 : 0;
  44709. $decimals2 = mb_strpos($number2, ".") ? mb_strlen($number2) - mb_strpos($number2, ".") - 1 : 0;
  44710. return (float)round($modulus, max($decimals1, $decimals2));
  44711. }
  44712. }
  44713. <?php
  44714. namespace JsonSchema\Constraints;
  44715. use JsonSchema\Entity\JsonPointer;
  44716. class ObjectConstraint extends Constraint
  44717. {
  44718. public function check($element, $definition = null, JsonPointer $path = null, $additionalProp = null, $patternProperties = null)
  44719. {
  44720. $this->_check($element, $definition, $path, $additionalProp, $patternProperties);
  44721. }
  44722. public function coerce(&$element, $definition = null, JsonPointer $path = null, $additionalProp = null, $patternProperties = null)
  44723. {
  44724. $this->_check($element, $definition, $path, $additionalProp, $patternProperties, true);
  44725. }
  44726. protected function _check(&$element, $definition = null, JsonPointer $path = null, $additionalProp = null, $patternProperties = null, $coerce = false)
  44727. {
  44728. if ($element instanceof UndefinedConstraint) {
  44729. return;
  44730. }
  44731. $matches = array();
  44732. if ($patternProperties) {
  44733. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  44734. }
  44735. if ($definition) {
  44736. $this->validateDefinition($element, $definition, $path, $coerce);
  44737. }
  44738. $this->validateElement($element, $matches, $definition, $path, $additionalProp);
  44739. }
  44740. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  44741. {
  44742. $try = array('/','#','+','~','%');
  44743. $matches = array();
  44744. foreach ($patternProperties as $pregex => $schema) {
  44745. $delimiter = '/';
  44746. foreach ($try as $delimiter) {
  44747. if (strpos($pregex, $delimiter) === false) {
  44748. break;
  44749. }
  44750. }
  44751. if (@preg_match($delimiter. $pregex . $delimiter . 'u', '') === false) {
  44752. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex,));
  44753. continue;
  44754. }
  44755. foreach ($element as $i => $value) {
  44756. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  44757. $matches[] = $i;
  44758. $this->checkUndefined($value, $schema ? : new \stdClass(), $path, $i);
  44759. }
  44760. }
  44761. }
  44762. return $matches;
  44763. }
  44764. public function validateElement($element, $matches, $objectDefinition = null, JsonPointer $path = null, $additionalProp = null)
  44765. {
  44766. $this->validateMinMaxConstraint($element, $objectDefinition, $path);
  44767. foreach ($element as $i => $value) {
  44768. $definition = $this->getProperty($objectDefinition, $i);
  44769. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  44770. $this->addError($path, "The property " . $i . " is not defined and the definition does not allow additional properties", 'additionalProp');
  44771. }
  44772. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  44773. if ($additionalProp === true) {
  44774. $this->checkUndefined($value, null, $path, $i);
  44775. } else {
  44776. $this->checkUndefined($value, $additionalProp, $path, $i);
  44777. }
  44778. }
  44779. $require = $this->getProperty($definition, 'requires');
  44780. if ($require && !$this->getProperty($element, $require)) {
  44781. $this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present", 'requires');
  44782. }
  44783. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  44784. if (is_object($property)) {
  44785. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  44786. }
  44787. }
  44788. }
  44789. public function validateDefinition(&$element, $objectDefinition = null, JsonPointer $path = null, $coerce = false)
  44790. {
  44791. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  44792. foreach ($objectDefinition as $i => $value) {
  44793. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  44794. $definition = $this->getProperty($objectDefinition, $i);
  44795. if (is_object($definition)) {
  44796. $this->checkUndefined($property, $definition, $path, $i, $coerce);
  44797. }
  44798. }
  44799. }
  44800. protected function &getProperty(&$element, $property, $fallback = null)
  44801. {
  44802. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  44803. return $element[$property];
  44804. } elseif (is_object($element) && property_exists($element, $property)) {
  44805. return $element->$property;
  44806. }
  44807. return $fallback;
  44808. }
  44809. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null) {
  44810. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  44811. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  44812. $this->addError($path, "Must contain a minimum of " . $objectDefinition->minProperties . " properties", 'minProperties', array('minProperties' => $objectDefinition->minProperties,));
  44813. }
  44814. }
  44815. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  44816. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  44817. $this->addError($path, "Must contain no more than " . $objectDefinition->maxProperties . " properties", 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties,));
  44818. }
  44819. }
  44820. }
  44821. }
  44822. <?php
  44823. namespace JsonSchema\Constraints;
  44824. use JsonSchema\Exception\InvalidArgumentException;
  44825. use JsonSchema\Entity\JsonPointer;
  44826. class SchemaConstraint extends Constraint
  44827. {
  44828. public function check($element, $schema = null, JsonPointer $path = null, $i = null)
  44829. {
  44830. $this->_check($element, $schema, $path, $i);
  44831. }
  44832. protected function _check(&$element, $schema = null, JsonPointer $path = null, $i = null, $coerce = false){
  44833. if ($schema !== null) {
  44834. $this->checkUndefined($element, $schema, $path, $i, $coerce);
  44835. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  44836. $inlineSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  44837. if (is_array($inlineSchema)) {
  44838. $inlineSchema = json_decode(json_encode($inlineSchema));
  44839. }
  44840. $this->checkUndefined($element, $inlineSchema, $path, $i);
  44841. } else {
  44842. throw new InvalidArgumentException('no schema found to verify against');
  44843. }
  44844. }
  44845. public function coerce(&$element, $schema = null, JsonPointer $path = null, $i = null)
  44846. {
  44847. $this->_check($element, $schema, $path, $i, true);
  44848. }
  44849. }
  44850. <?php
  44851. namespace JsonSchema\Constraints;
  44852. use JsonSchema\Entity\JsonPointer;
  44853. class StringConstraint extends Constraint
  44854. {
  44855. public function check($element, $schema = null, JsonPointer $path = null, $i = null)
  44856. {
  44857. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  44858. $this->addError($path, "Must be at most " . $schema->maxLength . " characters long", 'maxLength', array(
  44859. 'maxLength' => $schema->maxLength,
  44860. ));
  44861. }
  44862. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  44863. $this->addError($path, "Must be at least " . $schema->minLength . " characters long", 'minLength', array(
  44864. 'minLength' => $schema->minLength,
  44865. ));
  44866. }
  44867. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  44868. $this->addError($path, "Does not match the regex pattern " . $schema->pattern, 'pattern', array(
  44869. 'pattern' => $schema->pattern,
  44870. ));
  44871. }
  44872. $this->checkFormat($element, $schema, $path, $i);
  44873. }
  44874. private function strlen($string)
  44875. {
  44876. if (extension_loaded('mbstring')) {
  44877. return mb_strlen($string, mb_detect_encoding($string));
  44878. } else {
  44879. return strlen($string);
  44880. }
  44881. }
  44882. }
  44883. <?php
  44884. namespace JsonSchema\Constraints\TypeCheck;
  44885. class LooseTypeCheck implements TypeCheckInterface
  44886. {
  44887. public static function isObject($value)
  44888. {
  44889. return
  44890. is_object($value) ||
  44891. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  44892. }
  44893. public static function isArray($value)
  44894. {
  44895. return
  44896. is_array($value) &&
  44897. (count($value) == 0 || !self::isAssociativeArray($value));
  44898. }
  44899. public static function propertyGet($value, $property)
  44900. {
  44901. if (is_object($value)) {
  44902. return $value->{$property};
  44903. }
  44904. return $value[$property];
  44905. }
  44906. public static function propertyExists($value, $property)
  44907. {
  44908. if (is_object($value)) {
  44909. return property_exists($value, $property);
  44910. }
  44911. return array_key_exists($property, $value);
  44912. }
  44913. public static function propertyCount($value)
  44914. {
  44915. if (is_object($value)) {
  44916. return count(get_object_vars($value));
  44917. }
  44918. return count($value);
  44919. }
  44920. private static function isAssociativeArray($arr)
  44921. {
  44922. return (array_keys($arr) !== range(0, count($arr) - 1));
  44923. }
  44924. }
  44925. <?php
  44926. namespace JsonSchema\Constraints\TypeCheck;
  44927. class StrictTypeCheck implements TypeCheckInterface
  44928. {
  44929. public static function isObject($value)
  44930. {
  44931. return is_object($value);
  44932. }
  44933. public static function isArray($value)
  44934. {
  44935. return is_array($value);
  44936. }
  44937. public static function propertyGet($value, $property)
  44938. {
  44939. return $value->{$property};
  44940. }
  44941. public static function propertyExists($value, $property)
  44942. {
  44943. return property_exists($value, $property);
  44944. }
  44945. public static function propertyCount($value)
  44946. {
  44947. return count(get_object_vars($value));
  44948. }
  44949. }
  44950. <?php
  44951. namespace JsonSchema\Constraints\TypeCheck;
  44952. interface TypeCheckInterface
  44953. {
  44954. public static function isObject($value);
  44955. public static function isArray($value);
  44956. public static function propertyGet($value, $property);
  44957. public static function propertyExists($value, $property);
  44958. public static function propertyCount($value);
  44959. }
  44960. <?php
  44961. namespace JsonSchema\Constraints;
  44962. use JsonSchema\Exception\InvalidArgumentException;
  44963. use JsonSchema\Entity\JsonPointer;
  44964. use UnexpectedValueException as StandardUnexpectedValueException;
  44965. class TypeConstraint extends Constraint
  44966. {
  44967. static $wording = array(
  44968. 'integer' => 'an integer',
  44969. 'number' => 'a number',
  44970. 'boolean' => 'a boolean',
  44971. 'object' => 'an object',
  44972. 'array' => 'an array',
  44973. 'string' => 'a string',
  44974. 'null' => 'a null',
  44975. 'any' => NULL,
  44976. 0 => NULL,
  44977. );
  44978. public function check($value = null, $schema = null, JsonPointer $path = null, $i = null)
  44979. {
  44980. $this->_check($value, $schema, $path, $i);
  44981. }
  44982. public function coerce(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  44983. {
  44984. $this->_check($value, $schema, $path, $i, true);
  44985. }
  44986. protected function _check(&$value = null, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  44987. {
  44988. $type = isset($schema->type) ? $schema->type : null;
  44989. $isValid = false;
  44990. $wording = array();
  44991. if (is_array($type)) {
  44992. $this->validateTypesArray($value, $type, $wording, $isValid, $path, $coerce);
  44993. } elseif (is_object($type)) {
  44994. $this->checkUndefined($value, $type, $path);
  44995. return;
  44996. } else {
  44997. $isValid = $this->validateType($value, $type, $coerce);
  44998. }
  44999. if ($isValid === false) {
  45000. if (!is_array($type)) {
  45001. $this->validateTypeNameWording($type);
  45002. $wording[] = self::$wording[$type];
  45003. }
  45004. $this->addError($path, ucwords(gettype($value)) . " value found, but " .
  45005. $this->implodeWith($wording, ', ', 'or') . " is required", 'type');
  45006. }
  45007. }
  45008. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid,
  45009. $path, $coerce = false) {
  45010. foreach ($type as $tp) {
  45011. if (is_object($tp)) {
  45012. if (!$isValid) {
  45013. $validator = $this->factory->createInstanceFor('type');
  45014. $subSchema = new \stdClass();
  45015. $subSchema->type = $tp;
  45016. $validator->check($value, $subSchema, $path, null);
  45017. $error = $validator->getErrors();
  45018. $isValid = !(bool)$error;
  45019. $validTypesWording[] = self::$wording['object'];
  45020. }
  45021. } else {
  45022. $this->validateTypeNameWording( $tp );
  45023. $validTypesWording[] = self::$wording[$tp];
  45024. if (!$isValid) {
  45025. $isValid = $this->validateType( $value, $tp, $coerce );
  45026. }
  45027. }
  45028. }
  45029. }
  45030. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false) {
  45031. if ($listEnd === false || !isset($elements[1])) {
  45032. return implode($delimiter, $elements);
  45033. }
  45034. $lastElement = array_slice($elements, -1);
  45035. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  45036. $implodedElements = array_merge(array($firsElements), $lastElement);
  45037. return join(" $listEnd ", $implodedElements);
  45038. }
  45039. protected function validateTypeNameWording( $type) {
  45040. if (!isset(self::$wording[$type])) {
  45041. throw new StandardUnexpectedValueException(
  45042. sprintf(
  45043. "No wording for %s available, expected wordings are: [%s]",
  45044. var_export($type, true),
  45045. implode(', ', array_filter(self::$wording)))
  45046. );
  45047. }
  45048. }
  45049. protected function validateType(&$value, $type, $coerce = false)
  45050. {
  45051. if (!$type) {
  45052. return true;
  45053. }
  45054. if ('any' === $type) {
  45055. return true;
  45056. }
  45057. if ('object' === $type) {
  45058. return $this->getTypeCheck()->isObject($value);
  45059. }
  45060. if ('array' === $type) {
  45061. return $this->getTypeCheck()->isArray($value);
  45062. }
  45063. if ('integer' === $type) {
  45064. if ($coerce) {
  45065. $value = $this->toInteger($value);
  45066. }
  45067. return is_int($value);
  45068. }
  45069. if ('number' === $type) {
  45070. if ($coerce) {
  45071. $value = $this->toNumber($value);
  45072. }
  45073. return is_numeric($value) && !is_string($value);
  45074. }
  45075. if ('boolean' === $type) {
  45076. if ($coerce) {
  45077. $value = $this->toBoolean($value);
  45078. }
  45079. return is_bool($value);
  45080. }
  45081. if ('string' === $type) {
  45082. return is_string($value);
  45083. }
  45084. if ('email' === $type) {
  45085. return is_string($value);
  45086. }
  45087. if ('null' === $type) {
  45088. return is_null($value);
  45089. }
  45090. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  45091. }
  45092. protected function toBoolean($value)
  45093. {
  45094. if($value === "true"){
  45095. return true;
  45096. }
  45097. if($value === "false"){
  45098. return false;
  45099. }
  45100. return $value;
  45101. }
  45102. protected function toNumber($value)
  45103. {
  45104. if(is_numeric($value)) {
  45105. return $value + 0;
  45106. }
  45107. return $value;
  45108. }
  45109. protected function toInteger($value)
  45110. {
  45111. if(is_numeric($value) && (int)$value == $value) {
  45112. return (int)$value;
  45113. }
  45114. return $value;
  45115. }
  45116. }
  45117. <?php
  45118. namespace JsonSchema\Constraints;
  45119. use JsonSchema\Uri\UriResolver;
  45120. use JsonSchema\Entity\JsonPointer;
  45121. class UndefinedConstraint extends Constraint
  45122. {
  45123. public function check($value, $schema = null, JsonPointer $path = null, $i = null){
  45124. $this->_check($value, $schema, $path, $i);
  45125. }
  45126. public function coerce(&$value, $schema = null, JsonPointer $path = null, $i = null){
  45127. $this->_check($value, $schema, $path, $i, true);
  45128. }
  45129. protected function _check(&$value, $schema = null, JsonPointer $path = null, $i = null, $coerce = false)
  45130. {
  45131. if (is_null($schema) || !is_object($schema)) {
  45132. return;
  45133. }
  45134. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  45135. $this->validateCommonProperties($value, $schema, $path, $i, $coerce);
  45136. $this->validateOfProperties($value, $schema, $path, '', $coerce);
  45137. $this->validateTypes($value, $schema, $path, $i, $coerce);
  45138. }
  45139. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null, $coerce = false)
  45140. {
  45141. if ($this->getTypeCheck()->isArray($value)) {
  45142. $this->checkArray($value, $schema, $path, $i, $coerce);
  45143. }
  45144. if ($this->getTypeCheck()->isObject($value)) {
  45145. $this->checkObject(
  45146. $value,
  45147. isset($schema->properties) ? $this->factory->getSchemaStorage()->resolveRefSchema($schema->properties) : $schema,
  45148. $path,
  45149. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  45150. isset($schema->patternProperties) ? $schema->patternProperties : null,
  45151. $coerce
  45152. );
  45153. }
  45154. if (is_string($value)) {
  45155. $this->checkString($value, $schema, $path, $i, $coerce);
  45156. }
  45157. if (is_numeric($value)) {
  45158. $this->checkNumber($value, $schema, $path, $i);
  45159. }
  45160. if (isset($schema->enum)) {
  45161. $this->checkEnum($value, $schema, $path, $i);
  45162. }
  45163. }
  45164. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = "", $coerce=false)
  45165. {
  45166. if (isset($schema->extends)) {
  45167. if (is_string($schema->extends)) {
  45168. $schema->extends = $this->validateUri($schema, $schema->extends);
  45169. }
  45170. if (is_array($schema->extends)) {
  45171. foreach ($schema->extends as $extends) {
  45172. $this->checkUndefined($value, $extends, $path, $i, $coerce);
  45173. }
  45174. } else {
  45175. $this->checkUndefined($value, $schema->extends, $path, $i, $coerce);
  45176. }
  45177. }
  45178. if ($this->getTypeCheck()->isObject($value)) {
  45179. if (!($value instanceof UndefinedConstraint) && isset($schema->required) && is_array($schema->required)) {
  45180. foreach ($schema->required as $required) {
  45181. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  45182. $this->addError(
  45183. $this->incrementPath($path ?: new JsonPointer(''), $required),
  45184. "The property " . $required . " is required",
  45185. 'required'
  45186. );
  45187. }
  45188. }
  45189. } elseif (isset($schema->required) && !is_array($schema->required)) {
  45190. if ($schema->required && $value instanceof UndefinedConstraint) {
  45191. $this->addError($path, "Is missing and it is required", 'required');
  45192. }
  45193. }
  45194. }
  45195. if (!($value instanceof UndefinedConstraint)) {
  45196. $this->checkType($value, $schema, $path, $i, $coerce);
  45197. }
  45198. if (isset($schema->disallow)) {
  45199. $initErrors = $this->getErrors();
  45200. $typeSchema = new \stdClass();
  45201. $typeSchema->type = $schema->disallow;
  45202. $this->checkType($value, $typeSchema, $path);
  45203. if (count($this->getErrors()) == count($initErrors)) {
  45204. $this->addError($path, "Disallowed value was matched", 'disallow');
  45205. } else {
  45206. $this->errors = $initErrors;
  45207. }
  45208. }
  45209. if (isset($schema->not)) {
  45210. $initErrors = $this->getErrors();
  45211. $this->checkUndefined($value, $schema->not, $path, $i, $coerce);
  45212. if (count($this->getErrors()) == count($initErrors)) {
  45213. $this->addError($path, "Matched a schema which it should not", 'not');
  45214. } else {
  45215. $this->errors = $initErrors;
  45216. }
  45217. }
  45218. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  45219. $this->validateDependencies($value, $schema->dependencies, $path);
  45220. }
  45221. }
  45222. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = "", $coerce = false)
  45223. {
  45224. if ($value instanceof UndefinedConstraint) {
  45225. return;
  45226. }
  45227. if (isset($schema->allOf)) {
  45228. $isValid = true;
  45229. foreach ($schema->allOf as $allOf) {
  45230. $initErrors = $this->getErrors();
  45231. $this->checkUndefined($value, $allOf, $path, $i, $coerce);
  45232. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  45233. }
  45234. if (!$isValid) {
  45235. $this->addError($path, "Failed to match all schemas", 'allOf');
  45236. }
  45237. }
  45238. if (isset($schema->anyOf)) {
  45239. $isValid = false;
  45240. $startErrors = $this->getErrors();
  45241. foreach ($schema->anyOf as $anyOf) {
  45242. $initErrors = $this->getErrors();
  45243. $this->checkUndefined($value, $anyOf, $path, $i, $coerce);
  45244. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  45245. break;
  45246. }
  45247. }
  45248. if (!$isValid) {
  45249. $this->addError($path, "Failed to match at least one schema", 'anyOf');
  45250. } else {
  45251. $this->errors = $startErrors;
  45252. }
  45253. }
  45254. if (isset($schema->oneOf)) {
  45255. $allErrors = array();
  45256. $matchedSchemas = 0;
  45257. $startErrors = $this->getErrors();
  45258. foreach ($schema->oneOf as $oneOf) {
  45259. $this->errors = array();
  45260. $this->checkUndefined($value, $oneOf, $path, $i, $coerce);
  45261. if (count($this->getErrors()) == 0) {
  45262. $matchedSchemas++;
  45263. }
  45264. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  45265. }
  45266. if ($matchedSchemas !== 1) {
  45267. $this->addErrors(array_merge($allErrors, $startErrors));
  45268. $this->addError($path, "Failed to match exactly one schema", 'oneOf');
  45269. } else {
  45270. $this->errors = $startErrors;
  45271. }
  45272. }
  45273. }
  45274. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = "")
  45275. {
  45276. foreach ($dependencies as $key => $dependency) {
  45277. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  45278. if (is_string($dependency)) {
  45279. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  45280. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  45281. }
  45282. } elseif (is_array($dependency)) {
  45283. foreach ($dependency as $d) {
  45284. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  45285. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  45286. }
  45287. }
  45288. } elseif (is_object($dependency)) {
  45289. $this->checkUndefined($value, $dependency, $path, $i);
  45290. }
  45291. }
  45292. }
  45293. }
  45294. protected function validateUri($schema, $schemaUri = null)
  45295. {
  45296. $resolver = new UriResolver();
  45297. $retriever = $this->factory->getUriRetriever();
  45298. $jsonSchema = null;
  45299. if ($resolver->isValid($schemaUri)) {
  45300. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  45301. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  45302. }
  45303. return $jsonSchema;
  45304. }
  45305. }
  45306. <?php
  45307. namespace JsonSchema\Entity;
  45308. class JsonPointer
  45309. {
  45310. private $filename;
  45311. private $propertyPaths = array();
  45312. public function __construct($value)
  45313. {
  45314. if (!is_string($value)) {
  45315. throw new \InvalidArgumentException('Ref value must be a string');
  45316. }
  45317. $splitRef = explode('#', $value, 2);
  45318. $this->filename = $splitRef[0];
  45319. if (array_key_exists(1, $splitRef)) {
  45320. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  45321. }
  45322. }
  45323. private function decodePropertyPaths($propertyPathString)
  45324. {
  45325. $paths = array();
  45326. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  45327. $path = $this->decodePath($path);
  45328. if (is_string($path) && '' !== $path) {
  45329. $paths[] = $path;
  45330. }
  45331. }
  45332. return $paths;
  45333. }
  45334. private function encodePropertyPaths()
  45335. {
  45336. return array_map(
  45337. array($this, 'encodePath'),
  45338. $this->getPropertyPaths()
  45339. );
  45340. }
  45341. private function decodePath($path)
  45342. {
  45343. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  45344. }
  45345. private function encodePath($path)
  45346. {
  45347. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  45348. }
  45349. public function getFilename()
  45350. {
  45351. return $this->filename;
  45352. }
  45353. public function getPropertyPaths()
  45354. {
  45355. return $this->propertyPaths;
  45356. }
  45357. public function withPropertyPaths(array $propertyPaths)
  45358. {
  45359. $new = clone $this;
  45360. $new->propertyPaths = $propertyPaths;
  45361. return $new;
  45362. }
  45363. public function getPropertyPathAsString()
  45364. {
  45365. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  45366. }
  45367. public function __toString()
  45368. {
  45369. return $this->getFilename() . $this->getPropertyPathAsString();
  45370. }
  45371. }
  45372. <?php
  45373. namespace JsonSchema\Exception;
  45374. interface ExceptionInterface
  45375. {
  45376. }
  45377. <?php
  45378. namespace JsonSchema\Exception;
  45379. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  45380. {
  45381. }<?php
  45382. namespace JsonSchema\Exception;
  45383. class InvalidSchemaMediaTypeException extends RuntimeException
  45384. {
  45385. }<?php
  45386. namespace JsonSchema\Exception;
  45387. class InvalidSourceUriException extends InvalidArgumentException
  45388. {
  45389. }
  45390. <?php
  45391. namespace JsonSchema\Exception;
  45392. class JsonDecodingException extends RuntimeException
  45393. {
  45394. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  45395. {
  45396. switch ($code) {
  45397. case JSON_ERROR_DEPTH:
  45398. $message = 'The maximum stack depth has been exceeded';
  45399. break;
  45400. case JSON_ERROR_STATE_MISMATCH:
  45401. $message = 'Invalid or malformed JSON';
  45402. break;
  45403. case JSON_ERROR_CTRL_CHAR:
  45404. $message = 'Control character error, possibly incorrectly encoded';
  45405. break;
  45406. case JSON_ERROR_UTF8:
  45407. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  45408. break;
  45409. case JSON_ERROR_SYNTAX:
  45410. $message = 'JSON syntax is malformed';
  45411. break;
  45412. default:
  45413. $message = 'Syntax error';
  45414. }
  45415. parent::__construct($message, $code, $previous);
  45416. }
  45417. }<?php
  45418. namespace JsonSchema\Exception;
  45419. class ResourceNotFoundException extends RuntimeException
  45420. {
  45421. }<?php
  45422. namespace JsonSchema\Exception;
  45423. class RuntimeException extends \RuntimeException implements ExceptionInterface
  45424. {
  45425. }<?php
  45426. namespace JsonSchema\Exception;
  45427. class UnresolvableJsonPointerException extends InvalidArgumentException
  45428. {
  45429. }
  45430. <?php
  45431. namespace JsonSchema\Exception;
  45432. class UriResolverException extends RuntimeException
  45433. {
  45434. }<?php
  45435. namespace JsonSchema\Iterator;
  45436. class ObjectIterator implements \Iterator, \Countable
  45437. {
  45438. private $object;
  45439. private $position = 0;
  45440. private $data = array();
  45441. private $initialized = false;
  45442. public function __construct($object)
  45443. {
  45444. $this->object = $object;
  45445. }
  45446. public function current()
  45447. {
  45448. $this->initialize();
  45449. return $this->data[$this->position];
  45450. }
  45451. public function next()
  45452. {
  45453. $this->initialize();
  45454. $this->position++;
  45455. }
  45456. public function key()
  45457. {
  45458. $this->initialize();
  45459. return $this->position;
  45460. }
  45461. public function valid()
  45462. {
  45463. $this->initialize();
  45464. return isset($this->data[$this->position]);
  45465. }
  45466. public function rewind()
  45467. {
  45468. $this->initialize();
  45469. $this->position = 0;
  45470. }
  45471. public function count()
  45472. {
  45473. $this->initialize();
  45474. return count($this->data);
  45475. }
  45476. private function initialize()
  45477. {
  45478. if (!$this->initialized) {
  45479. $this->data = $this->buildDataFromObject($this->object);
  45480. $this->initialized = true;
  45481. }
  45482. }
  45483. private function buildDataFromObject($object)
  45484. {
  45485. $result = array();
  45486. $stack = new \SplStack();
  45487. $stack->push($object);
  45488. while (!$stack->isEmpty()) {
  45489. $current = $stack->pop();
  45490. if (is_object($current)) {
  45491. array_push($result, $current);
  45492. }
  45493. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  45494. if (is_object($propertyValue) || is_array($propertyValue)) {
  45495. $stack->push($propertyValue);
  45496. }
  45497. }
  45498. }
  45499. return $result;
  45500. }
  45501. private function getDataFromItem($item)
  45502. {
  45503. if (!is_object($item) && !is_array($item)) {
  45504. return array();
  45505. }
  45506. return is_object($item) ? get_object_vars($item) : $item;
  45507. }
  45508. }
  45509. <?php
  45510. namespace JsonSchema;
  45511. class Rfc3339
  45512. {
  45513. const REGEX = '/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))/';
  45514. public static function createFromString($string)
  45515. {
  45516. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  45517. return null;
  45518. }
  45519. $dateAndTime = $matches[1];
  45520. $microseconds = $matches[2] ?: '.000000';
  45521. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  45522. $dateTime = \DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  45523. return $dateTime ?: null;
  45524. }
  45525. }
  45526. <?php
  45527. namespace JsonSchema;
  45528. use JsonSchema\Entity\JsonPointer;
  45529. use JsonSchema\Exception\UnresolvableJsonPointerException;
  45530. use JsonSchema\Iterator\ObjectIterator;
  45531. use JsonSchema\Uri\UriResolver;
  45532. use JsonSchema\Uri\UriRetriever;
  45533. class SchemaStorage implements SchemaStorageInterface
  45534. {
  45535. protected $uriRetriever;
  45536. protected $uriResolver;
  45537. protected $schemas = array();
  45538. public function __construct(
  45539. UriRetrieverInterface $uriRetriever = null,
  45540. UriResolverInterface $uriResolver = null
  45541. ) {
  45542. $this->uriRetriever = $uriRetriever ?: new UriRetriever;
  45543. $this->uriResolver = $uriResolver ?: new UriResolver;
  45544. }
  45545. public function getUriRetriever()
  45546. {
  45547. return $this->uriRetriever;
  45548. }
  45549. public function getUriResolver()
  45550. {
  45551. return $this->uriResolver;
  45552. }
  45553. public function addSchema($id, $schema = null)
  45554. {
  45555. if (is_null($schema)) {
  45556. $schema = $this->uriRetriever->retrieve($id);
  45557. }
  45558. $objectIterator = new ObjectIterator($schema);
  45559. foreach ($objectIterator as $toResolveSchema) {
  45560. if (property_exists($toResolveSchema, '$ref') && is_string($toResolveSchema->{'$ref'})) {
  45561. $jsonPointer = new JsonPointer($this->uriResolver->resolve($toResolveSchema->{'$ref'}, $id));
  45562. $toResolveSchema->{'$ref'} = (string)$jsonPointer;
  45563. }
  45564. }
  45565. $this->schemas[$id] = $schema;
  45566. }
  45567. public function getSchema($id)
  45568. {
  45569. if (!array_key_exists($id, $this->schemas)) {
  45570. $this->addSchema($id);
  45571. }
  45572. return $this->schemas[$id];
  45573. }
  45574. public function resolveRef($ref)
  45575. {
  45576. $jsonPointer = new JsonPointer($ref);
  45577. $refSchema = $this->getSchema($jsonPointer->getFilename());
  45578. foreach ($jsonPointer->getPropertyPaths() as $path) {
  45579. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  45580. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  45581. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  45582. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  45583. } else {
  45584. throw new UnresolvableJsonPointerException(sprintf(
  45585. 'File: %s is found, but could not resolve fragment: %s',
  45586. $jsonPointer->getFilename(),
  45587. $jsonPointer->getPropertyPathAsString()
  45588. ));
  45589. }
  45590. }
  45591. return $refSchema;
  45592. }
  45593. public function resolveRefSchema($refSchema)
  45594. {
  45595. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  45596. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  45597. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  45598. unset($refSchema->{'$ref'});
  45599. }
  45600. return $refSchema;
  45601. }
  45602. }
  45603. <?php
  45604. namespace JsonSchema;
  45605. interface SchemaStorageInterface
  45606. {
  45607. public function addSchema($id, $schema = null);
  45608. public function getSchema($id);
  45609. public function resolveRef($ref);
  45610. public function resolveRefSchema($refSchema);
  45611. }
  45612. <?php
  45613. namespace JsonSchema\Uri\Retrievers;
  45614. abstract class AbstractRetriever implements UriRetrieverInterface
  45615. {
  45616. protected $contentType;
  45617. public function getContentType()
  45618. {
  45619. return $this->contentType;
  45620. }
  45621. }
  45622. <?php
  45623. namespace JsonSchema\Uri\Retrievers;
  45624. use JsonSchema\Validator;
  45625. class Curl extends AbstractRetriever
  45626. {
  45627. protected $messageBody;
  45628. public function __construct()
  45629. {
  45630. if (!function_exists('curl_init')) {
  45631. throw new \RuntimeException("cURL not installed");
  45632. }
  45633. }
  45634. public function retrieve($uri)
  45635. {
  45636. $ch = curl_init();
  45637. curl_setopt($ch, CURLOPT_URL, $uri);
  45638. curl_setopt($ch, CURLOPT_HEADER, true);
  45639. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  45640. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  45641. $response = curl_exec($ch);
  45642. if (false === $response) {
  45643. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  45644. }
  45645. $this->fetchMessageBody($response);
  45646. $this->fetchContentType($response);
  45647. curl_close($ch);
  45648. return $this->messageBody;
  45649. }
  45650. private function fetchMessageBody($response)
  45651. {
  45652. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  45653. $this->messageBody = $match[1];
  45654. }
  45655. protected function fetchContentType($response)
  45656. {
  45657. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  45658. $this->contentType = trim($match[1]);
  45659. return true;
  45660. }
  45661. return false;
  45662. }
  45663. }<?php
  45664. namespace JsonSchema\Uri\Retrievers;
  45665. use JsonSchema\Exception\ResourceNotFoundException;
  45666. class FileGetContents extends AbstractRetriever
  45667. {
  45668. protected $messageBody;
  45669. public function retrieve($uri)
  45670. {
  45671. $errorMessage = null;
  45672. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  45673. $errorMessage = $errstr;
  45674. });
  45675. $response = file_get_contents($uri);
  45676. restore_error_handler();
  45677. if ($errorMessage) {
  45678. throw new ResourceNotFoundException($errorMessage);
  45679. }
  45680. if (false === $response) {
  45681. throw new ResourceNotFoundException('JSON schema not found at '.$uri);
  45682. }
  45683. if ($response == ''
  45684. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  45685. ) {
  45686. throw new ResourceNotFoundException('JSON schema not found at '.$uri);
  45687. }
  45688. $this->messageBody = $response;
  45689. if (!empty($http_response_header)) {
  45690. $this->fetchContentType($http_response_header);
  45691. } else {
  45692. $this->contentType = null;
  45693. }
  45694. return $this->messageBody;
  45695. }
  45696. private function fetchContentType(array $headers)
  45697. {
  45698. foreach ($headers as $header) {
  45699. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  45700. return true;
  45701. }
  45702. }
  45703. return false;
  45704. }
  45705. protected static function getContentTypeMatchInHeader($header)
  45706. {
  45707. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  45708. return trim($match[1]);
  45709. }
  45710. return null;
  45711. }
  45712. }
  45713. <?php
  45714. namespace JsonSchema\Uri\Retrievers;
  45715. use JsonSchema\Validator;
  45716. class PredefinedArray extends AbstractRetriever
  45717. {
  45718. private $schemas;
  45719. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  45720. {
  45721. $this->schemas = $schemas;
  45722. $this->contentType = $contentType;
  45723. }
  45724. public function retrieve($uri)
  45725. {
  45726. if (!array_key_exists($uri, $this->schemas)) {
  45727. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  45728. 'The JSON schema "%s" was not found.',
  45729. $uri
  45730. ));
  45731. }
  45732. return $this->schemas[$uri];
  45733. }
  45734. }
  45735. <?php
  45736. namespace JsonSchema\Uri\Retrievers;
  45737. interface UriRetrieverInterface
  45738. {
  45739. public function retrieve($uri);
  45740. public function getContentType();
  45741. }<?php
  45742. namespace JsonSchema\Uri;
  45743. use JsonSchema\Exception\UriResolverException;
  45744. use JsonSchema\UriResolverInterface;
  45745. class UriResolver implements UriResolverInterface
  45746. {
  45747. public function parse($uri)
  45748. {
  45749. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  45750. $components = array();
  45751. if (5 < count($match)) {
  45752. $components = array(
  45753. 'scheme' => $match[2],
  45754. 'authority' => $match[4],
  45755. 'path' => $match[5]
  45756. );
  45757. }
  45758. if (7 < count($match)) {
  45759. $components['query'] = $match[7];
  45760. }
  45761. if (9 < count($match)) {
  45762. $components['fragment'] = $match[9];
  45763. }
  45764. return $components;
  45765. }
  45766. public function generate(array $components)
  45767. {
  45768. $uri = $components['scheme'] . '://'
  45769. . $components['authority']
  45770. . $components['path'];
  45771. if (array_key_exists('query', $components)) {
  45772. $uri .= $components['query'];
  45773. }
  45774. if (array_key_exists('fragment', $components)) {
  45775. $uri .= '#' . $components['fragment'];
  45776. }
  45777. return $uri;
  45778. }
  45779. public function resolve($uri, $baseUri = null)
  45780. {
  45781. if ($uri == '') {
  45782. return $baseUri;
  45783. }
  45784. $components = $this->parse($uri);
  45785. $path = $components['path'];
  45786. if (! empty($components['scheme'])) {
  45787. return $uri;
  45788. }
  45789. $baseComponents = $this->parse($baseUri);
  45790. $basePath = $baseComponents['path'];
  45791. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  45792. if (isset($components['fragment'])) {
  45793. $baseComponents['fragment'] = $components['fragment'];
  45794. }
  45795. return $this->generate($baseComponents);
  45796. }
  45797. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  45798. {
  45799. $relativePath = self::normalizePath($relativePath);
  45800. if ($relativePath == '') {
  45801. return $basePath;
  45802. }
  45803. if ($relativePath{0} == '/') {
  45804. return $relativePath;
  45805. }
  45806. $basePathSegments = explode('/', $basePath);
  45807. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  45808. $numLevelUp = strlen($match[0]) /3 + 1;
  45809. if ($numLevelUp >= count($basePathSegments)) {
  45810. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  45811. }
  45812. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  45813. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  45814. return implode('/', $basePathSegments) . '/' . $path;
  45815. }
  45816. private static function normalizePath($path)
  45817. {
  45818. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  45819. $path = preg_replace('|//|', '/', $path);
  45820. return $path;
  45821. }
  45822. public function isValid($uri)
  45823. {
  45824. $components = $this->parse($uri);
  45825. return !empty($components);
  45826. }
  45827. }
  45828. <?php
  45829. namespace JsonSchema\Uri;
  45830. use JsonSchema\Uri\Retrievers\FileGetContents;
  45831. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  45832. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  45833. use JsonSchema\Validator;
  45834. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  45835. use JsonSchema\Exception\JsonDecodingException;
  45836. use JsonSchema\Exception\ResourceNotFoundException;
  45837. class UriRetriever implements BaseUriRetrieverInterface
  45838. {
  45839. protected $uriRetriever = null;
  45840. private $schemaCache = array();
  45841. public function confirmMediaType($uriRetriever, $uri)
  45842. {
  45843. $contentType = $uriRetriever->getContentType();
  45844. if (is_null($contentType)) {
  45845. return;
  45846. }
  45847. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  45848. return;
  45849. }
  45850. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  45851. return true;
  45852. }
  45853. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  45854. }
  45855. public function getUriRetriever()
  45856. {
  45857. if (is_null($this->uriRetriever)) {
  45858. $this->setUriRetriever(new FileGetContents);
  45859. }
  45860. return $this->uriRetriever;
  45861. }
  45862. public function resolvePointer($jsonSchema, $uri)
  45863. {
  45864. $resolver = new UriResolver();
  45865. $parsed = $resolver->parse($uri);
  45866. if (empty($parsed['fragment'])) {
  45867. return $jsonSchema;
  45868. }
  45869. $path = explode('/', $parsed['fragment']);
  45870. while ($path) {
  45871. $pathElement = array_shift($path);
  45872. if (! empty($pathElement)) {
  45873. $pathElement = str_replace('~1', '/', $pathElement);
  45874. $pathElement = str_replace('~0', '~', $pathElement);
  45875. if (! empty($jsonSchema->$pathElement)) {
  45876. $jsonSchema = $jsonSchema->$pathElement;
  45877. } else {
  45878. throw new ResourceNotFoundException(
  45879. 'Fragment "' . $parsed['fragment'] . '" not found'
  45880. . ' in ' . $uri
  45881. );
  45882. }
  45883. if (! is_object($jsonSchema)) {
  45884. throw new ResourceNotFoundException(
  45885. 'Fragment part "' . $pathElement . '" is no object '
  45886. . ' in ' . $uri
  45887. );
  45888. }
  45889. }
  45890. }
  45891. return $jsonSchema;
  45892. }
  45893. public function retrieve($uri, $baseUri = null)
  45894. {
  45895. $resolver = new UriResolver();
  45896. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  45897. $arParts = $resolver->parse($resolvedUri);
  45898. if (isset($arParts['fragment'])) {
  45899. unset($arParts['fragment']);
  45900. $fetchUri = $resolver->generate($arParts);
  45901. }
  45902. $jsonSchema = $this->loadSchema($fetchUri);
  45903. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  45904. if ($jsonSchema instanceof \stdClass) {
  45905. $jsonSchema->id = $resolvedUri;
  45906. }
  45907. return $jsonSchema;
  45908. }
  45909. protected function loadSchema($fetchUri)
  45910. {
  45911. if (isset($this->schemaCache[$fetchUri])) {
  45912. return $this->schemaCache[$fetchUri];
  45913. }
  45914. $uriRetriever = $this->getUriRetriever();
  45915. $contents = $this->uriRetriever->retrieve($fetchUri);
  45916. $this->confirmMediaType($uriRetriever, $fetchUri);
  45917. $jsonSchema = json_decode($contents);
  45918. if (JSON_ERROR_NONE < $error = json_last_error()) {
  45919. throw new JsonDecodingException($error);
  45920. }
  45921. $this->schemaCache[$fetchUri] = $jsonSchema;
  45922. return $jsonSchema;
  45923. }
  45924. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  45925. {
  45926. $this->uriRetriever = $uriRetriever;
  45927. return $this;
  45928. }
  45929. public function parse($uri)
  45930. {
  45931. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  45932. $components = array();
  45933. if (5 < count($match)) {
  45934. $components = array(
  45935. 'scheme' => $match[2],
  45936. 'authority' => $match[4],
  45937. 'path' => $match[5]
  45938. );
  45939. }
  45940. if (7 < count($match)) {
  45941. $components['query'] = $match[7];
  45942. }
  45943. if (9 < count($match)) {
  45944. $components['fragment'] = $match[9];
  45945. }
  45946. return $components;
  45947. }
  45948. public function generate(array $components)
  45949. {
  45950. $uri = $components['scheme'] . '://'
  45951. . $components['authority']
  45952. . $components['path'];
  45953. if (array_key_exists('query', $components)) {
  45954. $uri .= $components['query'];
  45955. }
  45956. if (array_key_exists('fragment', $components)) {
  45957. $uri .= $components['fragment'];
  45958. }
  45959. return $uri;
  45960. }
  45961. public function resolve($uri, $baseUri = null)
  45962. {
  45963. $components = $this->parse($uri);
  45964. $path = $components['path'];
  45965. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  45966. return $uri;
  45967. }
  45968. $baseComponents = $this->parse($baseUri);
  45969. $basePath = $baseComponents['path'];
  45970. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  45971. return $this->generate($baseComponents);
  45972. }
  45973. public function isValid($uri)
  45974. {
  45975. $components = $this->parse($uri);
  45976. return !empty($components);
  45977. }
  45978. }
  45979. <?php
  45980. namespace JsonSchema;
  45981. interface UriResolverInterface
  45982. {
  45983. public function resolve($uri, $baseUri = null);
  45984. }
  45985. <?php
  45986. namespace JsonSchema;
  45987. interface UriRetrieverInterface
  45988. {
  45989. public function retrieve($uri, $baseUri = null);
  45990. }
  45991. <?php
  45992. namespace JsonSchema;
  45993. use JsonSchema\Constraints\Constraint;
  45994. use JsonSchema\Entity\JsonPointer;
  45995. class Validator extends Constraint
  45996. {
  45997. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  45998. public function check($value, $schema = null, JsonPointer $path = null, $i = null)
  45999. {
  46000. $validator = $this->factory->createInstanceFor('schema');
  46001. $validator->check($value, $schema);
  46002. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  46003. }
  46004. public function coerce(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46005. {
  46006. $validator = $this->factory->createInstanceFor('schema');
  46007. $validator->coerce($value, $schema);
  46008. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  46009. }
  46010. }
  46011. Copyright (C) 2015 Composer
  46012. Permission is hereby granted, free of charge, to any person obtaining a copy of
  46013. this software and associated documentation files (the "Software"), to deal in
  46014. the Software without restriction, including without limitation the rights to
  46015. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  46016. of the Software, and to permit persons to whom the Software is furnished to do
  46017. so, subject to the following conditions:
  46018. The above copyright notice and this permission notice shall be included in all
  46019. copies or substantial portions of the Software.
  46020. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46021. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46022. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46023. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46024. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46025. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46026. SOFTWARE.
  46027. <?php
  46028. namespace Composer\Spdx;
  46029. class SpdxLicenses
  46030. {
  46031. const LICENSES_FILE = 'spdx-licenses.json';
  46032. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  46033. private $licenses;
  46034. private $licensesExpression;
  46035. private $exceptions;
  46036. private $exceptionsExpression;
  46037. public function __construct()
  46038. {
  46039. $this->loadLicenses();
  46040. $this->loadExceptions();
  46041. }
  46042. public function getLicenseByIdentifier($identifier)
  46043. {
  46044. if (!isset($this->licenses[$identifier])) {
  46045. return;
  46046. }
  46047. $license = $this->licenses[$identifier];
  46048. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseText';
  46049. return $license;
  46050. }
  46051. public function getExceptionByIdentifier($identifier)
  46052. {
  46053. if (!isset($this->exceptions[$identifier])) {
  46054. return;
  46055. }
  46056. $license = $this->exceptions[$identifier];
  46057. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText';
  46058. return $license;
  46059. }
  46060. public function getIdentifierByName($name)
  46061. {
  46062. foreach ($this->licenses as $identifier => $licenseData) {
  46063. if ($licenseData[0] === $name) {
  46064. return $identifier;
  46065. }
  46066. }
  46067. foreach ($this->exceptions as $identifier => $licenseData) {
  46068. if ($licenseData[0] === $name) {
  46069. return $identifier;
  46070. }
  46071. }
  46072. }
  46073. public function isOsiApprovedByIdentifier($identifier)
  46074. {
  46075. return $this->licenses[$identifier][1];
  46076. }
  46077. public function validate($license)
  46078. {
  46079. if (is_array($license)) {
  46080. $count = count($license);
  46081. if ($count !== count(array_filter($license, 'is_string'))) {
  46082. throw new \InvalidArgumentException('Array of strings expected.');
  46083. }
  46084. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  46085. }
  46086. if (!is_string($license)) {
  46087. throw new \InvalidArgumentException(sprintf(
  46088. 'Array or String expected, %s given.',
  46089. gettype($license)
  46090. ));
  46091. }
  46092. return $this->isValidLicenseString($license);
  46093. }
  46094. public static function getResourcesDir()
  46095. {
  46096. return dirname(__DIR__) . '/res';
  46097. }
  46098. private function loadLicenses()
  46099. {
  46100. if (null === $this->licenses) {
  46101. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  46102. $this->licenses = json_decode($json, true);
  46103. }
  46104. }
  46105. private function loadExceptions()
  46106. {
  46107. if (null === $this->exceptions) {
  46108. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  46109. $this->exceptions = json_decode($json, true);
  46110. }
  46111. }
  46112. private function getLicensesExpression()
  46113. {
  46114. if (null === $this->licensesExpression) {
  46115. $licenses = array_map('preg_quote', array_keys($this->licenses));
  46116. rsort($licenses);
  46117. $licenses = implode('|', $licenses);
  46118. $this->licensesExpression = $licenses;
  46119. }
  46120. return $this->licensesExpression;
  46121. }
  46122. private function getExceptionsExpression()
  46123. {
  46124. if (null === $this->exceptionsExpression) {
  46125. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  46126. rsort($exceptions);
  46127. $exceptions = implode('|', $exceptions);
  46128. $this->exceptionsExpression = $exceptions;
  46129. }
  46130. return $this->exceptionsExpression;
  46131. }
  46132. private function isValidLicenseString($license)
  46133. {
  46134. if (isset($this->licenses[$license])) {
  46135. return true;
  46136. }
  46137. $licenses = $this->getLicensesExpression();
  46138. $exceptions = $this->getExceptionsExpression();
  46139. $regex = <<<REGEX
  46140. {
  46141. (?(DEFINE)
  46142. # idstring: 1*( ALPHA / DIGIT / - / . )
  46143. (?<idstring>[\pL\pN.-]{1,})
  46144. # license-id: taken from list
  46145. (?<licenseid>${licenses})
  46146. # license-exception-id: taken from list
  46147. (?<licenseexceptionid>${exceptions})
  46148. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  46149. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  46150. # simple-expresssion: license-id / license-id+ / license-ref
  46151. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  46152. # compound-expression: 1*(
  46153. # simple-expression /
  46154. # simple-expression WITH license-exception-id /
  46155. # compound-expression AND compound-expression /
  46156. # compound-expression OR compound-expression
  46157. # ) / ( compound-expression ) )
  46158. (?<compound_head>
  46159. (?&simple_expression) ( \s+ (?:with|WITH) \s+ (?&licenseexceptionid))?
  46160. | \( \s* (?&compound_expression) \s* \)
  46161. )
  46162. (?<compound_expression>
  46163. (?&compound_head) (?: \s+ (?:and|AND|or|OR) \s+ (?&compound_expression))?
  46164. )
  46165. # license-expression: 1*1(simple-expression / compound-expression)
  46166. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  46167. ) # end of define
  46168. ^(NONE | NOASSERTION | (?&license_expression))$
  46169. }x
  46170. REGEX;
  46171. $match = preg_match($regex, $license);
  46172. if (0 === $match) {
  46173. return false;
  46174. }
  46175. if (false === $match) {
  46176. throw new \RuntimeException('Regex failed to compile/run.');
  46177. }
  46178. return true;
  46179. }
  46180. }
  46181. Copyright (C) 2015 Composer
  46182. Permission is hereby granted, free of charge, to any person obtaining a copy of
  46183. this software and associated documentation files (the "Software"), to deal in
  46184. the Software without restriction, including without limitation the rights to
  46185. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  46186. of the Software, and to permit persons to whom the Software is furnished to do
  46187. so, subject to the following conditions:
  46188. The above copyright notice and this permission notice shall be included in all
  46189. copies or substantial portions of the Software.
  46190. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46191. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46192. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46193. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46194. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46195. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46196. SOFTWARE.
  46197. <?php
  46198. namespace Composer\Semver;
  46199. use Composer\Semver\Constraint\Constraint;
  46200. class Comparator
  46201. {
  46202. public static function greaterThan($version1, $version2)
  46203. {
  46204. return self::compare($version1, '>', $version2);
  46205. }
  46206. public static function greaterThanOrEqualTo($version1, $version2)
  46207. {
  46208. return self::compare($version1, '>=', $version2);
  46209. }
  46210. public static function lessThan($version1, $version2)
  46211. {
  46212. return self::compare($version1, '<', $version2);
  46213. }
  46214. public static function lessThanOrEqualTo($version1, $version2)
  46215. {
  46216. return self::compare($version1, '<=', $version2);
  46217. }
  46218. public static function equalTo($version1, $version2)
  46219. {
  46220. return self::compare($version1, '==', $version2);
  46221. }
  46222. public static function notEqualTo($version1, $version2)
  46223. {
  46224. return self::compare($version1, '!=', $version2);
  46225. }
  46226. public static function compare($version1, $operator, $version2)
  46227. {
  46228. $constraint = new Constraint($operator, $version2);
  46229. return $constraint->matches(new Constraint('==', $version1));
  46230. }
  46231. }
  46232. <?php
  46233. namespace Composer\Semver\Constraint;
  46234. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  46235. abstract class AbstractConstraint implements ConstraintInterface
  46236. {
  46237. protected $prettyString;
  46238. public function matches(ConstraintInterface $provider)
  46239. {
  46240. if ($provider instanceof $this) {
  46241. return $this->matchSpecific($provider);
  46242. }
  46243. return $provider->matches($this);
  46244. }
  46245. public function setPrettyString($prettyString)
  46246. {
  46247. $this->prettyString = $prettyString;
  46248. }
  46249. public function getPrettyString()
  46250. {
  46251. if ($this->prettyString) {
  46252. return $this->prettyString;
  46253. }
  46254. return $this->__toString();
  46255. }
  46256. }
  46257. <?php
  46258. namespace Composer\Semver\Constraint;
  46259. class Constraint implements ConstraintInterface
  46260. {
  46261. const OP_EQ = 0;
  46262. const OP_LT = 1;
  46263. const OP_LE = 2;
  46264. const OP_GT = 3;
  46265. const OP_GE = 4;
  46266. const OP_NE = 5;
  46267. private static $transOpStr = array(
  46268. '=' => self::OP_EQ,
  46269. '==' => self::OP_EQ,
  46270. '<' => self::OP_LT,
  46271. '<=' => self::OP_LE,
  46272. '>' => self::OP_GT,
  46273. '>=' => self::OP_GE,
  46274. '<>' => self::OP_NE,
  46275. '!=' => self::OP_NE,
  46276. );
  46277. private static $transOpInt = array(
  46278. self::OP_EQ => '==',
  46279. self::OP_LT => '<',
  46280. self::OP_LE => '<=',
  46281. self::OP_GT => '>',
  46282. self::OP_GE => '>=',
  46283. self::OP_NE => '!=',
  46284. );
  46285. protected $operator;
  46286. protected $version;
  46287. protected $prettyString;
  46288. public function matches(ConstraintInterface $provider)
  46289. {
  46290. if ($provider instanceof $this) {
  46291. return $this->matchSpecific($provider);
  46292. }
  46293. return $provider->matches($this);
  46294. }
  46295. public function setPrettyString($prettyString)
  46296. {
  46297. $this->prettyString = $prettyString;
  46298. }
  46299. public function getPrettyString()
  46300. {
  46301. if ($this->prettyString) {
  46302. return $this->prettyString;
  46303. }
  46304. return $this->__toString();
  46305. }
  46306. public static function getSupportedOperators()
  46307. {
  46308. return array_keys(self::$transOpStr);
  46309. }
  46310. public function __construct($operator, $version)
  46311. {
  46312. if (!isset(self::$transOpStr[$operator])) {
  46313. throw new \InvalidArgumentException(sprintf(
  46314. 'Invalid operator "%s" given, expected one of: %s',
  46315. $operator,
  46316. implode(', ', self::getSupportedOperators())
  46317. ));
  46318. }
  46319. $this->operator = self::$transOpStr[$operator];
  46320. $this->version = $version;
  46321. }
  46322. public function versionCompare($a, $b, $operator, $compareBranches = false)
  46323. {
  46324. if (!isset(self::$transOpStr[$operator])) {
  46325. throw new \InvalidArgumentException(sprintf(
  46326. 'Invalid operator "%s" given, expected one of: %s',
  46327. $operator,
  46328. implode(', ', self::getSupportedOperators())
  46329. ));
  46330. }
  46331. $aIsBranch = 'dev-' === substr($a, 0, 4);
  46332. $bIsBranch = 'dev-' === substr($b, 0, 4);
  46333. if ($aIsBranch && $bIsBranch) {
  46334. return $operator === '==' && $a === $b;
  46335. }
  46336. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  46337. return false;
  46338. }
  46339. return version_compare($a, $b, $operator);
  46340. }
  46341. public function matchSpecific(Constraint $provider, $compareBranches = false)
  46342. {
  46343. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  46344. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  46345. $isEqualOp = self::OP_EQ === $this->operator;
  46346. $isNonEqualOp = self::OP_NE === $this->operator;
  46347. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  46348. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  46349. if ($isNonEqualOp || $isProviderNonEqualOp) {
  46350. return !$isEqualOp && !$isProviderEqualOp
  46351. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  46352. }
  46353. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  46354. return true;
  46355. }
  46356. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  46357. if ($provider->version === $this->version
  46358. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  46359. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  46360. return false;
  46361. }
  46362. return true;
  46363. }
  46364. return false;
  46365. }
  46366. public function __toString()
  46367. {
  46368. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  46369. }
  46370. }
  46371. <?php
  46372. namespace Composer\Semver\Constraint;
  46373. interface ConstraintInterface
  46374. {
  46375. public function matches(ConstraintInterface $provider);
  46376. public function getPrettyString();
  46377. public function __toString();
  46378. }
  46379. <?php
  46380. namespace Composer\Semver\Constraint;
  46381. class EmptyConstraint implements ConstraintInterface
  46382. {
  46383. protected $prettyString;
  46384. public function matches(ConstraintInterface $provider)
  46385. {
  46386. return true;
  46387. }
  46388. public function setPrettyString($prettyString)
  46389. {
  46390. $this->prettyString = $prettyString;
  46391. }
  46392. public function getPrettyString()
  46393. {
  46394. if ($this->prettyString) {
  46395. return $this->prettyString;
  46396. }
  46397. return $this->__toString();
  46398. }
  46399. public function __toString()
  46400. {
  46401. return '[]';
  46402. }
  46403. }
  46404. <?php
  46405. namespace Composer\Semver\Constraint;
  46406. class MultiConstraint implements ConstraintInterface
  46407. {
  46408. protected $constraints;
  46409. protected $prettyString;
  46410. protected $conjunctive;
  46411. public function __construct(array $constraints, $conjunctive = true)
  46412. {
  46413. $this->constraints = $constraints;
  46414. $this->conjunctive = $conjunctive;
  46415. }
  46416. public function getConstraints()
  46417. {
  46418. return $this->constraints;
  46419. }
  46420. public function isConjunctive()
  46421. {
  46422. return $this->conjunctive;
  46423. }
  46424. public function isDisjunctive()
  46425. {
  46426. return !$this->conjunctive;
  46427. }
  46428. public function matches(ConstraintInterface $provider)
  46429. {
  46430. if (false === $this->conjunctive) {
  46431. foreach ($this->constraints as $constraint) {
  46432. if ($constraint->matches($provider)) {
  46433. return true;
  46434. }
  46435. }
  46436. return false;
  46437. }
  46438. foreach ($this->constraints as $constraint) {
  46439. if (!$constraint->matches($provider)) {
  46440. return false;
  46441. }
  46442. }
  46443. return true;
  46444. }
  46445. public function setPrettyString($prettyString)
  46446. {
  46447. $this->prettyString = $prettyString;
  46448. }
  46449. public function getPrettyString()
  46450. {
  46451. if ($this->prettyString) {
  46452. return $this->prettyString;
  46453. }
  46454. return $this->__toString();
  46455. }
  46456. public function __toString()
  46457. {
  46458. $constraints = array();
  46459. foreach ($this->constraints as $constraint) {
  46460. $constraints[] = (string) $constraint;
  46461. }
  46462. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  46463. }
  46464. }
  46465. <?php
  46466. namespace Composer\Semver;
  46467. use Composer\Semver\Constraint\Constraint;
  46468. class Semver
  46469. {
  46470. const SORT_ASC = 1;
  46471. const SORT_DESC = -1;
  46472. private static $versionParser;
  46473. public static function satisfies($version, $constraints)
  46474. {
  46475. if (null === self::$versionParser) {
  46476. self::$versionParser = new VersionParser();
  46477. }
  46478. $versionParser = self::$versionParser;
  46479. $provider = new Constraint('==', $versionParser->normalize($version));
  46480. $constraints = $versionParser->parseConstraints($constraints);
  46481. return $constraints->matches($provider);
  46482. }
  46483. public static function satisfiedBy(array $versions, $constraints)
  46484. {
  46485. $versions = array_filter($versions, function ($version) use ($constraints) {
  46486. return Semver::satisfies($version, $constraints);
  46487. });
  46488. return array_values($versions);
  46489. }
  46490. public static function sort(array $versions)
  46491. {
  46492. return self::usort($versions, self::SORT_ASC);
  46493. }
  46494. public static function rsort(array $versions)
  46495. {
  46496. return self::usort($versions, self::SORT_DESC);
  46497. }
  46498. private static function usort(array $versions, $direction)
  46499. {
  46500. if (null === self::$versionParser) {
  46501. self::$versionParser = new VersionParser();
  46502. }
  46503. $versionParser = self::$versionParser;
  46504. $normalized = array();
  46505. foreach ($versions as $key => $version) {
  46506. $normalized[] = array($versionParser->normalize($version), $key);
  46507. }
  46508. usort($normalized, function (array $left, array $right) use ($direction) {
  46509. if ($left[0] === $right[0]) {
  46510. return 0;
  46511. }
  46512. if (Comparator::lessThan($left[0], $right[0])) {
  46513. return -$direction;
  46514. }
  46515. return $direction;
  46516. });
  46517. $sorted = array();
  46518. foreach ($normalized as $item) {
  46519. $sorted[] = $versions[$item[1]];
  46520. }
  46521. return $sorted;
  46522. }
  46523. }
  46524. <?php
  46525. namespace Composer\Semver;
  46526. use Composer\Semver\Constraint\ConstraintInterface;
  46527. use Composer\Semver\Constraint\EmptyConstraint;
  46528. use Composer\Semver\Constraint\MultiConstraint;
  46529. use Composer\Semver\Constraint\Constraint;
  46530. class VersionParser
  46531. {
  46532. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  46533. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  46534. public static function parseStability($version)
  46535. {
  46536. $version = preg_replace('{#.+$}i', '', $version);
  46537. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  46538. return 'dev';
  46539. }
  46540. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  46541. if (!empty($match[3])) {
  46542. return 'dev';
  46543. }
  46544. if (!empty($match[1])) {
  46545. if ('beta' === $match[1] || 'b' === $match[1]) {
  46546. return 'beta';
  46547. }
  46548. if ('alpha' === $match[1] || 'a' === $match[1]) {
  46549. return 'alpha';
  46550. }
  46551. if ('rc' === $match[1]) {
  46552. return 'RC';
  46553. }
  46554. }
  46555. return 'stable';
  46556. }
  46557. public static function normalizeStability($stability)
  46558. {
  46559. $stability = strtolower($stability);
  46560. return $stability === 'rc' ? 'RC' : $stability;
  46561. }
  46562. public function normalize($version, $fullVersion = null)
  46563. {
  46564. $version = trim($version);
  46565. if (null === $fullVersion) {
  46566. $fullVersion = $version;
  46567. }
  46568. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  46569. $version = $match[1];
  46570. }
  46571. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  46572. return '9999999-dev';
  46573. }
  46574. if ('dev-' === strtolower(substr($version, 0, 4))) {
  46575. return 'dev-' . substr($version, 4);
  46576. }
  46577. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  46578. $version = $match[1];
  46579. }
  46580. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  46581. $version = $matches[1]
  46582. . (!empty($matches[2]) ? $matches[2] : '.0')
  46583. . (!empty($matches[3]) ? $matches[3] : '.0')
  46584. . (!empty($matches[4]) ? $matches[4] : '.0');
  46585. $index = 5;
  46586. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  46587. $version = preg_replace('{\D}', '.', $matches[1]);
  46588. $index = 2;
  46589. }
  46590. if (isset($index)) {
  46591. if (!empty($matches[$index])) {
  46592. if ('stable' === $matches[$index]) {
  46593. return $version;
  46594. }
  46595. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  46596. }
  46597. if (!empty($matches[$index + 2])) {
  46598. $version .= '-dev';
  46599. }
  46600. return $version;
  46601. }
  46602. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  46603. try {
  46604. return $this->normalizeBranch($match[1]);
  46605. } catch (\Exception $e) {
  46606. }
  46607. }
  46608. $extraMessage = '';
  46609. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  46610. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  46611. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  46612. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  46613. }
  46614. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  46615. }
  46616. public function parseNumericAliasPrefix($branch)
  46617. {
  46618. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  46619. return $matches['version'] . '.';
  46620. }
  46621. return false;
  46622. }
  46623. public function normalizeBranch($name)
  46624. {
  46625. $name = trim($name);
  46626. if (in_array($name, array('master', 'trunk', 'default'))) {
  46627. return $this->normalize($name);
  46628. }
  46629. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  46630. $version = '';
  46631. for ($i = 1; $i < 5; ++$i) {
  46632. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  46633. }
  46634. return str_replace('x', '9999999', $version) . '-dev';
  46635. }
  46636. return 'dev-' . $name;
  46637. }
  46638. public function parseConstraints($constraints)
  46639. {
  46640. $prettyConstraint = $constraints;
  46641. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  46642. $constraints = empty($match[1]) ? '*' : $match[1];
  46643. }
  46644. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  46645. $constraints = $match[1];
  46646. }
  46647. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  46648. $orGroups = array();
  46649. foreach ($orConstraints as $constraints) {
  46650. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  46651. if (count($andConstraints) > 1) {
  46652. $constraintObjects = array();
  46653. foreach ($andConstraints as $constraint) {
  46654. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  46655. $constraintObjects[] = $parsedConstraint;
  46656. }
  46657. }
  46658. } else {
  46659. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  46660. }
  46661. if (1 === count($constraintObjects)) {
  46662. $constraint = $constraintObjects[0];
  46663. } else {
  46664. $constraint = new MultiConstraint($constraintObjects);
  46665. }
  46666. $orGroups[] = $constraint;
  46667. }
  46668. if (1 === count($orGroups)) {
  46669. $constraint = $orGroups[0];
  46670. } elseif (2 === count($orGroups)
  46671. && $orGroups[0] instanceof MultiConstraint
  46672. && $orGroups[1] instanceof MultiConstraint
  46673. && 2 === count($orGroups[0]->getConstraints())
  46674. && 2 === count($orGroups[1]->getConstraints())
  46675. && ($a = (string) $orGroups[0])
  46676. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  46677. && ($b = (string) $orGroups[1])
  46678. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  46679. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  46680. ) {
  46681. $constraint = new MultiConstraint(array(
  46682. new Constraint('>=', substr($a, 4, $posA - 5)),
  46683. new Constraint('<', substr($b, $posB + 2, -1)),
  46684. ));
  46685. } else {
  46686. $constraint = new MultiConstraint($orGroups, false);
  46687. }
  46688. $constraint->setPrettyString($prettyConstraint);
  46689. return $constraint;
  46690. }
  46691. private function parseConstraint($constraint)
  46692. {
  46693. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  46694. $constraint = $match[1];
  46695. if ($match[2] !== 'stable') {
  46696. $stabilityModifier = $match[2];
  46697. }
  46698. }
  46699. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  46700. return array(new EmptyConstraint());
  46701. }
  46702. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  46703. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  46704. if (substr($constraint, 0, 2) === '~>') {
  46705. throw new \UnexpectedValueException(
  46706. 'Could not parse version constraint ' . $constraint . ': ' .
  46707. 'Invalid operator "~>", you probably meant to use the "~" operator'
  46708. );
  46709. }
  46710. if (isset($matches[4]) && '' !== $matches[4]) {
  46711. $position = 4;
  46712. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  46713. $position = 3;
  46714. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  46715. $position = 2;
  46716. } else {
  46717. $position = 1;
  46718. }
  46719. $stabilitySuffix = '';
  46720. if (!empty($matches[5])) {
  46721. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  46722. }
  46723. if (!empty($matches[7])) {
  46724. $stabilitySuffix .= '-dev';
  46725. }
  46726. if (!$stabilitySuffix) {
  46727. $stabilitySuffix = '-dev';
  46728. }
  46729. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  46730. $lowerBound = new Constraint('>=', $lowVersion);
  46731. $highPosition = max(1, $position - 1);
  46732. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  46733. $upperBound = new Constraint('<', $highVersion);
  46734. return array(
  46735. $lowerBound,
  46736. $upperBound,
  46737. );
  46738. }
  46739. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  46740. if ('0' !== $matches[1] || '' === $matches[2]) {
  46741. $position = 1;
  46742. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  46743. $position = 2;
  46744. } else {
  46745. $position = 3;
  46746. }
  46747. $stabilitySuffix = '';
  46748. if (empty($matches[5]) && empty($matches[7])) {
  46749. $stabilitySuffix .= '-dev';
  46750. }
  46751. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  46752. $lowerBound = new Constraint('>=', $lowVersion);
  46753. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  46754. $upperBound = new Constraint('<', $highVersion);
  46755. return array(
  46756. $lowerBound,
  46757. $upperBound,
  46758. );
  46759. }
  46760. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  46761. if (isset($matches[3]) && '' !== $matches[3]) {
  46762. $position = 3;
  46763. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  46764. $position = 2;
  46765. } else {
  46766. $position = 1;
  46767. }
  46768. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  46769. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  46770. if ($lowVersion === '0.0.0.0-dev') {
  46771. return array(new Constraint('<', $highVersion));
  46772. }
  46773. return array(
  46774. new Constraint('>=', $lowVersion),
  46775. new Constraint('<', $highVersion),
  46776. );
  46777. }
  46778. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  46779. $lowStabilitySuffix = '';
  46780. if (empty($matches[6]) && empty($matches[8])) {
  46781. $lowStabilitySuffix = '-dev';
  46782. }
  46783. $lowVersion = $this->normalize($matches['from']);
  46784. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  46785. $empty = function ($x) {
  46786. return ($x === 0 || $x === '0') ? false : empty($x);
  46787. };
  46788. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  46789. $highVersion = $this->normalize($matches['to']);
  46790. $upperBound = new Constraint('<=', $highVersion);
  46791. } else {
  46792. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  46793. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  46794. $upperBound = new Constraint('<', $highVersion);
  46795. }
  46796. return array(
  46797. $lowerBound,
  46798. $upperBound,
  46799. );
  46800. }
  46801. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  46802. try {
  46803. $version = $this->normalize($matches[2]);
  46804. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  46805. $version .= '-' . $stabilityModifier;
  46806. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  46807. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  46808. if (substr($matches[2], 0, 4) !== 'dev-') {
  46809. $version .= '-dev';
  46810. }
  46811. }
  46812. }
  46813. return array(new Constraint($matches[1] ?: '=', $version));
  46814. } catch (\Exception $e) {
  46815. }
  46816. }
  46817. $message = 'Could not parse version constraint ' . $constraint;
  46818. if (isset($e)) {
  46819. $message .= ': ' . $e->getMessage();
  46820. }
  46821. throw new \UnexpectedValueException($message);
  46822. }
  46823. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  46824. {
  46825. for ($i = 4; $i > 0; --$i) {
  46826. if ($i > $position) {
  46827. $matches[$i] = $pad;
  46828. } elseif ($i === $position && $increment) {
  46829. $matches[$i] += $increment;
  46830. if ($matches[$i] < 0) {
  46831. $matches[$i] = $pad;
  46832. --$position;
  46833. if ($i === 1) {
  46834. return;
  46835. }
  46836. }
  46837. }
  46838. }
  46839. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  46840. }
  46841. private function expandStability($stability)
  46842. {
  46843. $stability = strtolower($stability);
  46844. switch ($stability) {
  46845. case 'a':
  46846. return 'alpha';
  46847. case 'b':
  46848. return 'beta';
  46849. case 'p':
  46850. case 'pl':
  46851. return 'patch';
  46852. case 'rc':
  46853. return 'RC';
  46854. default:
  46855. return $stability;
  46856. }
  46857. }
  46858. }
  46859. Copyright (C) 2016 Composer
  46860. Permission is hereby granted, free of charge, to any person obtaining a copy of
  46861. this software and associated documentation files (the "Software"), to deal in
  46862. the Software without restriction, including without limitation the rights to
  46863. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  46864. of the Software, and to permit persons to whom the Software is furnished to do
  46865. so, subject to the following conditions:
  46866. The above copyright notice and this permission notice shall be included in all
  46867. copies or substantial portions of the Software.
  46868. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46869. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46870. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46871. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46872. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46873. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46874. SOFTWARE.
  46875. <?php
  46876. namespace Composer\CaBundle;
  46877. use Psr\Log\LoggerInterface;
  46878. use Symfony\Component\Process\PhpProcess;
  46879. class CaBundle
  46880. {
  46881. private static $caPath;
  46882. private static $caFileValidity = array();
  46883. private static $useOpensslParse;
  46884. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  46885. {
  46886. if (self::$caPath !== null) {
  46887. return self::$caPath;
  46888. }
  46889. $envCertFile = getenv('SSL_CERT_FILE');
  46890. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  46891. return self::$caPath = $envCertFile;
  46892. }
  46893. $envCertDir = getenv('SSL_CERT_DIR');
  46894. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  46895. return self::$caPath = $envCertDir;
  46896. }
  46897. $configured = ini_get('openssl.cafile');
  46898. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  46899. return self::$caPath = $configured;
  46900. }
  46901. $configured = ini_get('openssl.capath');
  46902. if ($configured && is_dir($configured) && is_readable($configured)) {
  46903. return self::$caPath = $configured;
  46904. }
  46905. $caBundlePaths = array(
  46906. '/etc/pki/tls/certs/ca-bundle.crt',
  46907. '/etc/ssl/certs/ca-certificates.crt',
  46908. '/etc/ssl/ca-bundle.pem',
  46909. '/usr/local/share/certs/ca-root-nss.crt',
  46910. '/usr/ssl/certs/ca-bundle.crt',
  46911. '/opt/local/share/curl/curl-ca-bundle.crt',
  46912. '/usr/local/share/curl/curl-ca-bundle.crt',
  46913. '/usr/share/ssl/certs/ca-bundle.crt',
  46914. '/etc/ssl/cert.pem',
  46915. '/usr/local/etc/ssl/cert.pem',
  46916. '/usr/local/etc/openssl/cert.pem',
  46917. );
  46918. foreach ($caBundlePaths as $caBundle) {
  46919. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  46920. return self::$caPath = $caBundle;
  46921. }
  46922. }
  46923. foreach ($caBundlePaths as $caBundle) {
  46924. $caBundle = dirname($caBundle);
  46925. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  46926. return self::$caPath = $caBundle;
  46927. }
  46928. }
  46929. return self::$caPath = static::getBundledCaBundlePath();
  46930. }
  46931. public static function getBundledCaBundlePath()
  46932. {
  46933. return __DIR__.'/../res/cacert.pem';
  46934. }
  46935. public static function validateCaFile($filename, LoggerInterface $logger = null)
  46936. {
  46937. static $warned = false;
  46938. if (isset(self::$caFileValidity[$filename])) {
  46939. return self::$caFileValidity[$filename];
  46940. }
  46941. $contents = file_get_contents($filename);
  46942. if (!static::isOpensslParseSafe()) {
  46943. if (!$warned && $logger) {
  46944. $logger->warning(sprintf(
  46945. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  46946. PHP_VERSION
  46947. ));
  46948. $warned = true;
  46949. }
  46950. $isValid = !empty($contents);
  46951. } else {
  46952. $isValid = (bool) openssl_x509_parse($contents);
  46953. }
  46954. if ($logger) {
  46955. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  46956. }
  46957. return self::$caFileValidity[$filename] = $isValid;
  46958. }
  46959. public static function isOpensslParseSafe()
  46960. {
  46961. if (null !== self::$useOpensslParse) {
  46962. return self::$useOpensslParse;
  46963. }
  46964. if (PHP_VERSION_ID >= 50600) {
  46965. return self::$useOpensslParse = true;
  46966. }
  46967. if (
  46968. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  46969. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  46970. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  46971. ) {
  46972. return self::$useOpensslParse = true;
  46973. }
  46974. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  46975. return self::$useOpensslParse = false;
  46976. }
  46977. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  46978. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  46979. if (preg_match($regex, PHP_VERSION, $m)) {
  46980. return ((int) $m[1]) >= $fixedVersion;
  46981. }
  46982. return false;
  46983. };
  46984. if (
  46985. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  46986. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  46987. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  46988. ) {
  46989. return self::$useOpensslParse = true;
  46990. }
  46991. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  46992. return self::$useOpensslParse = false;
  46993. }
  46994. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  46995. $script = <<<'EOT'
  46996. error_reporting(-1);
  46997. $info = openssl_x509_parse(base64_decode('%s'));
  46998. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  46999. EOT;
  47000. $script = '<'."?php\n".sprintf($script, $cert);
  47001. try {
  47002. $process = new PhpProcess($script);
  47003. $process->mustRun();
  47004. } catch (\Exception $e) {
  47005. return self::$useOpensslParse = false;
  47006. }
  47007. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  47008. $errorOutput = trim($process->getErrorOutput());
  47009. if (
  47010. count($output) === 3
  47011. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  47012. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  47013. && $output[2] === 'int(-1)'
  47014. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  47015. ) {
  47016. return self::$useOpensslParse = true;
  47017. }
  47018. return self::$useOpensslParse = false;
  47019. }
  47020. public static function reset()
  47021. {
  47022. self::$caFileValidity = array();
  47023. self::$caPath = null;
  47024. self::$useOpensslParse = null;
  47025. }
  47026. }
  47027. Copyright (c) 2012 PHP Framework Interoperability Group
  47028. Permission is hereby granted, free of charge, to any person obtaining a copy
  47029. of this software and associated documentation files (the "Software"), to deal
  47030. in the Software without restriction, including without limitation the rights
  47031. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47032. copies of the Software, and to permit persons to whom the Software is
  47033. furnished to do so, subject to the following conditions:
  47034. The above copyright notice and this permission notice shall be included in
  47035. all copies or substantial portions of the Software.
  47036. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47037. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47038. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47039. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47040. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47041. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  47042. THE SOFTWARE.
  47043. <?php
  47044. namespace Psr\Log;
  47045. abstract class AbstractLogger implements LoggerInterface
  47046. {
  47047. public function emergency($message, array $context = array())
  47048. {
  47049. $this->log(LogLevel::EMERGENCY, $message, $context);
  47050. }
  47051. public function alert($message, array $context = array())
  47052. {
  47053. $this->log(LogLevel::ALERT, $message, $context);
  47054. }
  47055. public function critical($message, array $context = array())
  47056. {
  47057. $this->log(LogLevel::CRITICAL, $message, $context);
  47058. }
  47059. public function error($message, array $context = array())
  47060. {
  47061. $this->log(LogLevel::ERROR, $message, $context);
  47062. }
  47063. public function warning($message, array $context = array())
  47064. {
  47065. $this->log(LogLevel::WARNING, $message, $context);
  47066. }
  47067. public function notice($message, array $context = array())
  47068. {
  47069. $this->log(LogLevel::NOTICE, $message, $context);
  47070. }
  47071. public function info($message, array $context = array())
  47072. {
  47073. $this->log(LogLevel::INFO, $message, $context);
  47074. }
  47075. public function debug($message, array $context = array())
  47076. {
  47077. $this->log(LogLevel::DEBUG, $message, $context);
  47078. }
  47079. }
  47080. <?php
  47081. namespace Psr\Log;
  47082. class InvalidArgumentException extends \InvalidArgumentException
  47083. {
  47084. }
  47085. <?php
  47086. namespace Psr\Log;
  47087. class LogLevel
  47088. {
  47089. const EMERGENCY = 'emergency';
  47090. const ALERT = 'alert';
  47091. const CRITICAL = 'critical';
  47092. const ERROR = 'error';
  47093. const WARNING = 'warning';
  47094. const NOTICE = 'notice';
  47095. const INFO = 'info';
  47096. const DEBUG = 'debug';
  47097. }
  47098. <?php
  47099. namespace Psr\Log;
  47100. interface LoggerAwareInterface
  47101. {
  47102. public function setLogger(LoggerInterface $logger);
  47103. }
  47104. <?php
  47105. namespace Psr\Log;
  47106. trait LoggerAwareTrait
  47107. {
  47108. protected $logger;
  47109. public function setLogger(LoggerInterface $logger)
  47110. {
  47111. $this->logger = $logger;
  47112. }
  47113. }
  47114. <?php
  47115. namespace Psr\Log;
  47116. interface LoggerInterface
  47117. {
  47118. public function emergency($message, array $context = array());
  47119. public function alert($message, array $context = array());
  47120. public function critical($message, array $context = array());
  47121. public function error($message, array $context = array());
  47122. public function warning($message, array $context = array());
  47123. public function notice($message, array $context = array());
  47124. public function info($message, array $context = array());
  47125. public function debug($message, array $context = array());
  47126. public function log($level, $message, array $context = array());
  47127. }
  47128. <?php
  47129. namespace Psr\Log;
  47130. trait LoggerTrait
  47131. {
  47132. public function emergency($message, array $context = array())
  47133. {
  47134. $this->log(LogLevel::EMERGENCY, $message, $context);
  47135. }
  47136. public function alert($message, array $context = array())
  47137. {
  47138. $this->log(LogLevel::ALERT, $message, $context);
  47139. }
  47140. public function critical($message, array $context = array())
  47141. {
  47142. $this->log(LogLevel::CRITICAL, $message, $context);
  47143. }
  47144. public function error($message, array $context = array())
  47145. {
  47146. $this->log(LogLevel::ERROR, $message, $context);
  47147. }
  47148. public function warning($message, array $context = array())
  47149. {
  47150. $this->log(LogLevel::WARNING, $message, $context);
  47151. }
  47152. public function notice($message, array $context = array())
  47153. {
  47154. $this->log(LogLevel::NOTICE, $message, $context);
  47155. }
  47156. public function info($message, array $context = array())
  47157. {
  47158. $this->log(LogLevel::INFO, $message, $context);
  47159. }
  47160. public function debug($message, array $context = array())
  47161. {
  47162. $this->log(LogLevel::DEBUG, $message, $context);
  47163. }
  47164. abstract public function log($level, $message, array $context = array());
  47165. }
  47166. <?php
  47167. namespace Psr\Log;
  47168. class NullLogger extends AbstractLogger
  47169. {
  47170. public function log($level, $message, array $context = array())
  47171. {
  47172. }
  47173. }
  47174. <?php
  47175. namespace Psr\Log\Test;
  47176. use Psr\Log\LoggerInterface;
  47177. use Psr\Log\LogLevel;
  47178. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  47179. {
  47180. abstract public function getLogger();
  47181. abstract public function getLogs();
  47182. public function testImplements()
  47183. {
  47184. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  47185. }
  47186. public function testLogsAtAllLevels($level, $message)
  47187. {
  47188. $logger = $this->getLogger();
  47189. $logger->{$level}($message, array('user' => 'Bob'));
  47190. $logger->log($level, $message, array('user' => 'Bob'));
  47191. $expected = array(
  47192. $level.' message of level '.$level.' with context: Bob',
  47193. $level.' message of level '.$level.' with context: Bob',
  47194. );
  47195. $this->assertEquals($expected, $this->getLogs());
  47196. }
  47197. public function provideLevelsAndMessages()
  47198. {
  47199. return array(
  47200. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  47201. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  47202. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  47203. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  47204. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  47205. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  47206. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  47207. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  47208. );
  47209. }
  47210. public function testThrowsOnInvalidLevel()
  47211. {
  47212. $logger = $this->getLogger();
  47213. $logger->log('invalid level', 'Foo');
  47214. }
  47215. public function testContextReplacement()
  47216. {
  47217. $logger = $this->getLogger();
  47218. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  47219. $expected = array('info {Message {nothing} Bob Bar a}');
  47220. $this->assertEquals($expected, $this->getLogs());
  47221. }
  47222. public function testObjectCastToString()
  47223. {
  47224. if (method_exists($this, 'createPartialMock')) {
  47225. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  47226. } else {
  47227. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  47228. }
  47229. $dummy->expects($this->once())
  47230. ->method('__toString')
  47231. ->will($this->returnValue('DUMMY'));
  47232. $this->getLogger()->warning($dummy);
  47233. $expected = array('warning DUMMY');
  47234. $this->assertEquals($expected, $this->getLogs());
  47235. }
  47236. public function testContextCanContainAnything()
  47237. {
  47238. $context = array(
  47239. 'bool' => true,
  47240. 'null' => null,
  47241. 'string' => 'Foo',
  47242. 'int' => 0,
  47243. 'float' => 0.5,
  47244. 'nested' => array('with object' => new DummyTest),
  47245. 'object' => new \DateTime,
  47246. 'resource' => fopen('php://memory', 'r'),
  47247. );
  47248. $this->getLogger()->warning('Crazy context data', $context);
  47249. $expected = array('warning Crazy context data');
  47250. $this->assertEquals($expected, $this->getLogs());
  47251. }
  47252. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  47253. {
  47254. $logger = $this->getLogger();
  47255. $logger->warning('Random message', array('exception' => 'oops'));
  47256. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  47257. $expected = array(
  47258. 'warning Random message',
  47259. 'critical Uncaught Exception!'
  47260. );
  47261. $this->assertEquals($expected, $this->getLogs());
  47262. }
  47263. }
  47264. class DummyTest
  47265. {
  47266. public function __toString()
  47267. {
  47268. }
  47269. }
  47270. <?php
  47271. require_once __DIR__ . '/composer/autoload_real.php';
  47272. return ComposerAutoloaderInitComposerPhar1483808931::getLoader();
  47273. <?php
  47274. $vendorDir = dirname(dirname(__FILE__));
  47275. $baseDir = dirname($vendorDir);
  47276. return array(
  47277. );
  47278. <?php
  47279. $vendorDir = dirname(dirname(__FILE__));
  47280. $baseDir = dirname($vendorDir);
  47281. return array(
  47282. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  47283. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  47284. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  47285. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  47286. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  47287. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  47288. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  47289. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  47290. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  47291. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  47292. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  47293. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  47294. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  47295. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  47296. 'Composer\\' => array($baseDir . '/src/Composer'),
  47297. );
  47298. <?php
  47299. $vendorDir = dirname(dirname(__FILE__));
  47300. $baseDir = dirname($vendorDir);
  47301. return array(
  47302. );
  47303. <?php
  47304. $vendorDir = dirname(dirname(__FILE__));
  47305. $baseDir = dirname($vendorDir);
  47306. return array(
  47307. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  47308. );
  47309. <?php
  47310. class ComposerAutoloaderInitComposerPhar1483808931
  47311. {
  47312. private static $loader;
  47313. public static function loadClassLoader($class)
  47314. {
  47315. if ('Composer\Autoload\ClassLoader' === $class) {
  47316. require __DIR__ . '/ClassLoader.php';
  47317. }
  47318. }
  47319. public static function getLoader()
  47320. {
  47321. if (null !== self::$loader) {
  47322. return self::$loader;
  47323. }
  47324. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1483808931', 'loadClassLoader'), true, true);
  47325. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  47326. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1483808931', 'loadClassLoader'));
  47327. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  47328. if ($useStaticLoader) {
  47329. require_once __DIR__ . '/autoload_static.php';
  47330. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1483808931::getInitializer($loader));
  47331. } else {
  47332. $map = require __DIR__ . '/autoload_namespaces.php';
  47333. foreach ($map as $namespace => $path) {
  47334. $loader->set($namespace, $path);
  47335. }
  47336. $map = require __DIR__ . '/autoload_psr4.php';
  47337. foreach ($map as $namespace => $path) {
  47338. $loader->setPsr4($namespace, $path);
  47339. }
  47340. $classMap = require __DIR__ . '/autoload_classmap.php';
  47341. if ($classMap) {
  47342. $loader->addClassMap($classMap);
  47343. }
  47344. }
  47345. $loader->register(true);
  47346. if ($useStaticLoader) {
  47347. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1483808931::$files;
  47348. } else {
  47349. $includeFiles = require __DIR__ . '/autoload_files.php';
  47350. }
  47351. foreach ($includeFiles as $fileIdentifier => $file) {
  47352. composerRequireComposerPhar1483808931($fileIdentifier, $file);
  47353. }
  47354. return $loader;
  47355. }
  47356. }
  47357. function composerRequireComposerPhar1483808931($fileIdentifier, $file)
  47358. {
  47359. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  47360. require $file;
  47361. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  47362. }
  47363. }
  47364. <?php
  47365. namespace Composer\Autoload;
  47366. class ComposerStaticInitComposerPhar1483808931
  47367. {
  47368. public static $files = array (
  47369. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  47370. );
  47371. public static $prefixLengthsPsr4 = array (
  47372. 'S' =>
  47373. array (
  47374. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  47375. 'Symfony\\Component\\Process\\' => 26,
  47376. 'Symfony\\Component\\Finder\\' => 25,
  47377. 'Symfony\\Component\\Filesystem\\' => 29,
  47378. 'Symfony\\Component\\Debug\\' => 24,
  47379. 'Symfony\\Component\\Console\\' => 26,
  47380. 'Seld\\PharUtils\\' => 15,
  47381. 'Seld\\JsonLint\\' => 14,
  47382. 'Seld\\CliPrompt\\' => 15,
  47383. ),
  47384. 'P' =>
  47385. array (
  47386. 'Psr\\Log\\' => 8,
  47387. ),
  47388. 'J' =>
  47389. array (
  47390. 'JsonSchema\\' => 11,
  47391. ),
  47392. 'C' =>
  47393. array (
  47394. 'Composer\\Spdx\\' => 14,
  47395. 'Composer\\Semver\\' => 16,
  47396. 'Composer\\CaBundle\\' => 18,
  47397. 'Composer\\' => 9,
  47398. ),
  47399. );
  47400. public static $prefixDirsPsr4 = array (
  47401. 'Symfony\\Polyfill\\Mbstring\\' =>
  47402. array (
  47403. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  47404. ),
  47405. 'Symfony\\Component\\Process\\' =>
  47406. array (
  47407. 0 => __DIR__ . '/..' . '/symfony/process',
  47408. ),
  47409. 'Symfony\\Component\\Finder\\' =>
  47410. array (
  47411. 0 => __DIR__ . '/..' . '/symfony/finder',
  47412. ),
  47413. 'Symfony\\Component\\Filesystem\\' =>
  47414. array (
  47415. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  47416. ),
  47417. 'Symfony\\Component\\Debug\\' =>
  47418. array (
  47419. 0 => __DIR__ . '/..' . '/symfony/debug',
  47420. ),
  47421. 'Symfony\\Component\\Console\\' =>
  47422. array (
  47423. 0 => __DIR__ . '/..' . '/symfony/console',
  47424. ),
  47425. 'Seld\\PharUtils\\' =>
  47426. array (
  47427. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  47428. ),
  47429. 'Seld\\JsonLint\\' =>
  47430. array (
  47431. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  47432. ),
  47433. 'Seld\\CliPrompt\\' =>
  47434. array (
  47435. 0 => __DIR__ . '/..' . '/seld/cli-prompt/src',
  47436. ),
  47437. 'Psr\\Log\\' =>
  47438. array (
  47439. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  47440. ),
  47441. 'JsonSchema\\' =>
  47442. array (
  47443. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  47444. ),
  47445. 'Composer\\Spdx\\' =>
  47446. array (
  47447. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  47448. ),
  47449. 'Composer\\Semver\\' =>
  47450. array (
  47451. 0 => __DIR__ . '/..' . '/composer/semver/src',
  47452. ),
  47453. 'Composer\\CaBundle\\' =>
  47454. array (
  47455. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  47456. ),
  47457. 'Composer\\' =>
  47458. array (
  47459. 0 => __DIR__ . '/../..' . '/src/Composer',
  47460. ),
  47461. );
  47462. public static function getInitializer(ClassLoader $loader)
  47463. {
  47464. return \Closure::bind(function () use ($loader) {
  47465. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1483808931::$prefixLengthsPsr4;
  47466. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1483808931::$prefixDirsPsr4;
  47467. }, null, ClassLoader::class);
  47468. }
  47469. }
  47470. <?php
  47471. namespace Composer\Autoload;
  47472. class ClassLoader
  47473. {
  47474. private $prefixLengthsPsr4 = array();
  47475. private $prefixDirsPsr4 = array();
  47476. private $fallbackDirsPsr4 = array();
  47477. private $prefixesPsr0 = array();
  47478. private $fallbackDirsPsr0 = array();
  47479. private $useIncludePath = false;
  47480. private $classMap = array();
  47481. private $classMapAuthoritative = false;
  47482. private $missingClasses = array();
  47483. private $apcuPrefix;
  47484. public function getPrefixes()
  47485. {
  47486. if (!empty($this->prefixesPsr0)) {
  47487. return call_user_func_array('array_merge', $this->prefixesPsr0);
  47488. }
  47489. return array();
  47490. }
  47491. public function getPrefixesPsr4()
  47492. {
  47493. return $this->prefixDirsPsr4;
  47494. }
  47495. public function getFallbackDirs()
  47496. {
  47497. return $this->fallbackDirsPsr0;
  47498. }
  47499. public function getFallbackDirsPsr4()
  47500. {
  47501. return $this->fallbackDirsPsr4;
  47502. }
  47503. public function getClassMap()
  47504. {
  47505. return $this->classMap;
  47506. }
  47507. public function addClassMap(array $classMap)
  47508. {
  47509. if ($this->classMap) {
  47510. $this->classMap = array_merge($this->classMap, $classMap);
  47511. } else {
  47512. $this->classMap = $classMap;
  47513. }
  47514. }
  47515. public function add($prefix, $paths, $prepend = false)
  47516. {
  47517. if (!$prefix) {
  47518. if ($prepend) {
  47519. $this->fallbackDirsPsr0 = array_merge(
  47520. (array) $paths,
  47521. $this->fallbackDirsPsr0
  47522. );
  47523. } else {
  47524. $this->fallbackDirsPsr0 = array_merge(
  47525. $this->fallbackDirsPsr0,
  47526. (array) $paths
  47527. );
  47528. }
  47529. return;
  47530. }
  47531. $first = $prefix[0];
  47532. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  47533. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  47534. return;
  47535. }
  47536. if ($prepend) {
  47537. $this->prefixesPsr0[$first][$prefix] = array_merge(
  47538. (array) $paths,
  47539. $this->prefixesPsr0[$first][$prefix]
  47540. );
  47541. } else {
  47542. $this->prefixesPsr0[$first][$prefix] = array_merge(
  47543. $this->prefixesPsr0[$first][$prefix],
  47544. (array) $paths
  47545. );
  47546. }
  47547. }
  47548. public function addPsr4($prefix, $paths, $prepend = false)
  47549. {
  47550. if (!$prefix) {
  47551. if ($prepend) {
  47552. $this->fallbackDirsPsr4 = array_merge(
  47553. (array) $paths,
  47554. $this->fallbackDirsPsr4
  47555. );
  47556. } else {
  47557. $this->fallbackDirsPsr4 = array_merge(
  47558. $this->fallbackDirsPsr4,
  47559. (array) $paths
  47560. );
  47561. }
  47562. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  47563. $length = strlen($prefix);
  47564. if ('\\' !== $prefix[$length - 1]) {
  47565. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  47566. }
  47567. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  47568. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  47569. } elseif ($prepend) {
  47570. $this->prefixDirsPsr4[$prefix] = array_merge(
  47571. (array) $paths,
  47572. $this->prefixDirsPsr4[$prefix]
  47573. );
  47574. } else {
  47575. $this->prefixDirsPsr4[$prefix] = array_merge(
  47576. $this->prefixDirsPsr4[$prefix],
  47577. (array) $paths
  47578. );
  47579. }
  47580. }
  47581. public function set($prefix, $paths)
  47582. {
  47583. if (!$prefix) {
  47584. $this->fallbackDirsPsr0 = (array) $paths;
  47585. } else {
  47586. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  47587. }
  47588. }
  47589. public function setPsr4($prefix, $paths)
  47590. {
  47591. if (!$prefix) {
  47592. $this->fallbackDirsPsr4 = (array) $paths;
  47593. } else {
  47594. $length = strlen($prefix);
  47595. if ('\\' !== $prefix[$length - 1]) {
  47596. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  47597. }
  47598. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  47599. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  47600. }
  47601. }
  47602. public function setUseIncludePath($useIncludePath)
  47603. {
  47604. $this->useIncludePath = $useIncludePath;
  47605. }
  47606. public function getUseIncludePath()
  47607. {
  47608. return $this->useIncludePath;
  47609. }
  47610. public function setClassMapAuthoritative($classMapAuthoritative)
  47611. {
  47612. $this->classMapAuthoritative = $classMapAuthoritative;
  47613. }
  47614. public function isClassMapAuthoritative()
  47615. {
  47616. return $this->classMapAuthoritative;
  47617. }
  47618. public function setApcuPrefix($apcuPrefix)
  47619. {
  47620. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  47621. }
  47622. public function getApcuPrefix()
  47623. {
  47624. return $this->apcuPrefix;
  47625. }
  47626. public function register($prepend = false)
  47627. {
  47628. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  47629. }
  47630. public function unregister()
  47631. {
  47632. spl_autoload_unregister(array($this, 'loadClass'));
  47633. }
  47634. public function loadClass($class)
  47635. {
  47636. if ($file = $this->findFile($class)) {
  47637. includeFile($file);
  47638. return true;
  47639. }
  47640. }
  47641. public function findFile($class)
  47642. {
  47643. if (isset($this->classMap[$class])) {
  47644. return $this->classMap[$class];
  47645. }
  47646. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  47647. return false;
  47648. }
  47649. if (null !== $this->apcuPrefix) {
  47650. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  47651. if ($hit) {
  47652. return $file;
  47653. }
  47654. }
  47655. $file = $this->findFileWithExtension($class, '.php');
  47656. if (false === $file && defined('HHVM_VERSION')) {
  47657. $file = $this->findFileWithExtension($class, '.hh');
  47658. }
  47659. if (null !== $this->apcuPrefix) {
  47660. apcu_add($this->apcuPrefix.$class, $file);
  47661. }
  47662. if (false === $file) {
  47663. $this->missingClasses[$class] = true;
  47664. }
  47665. return $file;
  47666. }
  47667. private function findFileWithExtension($class, $ext)
  47668. {
  47669. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  47670. $first = $class[0];
  47671. if (isset($this->prefixLengthsPsr4[$first])) {
  47672. foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
  47673. if (0 === strpos($class, $prefix)) {
  47674. foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
  47675. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  47676. return $file;
  47677. }
  47678. }
  47679. }
  47680. }
  47681. }
  47682. foreach ($this->fallbackDirsPsr4 as $dir) {
  47683. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  47684. return $file;
  47685. }
  47686. }
  47687. if (false !== $pos = strrpos($class, '\\')) {
  47688. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  47689. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  47690. } else {
  47691. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  47692. }
  47693. if (isset($this->prefixesPsr0[$first])) {
  47694. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  47695. if (0 === strpos($class, $prefix)) {
  47696. foreach ($dirs as $dir) {
  47697. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  47698. return $file;
  47699. }
  47700. }
  47701. }
  47702. }
  47703. }
  47704. foreach ($this->fallbackDirsPsr0 as $dir) {
  47705. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  47706. return $file;
  47707. }
  47708. }
  47709. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  47710. return $file;
  47711. }
  47712. return false;
  47713. }
  47714. }
  47715. function includeFile($file)
  47716. {
  47717. include $file;
  47718. }
  47719. ##
  47720. ## Bundle of CA Root Certificates
  47721. ##
  47722. ## Certificate data from Mozilla as of: Wed Nov 2 04:12:05 2016 GMT
  47723. ##
  47724. ## This is a bundle of X.509 certificates of public Certificate Authorities
  47725. ## (CA). These were automatically extracted from Mozilla's root certificates
  47726. ## file (certdata.txt). This file can be found in the mozilla source tree:
  47727. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  47728. ##
  47729. ## It contains the certificates in PEM format and therefore
  47730. ## can be directly used with curl / libcurl / php_curl, or with
  47731. ## an Apache+mod_ssl webserver for SSL client authentication.
  47732. ## Just configure this file as the SSLCACertificateFile.
  47733. ##
  47734. ## Conversion done with mk-ca-bundle.pl version 1.27.
  47735. ## SHA256: 17e2a90c8a5cfd6a675b3475d3d467e1ab1fe0d5397e907b08206182389caa08
  47736. ##
  47737. Equifax Secure CA
  47738. =================
  47739. -----BEGIN CERTIFICATE-----
  47740. MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
  47741. ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
  47742. MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
  47743. B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
  47744. nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
  47745. fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
  47746. 8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
  47747. A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
  47748. CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
  47749. A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
  47750. spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
  47751. Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
  47752. zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
  47753. BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
  47754. 70+sB3c4
  47755. -----END CERTIFICATE-----
  47756. GlobalSign Root CA
  47757. ==================
  47758. -----BEGIN CERTIFICATE-----
  47759. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  47760. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  47761. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  47762. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  47763. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  47764. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  47765. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  47766. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  47767. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  47768. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  47769. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  47770. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  47771. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  47772. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  47773. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  47774. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  47775. -----END CERTIFICATE-----
  47776. GlobalSign Root CA - R2
  47777. =======================
  47778. -----BEGIN CERTIFICATE-----
  47779. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  47780. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  47781. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  47782. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  47783. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  47784. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  47785. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  47786. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  47787. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  47788. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  47789. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  47790. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  47791. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  47792. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  47793. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  47794. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  47795. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  47796. -----END CERTIFICATE-----
  47797. Verisign Class 3 Public Primary Certification Authority - G3
  47798. ============================================================
  47799. -----BEGIN CERTIFICATE-----
  47800. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  47801. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  47802. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  47803. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  47804. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  47805. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  47806. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  47807. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  47808. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  47809. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  47810. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  47811. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  47812. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  47813. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  47814. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  47815. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  47816. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  47817. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  47818. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  47819. -----END CERTIFICATE-----
  47820. Entrust.net Premium 2048 Secure Server CA
  47821. =========================================
  47822. -----BEGIN CERTIFICATE-----
  47823. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  47824. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  47825. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  47826. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  47827. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  47828. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  47829. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  47830. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  47831. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  47832. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  47833. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  47834. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  47835. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  47836. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  47837. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  47838. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  47839. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  47840. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  47841. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  47842. -----END CERTIFICATE-----
  47843. Baltimore CyberTrust Root
  47844. =========================
  47845. -----BEGIN CERTIFICATE-----
  47846. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  47847. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  47848. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  47849. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  47850. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  47851. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  47852. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  47853. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  47854. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  47855. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  47856. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  47857. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  47858. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  47859. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  47860. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  47861. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  47862. -----END CERTIFICATE-----
  47863. AddTrust Low-Value Services Root
  47864. ================================
  47865. -----BEGIN CERTIFICATE-----
  47866. MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  47867. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
  47868. cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
  47869. CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
  47870. ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
  47871. AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
  47872. 54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
  47873. oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
  47874. Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
  47875. GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
  47876. HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
  47877. AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
  47878. RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
  47879. HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
  47880. ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
  47881. iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
  47882. eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
  47883. mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
  47884. ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
  47885. -----END CERTIFICATE-----
  47886. AddTrust External Root
  47887. ======================
  47888. -----BEGIN CERTIFICATE-----
  47889. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  47890. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  47891. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  47892. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  47893. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  47894. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  47895. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  47896. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  47897. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  47898. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  47899. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  47900. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  47901. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  47902. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  47903. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  47904. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  47905. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  47906. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  47907. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  47908. -----END CERTIFICATE-----
  47909. AddTrust Public Services Root
  47910. =============================
  47911. -----BEGIN CERTIFICATE-----
  47912. MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  47913. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
  47914. cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
  47915. BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
  47916. dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
  47917. AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
  47918. nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
  47919. d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
  47920. Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
  47921. HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
  47922. A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  47923. /zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
  47924. FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
  47925. A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
  47926. JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
  47927. +YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
  47928. GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
  47929. Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
  47930. EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
  47931. -----END CERTIFICATE-----
  47932. AddTrust Qualified Certificates Root
  47933. ====================================
  47934. -----BEGIN CERTIFICATE-----
  47935. MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  47936. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
  47937. cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
  47938. CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
  47939. IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
  47940. 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
  47941. 64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
  47942. KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
  47943. L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
  47944. wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
  47945. MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
  47946. BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
  47947. BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
  47948. azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
  47949. ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
  47950. GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
  47951. dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
  47952. RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
  47953. iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
  47954. -----END CERTIFICATE-----
  47955. Entrust Root Certification Authority
  47956. ====================================
  47957. -----BEGIN CERTIFICATE-----
  47958. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  47959. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  47960. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  47961. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  47962. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  47963. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  47964. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  47965. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  47966. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  47967. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  47968. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  47969. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  47970. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  47971. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  47972. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  47973. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  47974. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  47975. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  47976. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  47977. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  47978. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  47979. -----END CERTIFICATE-----
  47980. RSA Security 2048 v3
  47981. ====================
  47982. -----BEGIN CERTIFICATE-----
  47983. MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
  47984. ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
  47985. MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
  47986. BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
  47987. AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
  47988. Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
  47989. WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
  47990. KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
  47991. +Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
  47992. MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
  47993. FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
  47994. v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
  47995. 0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
  47996. VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
  47997. nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
  47998. pKnXwiJPZ9d37CAFYd4=
  47999. -----END CERTIFICATE-----
  48000. GeoTrust Global CA
  48001. ==================
  48002. -----BEGIN CERTIFICATE-----
  48003. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  48004. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  48005. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  48006. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  48007. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  48008. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  48009. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  48010. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  48011. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  48012. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  48013. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  48014. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  48015. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  48016. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  48017. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  48018. Mw==
  48019. -----END CERTIFICATE-----
  48020. GeoTrust Global CA 2
  48021. ====================
  48022. -----BEGIN CERTIFICATE-----
  48023. MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  48024. R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
  48025. MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  48026. LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  48027. ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
  48028. NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
  48029. LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
  48030. Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
  48031. HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
  48032. MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
  48033. K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
  48034. srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
  48035. ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
  48036. OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
  48037. x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
  48038. H4z1Ir+rzoPz4iIprn2DQKi6bA==
  48039. -----END CERTIFICATE-----
  48040. GeoTrust Universal CA
  48041. =====================
  48042. -----BEGIN CERTIFICATE-----
  48043. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  48044. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  48045. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  48046. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  48047. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  48048. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  48049. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  48050. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  48051. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  48052. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  48053. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  48054. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  48055. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  48056. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  48057. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  48058. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  48059. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  48060. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  48061. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  48062. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  48063. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  48064. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  48065. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  48066. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  48067. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  48068. -----END CERTIFICATE-----
  48069. GeoTrust Universal CA 2
  48070. =======================
  48071. -----BEGIN CERTIFICATE-----
  48072. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  48073. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  48074. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  48075. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  48076. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  48077. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  48078. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  48079. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  48080. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  48081. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  48082. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  48083. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  48084. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  48085. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  48086. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  48087. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  48088. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  48089. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  48090. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  48091. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  48092. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  48093. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  48094. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  48095. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  48096. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  48097. -----END CERTIFICATE-----
  48098. Visa eCommerce Root
  48099. ===================
  48100. -----BEGIN CERTIFICATE-----
  48101. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  48102. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  48103. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  48104. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  48105. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  48106. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  48107. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  48108. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  48109. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  48110. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  48111. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  48112. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  48113. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  48114. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  48115. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  48116. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  48117. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  48118. -----END CERTIFICATE-----
  48119. Certum Root CA
  48120. ==============
  48121. -----BEGIN CERTIFICATE-----
  48122. MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
  48123. ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
  48124. Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
  48125. by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
  48126. wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
  48127. kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
  48128. 89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
  48129. Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
  48130. NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
  48131. hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
  48132. GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
  48133. GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
  48134. 0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
  48135. qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
  48136. -----END CERTIFICATE-----
  48137. Comodo AAA Services root
  48138. ========================
  48139. -----BEGIN CERTIFICATE-----
  48140. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  48141. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  48142. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  48143. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  48144. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  48145. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  48146. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  48147. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  48148. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  48149. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  48150. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  48151. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  48152. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  48153. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  48154. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  48155. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  48156. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  48157. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  48158. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  48159. -----END CERTIFICATE-----
  48160. Comodo Secure Services root
  48161. ===========================
  48162. -----BEGIN CERTIFICATE-----
  48163. MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  48164. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  48165. TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
  48166. MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
  48167. Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
  48168. BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
  48169. ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
  48170. 9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
  48171. rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
  48172. oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
  48173. p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
  48174. FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  48175. gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
  48176. YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
  48177. aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
  48178. 4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
  48179. Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
  48180. DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
  48181. pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
  48182. RR3B7Hzs/Sk=
  48183. -----END CERTIFICATE-----
  48184. Comodo Trusted Services root
  48185. ============================
  48186. -----BEGIN CERTIFICATE-----
  48187. MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  48188. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  48189. TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
  48190. MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
  48191. bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
  48192. IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
  48193. AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
  48194. 3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
  48195. /9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
  48196. juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
  48197. ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
  48198. DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  48199. /zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
  48200. ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
  48201. cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
  48202. uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
  48203. pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
  48204. BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
  48205. R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
  48206. 9y5Xt5hwXsjEeLBi
  48207. -----END CERTIFICATE-----
  48208. QuoVadis Root CA
  48209. ================
  48210. -----BEGIN CERTIFICATE-----
  48211. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  48212. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  48213. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  48214. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  48215. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  48216. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  48217. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  48218. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  48219. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  48220. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  48221. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  48222. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  48223. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  48224. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  48225. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  48226. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  48227. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  48228. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  48229. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  48230. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  48231. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  48232. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  48233. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  48234. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  48235. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  48236. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  48237. 5nrQNiOKSnQ2+Q==
  48238. -----END CERTIFICATE-----
  48239. QuoVadis Root CA 2
  48240. ==================
  48241. -----BEGIN CERTIFICATE-----
  48242. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  48243. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  48244. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  48245. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  48246. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  48247. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  48248. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  48249. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  48250. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  48251. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  48252. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  48253. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  48254. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  48255. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  48256. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  48257. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  48258. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  48259. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  48260. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  48261. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  48262. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  48263. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  48264. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  48265. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  48266. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  48267. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  48268. -----END CERTIFICATE-----
  48269. QuoVadis Root CA 3
  48270. ==================
  48271. -----BEGIN CERTIFICATE-----
  48272. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  48273. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  48274. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  48275. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  48276. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  48277. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  48278. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  48279. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  48280. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  48281. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  48282. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  48283. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  48284. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  48285. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  48286. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  48287. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  48288. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  48289. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  48290. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  48291. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  48292. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  48293. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  48294. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  48295. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  48296. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  48297. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  48298. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  48299. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  48300. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  48301. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  48302. -----END CERTIFICATE-----
  48303. Security Communication Root CA
  48304. ==============================
  48305. -----BEGIN CERTIFICATE-----
  48306. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  48307. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  48308. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  48309. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  48310. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  48311. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  48312. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  48313. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  48314. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  48315. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  48316. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  48317. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  48318. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  48319. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  48320. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  48321. FL39vmwLAw==
  48322. -----END CERTIFICATE-----
  48323. Sonera Class 2 Root CA
  48324. ======================
  48325. -----BEGIN CERTIFICATE-----
  48326. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  48327. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  48328. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  48329. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  48330. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  48331. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  48332. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  48333. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  48334. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  48335. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  48336. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  48337. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  48338. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  48339. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  48340. llpwrN9M
  48341. -----END CERTIFICATE-----
  48342. UTN USERFirst Hardware Root CA
  48343. ==============================
  48344. -----BEGIN CERTIFICATE-----
  48345. MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
  48346. BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
  48347. IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
  48348. BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
  48349. OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
  48350. eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
  48351. ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
  48352. DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
  48353. wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
  48354. tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
  48355. i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
  48356. Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
  48357. gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
  48358. lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
  48359. UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
  48360. BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
  48361. //bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
  48362. XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
  48363. lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
  48364. iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
  48365. nfhmqA==
  48366. -----END CERTIFICATE-----
  48367. Camerfirma Chambers of Commerce Root
  48368. ====================================
  48369. -----BEGIN CERTIFICATE-----
  48370. MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  48371. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  48372. ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
  48373. NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
  48374. cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
  48375. MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
  48376. AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
  48377. xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
  48378. NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
  48379. DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
  48380. d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
  48381. EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
  48382. cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
  48383. AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
  48384. bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
  48385. VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
  48386. aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
  48387. fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
  48388. L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
  48389. UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
  48390. ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
  48391. erfutGWaIZDgqtCYvDi1czyL+Nw=
  48392. -----END CERTIFICATE-----
  48393. Camerfirma Global Chambersign Root
  48394. ==================================
  48395. -----BEGIN CERTIFICATE-----
  48396. MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  48397. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  48398. ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
  48399. NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
  48400. YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
  48401. MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
  48402. ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
  48403. 1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
  48404. by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
  48405. 6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
  48406. 8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
  48407. BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
  48408. aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
  48409. Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
  48410. aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
  48411. ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
  48412. bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
  48413. PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
  48414. gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
  48415. PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
  48416. IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
  48417. t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
  48418. -----END CERTIFICATE-----
  48419. XRamp Global CA Root
  48420. ====================
  48421. -----BEGIN CERTIFICATE-----
  48422. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  48423. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  48424. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  48425. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  48426. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  48427. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  48428. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  48429. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  48430. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  48431. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  48432. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  48433. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  48434. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  48435. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  48436. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  48437. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  48438. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  48439. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  48440. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  48441. -----END CERTIFICATE-----
  48442. Go Daddy Class 2 CA
  48443. ===================
  48444. -----BEGIN CERTIFICATE-----
  48445. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  48446. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  48447. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  48448. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  48449. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  48450. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  48451. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  48452. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  48453. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  48454. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  48455. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  48456. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  48457. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  48458. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  48459. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  48460. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  48461. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  48462. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  48463. vZ8=
  48464. -----END CERTIFICATE-----
  48465. Starfield Class 2 CA
  48466. ====================
  48467. -----BEGIN CERTIFICATE-----
  48468. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  48469. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  48470. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  48471. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  48472. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  48473. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  48474. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  48475. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  48476. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  48477. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  48478. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  48479. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  48480. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  48481. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  48482. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  48483. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  48484. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  48485. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  48486. QBFGmh95DmK/D5fs4C8fF5Q=
  48487. -----END CERTIFICATE-----
  48488. StartCom Certification Authority
  48489. ================================
  48490. -----BEGIN CERTIFICATE-----
  48491. MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  48492. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  48493. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  48494. NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  48495. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  48496. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  48497. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  48498. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  48499. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  48500. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  48501. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  48502. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  48503. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  48504. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  48505. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  48506. 37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
  48507. FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
  48508. Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
  48509. YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
  48510. AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
  48511. Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
  48512. U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
  48513. LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
  48514. cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
  48515. cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
  48516. dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
  48517. AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
  48518. 3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
  48519. vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
  48520. fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
  48521. fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
  48522. EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
  48523. yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
  48524. 1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
  48525. lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
  48526. g14=
  48527. -----END CERTIFICATE-----
  48528. Taiwan GRCA
  48529. ===========
  48530. -----BEGIN CERTIFICATE-----
  48531. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  48532. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  48533. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  48534. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  48535. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  48536. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  48537. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  48538. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  48539. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  48540. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  48541. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  48542. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  48543. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  48544. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  48545. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  48546. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  48547. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  48548. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  48549. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  48550. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  48551. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  48552. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  48553. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  48554. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  48555. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  48556. -----END CERTIFICATE-----
  48557. Swisscom Root CA 1
  48558. ==================
  48559. -----BEGIN CERTIFICATE-----
  48560. MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
  48561. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  48562. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
  48563. MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  48564. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
  48565. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
  48566. MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
  48567. NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
  48568. AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
  48569. b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
  48570. 7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
  48571. cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
  48572. WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
  48573. haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
  48574. MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  48575. HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
  48576. BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
  48577. MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
  48578. jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
  48579. MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
  48580. VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
  48581. vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
  48582. OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
  48583. 1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
  48584. nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
  48585. x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
  48586. NY6E0F/6MBr1mmz0DlP5OlvRHA==
  48587. -----END CERTIFICATE-----
  48588. DigiCert Assured ID Root CA
  48589. ===========================
  48590. -----BEGIN CERTIFICATE-----
  48591. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  48592. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  48593. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  48594. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  48595. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  48596. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  48597. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  48598. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  48599. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  48600. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  48601. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  48602. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  48603. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  48604. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  48605. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  48606. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  48607. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  48608. -----END CERTIFICATE-----
  48609. DigiCert Global Root CA
  48610. =======================
  48611. -----BEGIN CERTIFICATE-----
  48612. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  48613. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  48614. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  48615. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  48616. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  48617. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  48618. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  48619. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  48620. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  48621. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  48622. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  48623. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  48624. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  48625. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  48626. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  48627. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  48628. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  48629. -----END CERTIFICATE-----
  48630. DigiCert High Assurance EV Root CA
  48631. ==================================
  48632. -----BEGIN CERTIFICATE-----
  48633. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  48634. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  48635. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  48636. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  48637. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  48638. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  48639. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  48640. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  48641. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  48642. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  48643. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  48644. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  48645. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  48646. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  48647. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  48648. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  48649. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  48650. -----END CERTIFICATE-----
  48651. Certplus Class 2 Primary CA
  48652. ===========================
  48653. -----BEGIN CERTIFICATE-----
  48654. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  48655. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  48656. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  48657. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  48658. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  48659. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  48660. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  48661. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  48662. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  48663. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  48664. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  48665. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  48666. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  48667. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  48668. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  48669. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  48670. l7+ijrRU
  48671. -----END CERTIFICATE-----
  48672. DST Root CA X3
  48673. ==============
  48674. -----BEGIN CERTIFICATE-----
  48675. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  48676. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  48677. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  48678. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  48679. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  48680. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  48681. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  48682. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  48683. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  48684. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  48685. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  48686. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  48687. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  48688. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  48689. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  48690. -----END CERTIFICATE-----
  48691. DST ACES CA X6
  48692. ==============
  48693. -----BEGIN CERTIFICATE-----
  48694. MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
  48695. EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
  48696. MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
  48697. MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
  48698. CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
  48699. AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
  48700. DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
  48701. pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
  48702. GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
  48703. MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
  48704. EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
  48705. Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
  48706. dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
  48707. CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
  48708. 5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
  48709. Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
  48710. nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
  48711. vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
  48712. oKfN5XozNmr6mis=
  48713. -----END CERTIFICATE-----
  48714. SwissSign Gold CA - G2
  48715. ======================
  48716. -----BEGIN CERTIFICATE-----
  48717. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  48718. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  48719. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  48720. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  48721. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  48722. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  48723. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  48724. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  48725. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  48726. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  48727. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  48728. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  48729. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  48730. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  48731. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  48732. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  48733. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  48734. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  48735. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  48736. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  48737. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  48738. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  48739. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  48740. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  48741. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  48742. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  48743. -----END CERTIFICATE-----
  48744. SwissSign Silver CA - G2
  48745. ========================
  48746. -----BEGIN CERTIFICATE-----
  48747. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  48748. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  48749. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  48750. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  48751. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  48752. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  48753. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  48754. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  48755. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  48756. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  48757. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  48758. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  48759. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  48760. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  48761. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  48762. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  48763. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  48764. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  48765. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  48766. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  48767. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  48768. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  48769. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  48770. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  48771. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  48772. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  48773. -----END CERTIFICATE-----
  48774. GeoTrust Primary Certification Authority
  48775. ========================================
  48776. -----BEGIN CERTIFICATE-----
  48777. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  48778. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  48779. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  48780. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  48781. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  48782. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  48783. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  48784. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  48785. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  48786. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  48787. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  48788. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  48789. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  48790. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  48791. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  48792. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  48793. -----END CERTIFICATE-----
  48794. thawte Primary Root CA
  48795. ======================
  48796. -----BEGIN CERTIFICATE-----
  48797. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  48798. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  48799. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  48800. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  48801. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  48802. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  48803. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  48804. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  48805. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  48806. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  48807. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  48808. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  48809. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  48810. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  48811. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  48812. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  48813. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  48814. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  48815. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  48816. -----END CERTIFICATE-----
  48817. VeriSign Class 3 Public Primary Certification Authority - G5
  48818. ============================================================
  48819. -----BEGIN CERTIFICATE-----
  48820. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  48821. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  48822. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  48823. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  48824. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  48825. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  48826. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  48827. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  48828. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  48829. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  48830. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  48831. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  48832. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  48833. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  48834. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  48835. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  48836. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  48837. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  48838. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  48839. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  48840. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  48841. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  48842. -----END CERTIFICATE-----
  48843. SecureTrust CA
  48844. ==============
  48845. -----BEGIN CERTIFICATE-----
  48846. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  48847. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  48848. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  48849. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  48850. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  48851. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  48852. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  48853. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  48854. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  48855. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  48856. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  48857. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  48858. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  48859. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  48860. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  48861. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  48862. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  48863. -----END CERTIFICATE-----
  48864. Secure Global CA
  48865. ================
  48866. -----BEGIN CERTIFICATE-----
  48867. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  48868. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  48869. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  48870. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  48871. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  48872. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  48873. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  48874. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  48875. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  48876. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  48877. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  48878. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  48879. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  48880. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  48881. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  48882. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  48883. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  48884. -----END CERTIFICATE-----
  48885. COMODO Certification Authority
  48886. ==============================
  48887. -----BEGIN CERTIFICATE-----
  48888. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  48889. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  48890. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  48891. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  48892. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  48893. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  48894. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  48895. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  48896. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  48897. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  48898. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  48899. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  48900. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  48901. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  48902. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  48903. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  48904. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  48905. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  48906. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  48907. -----END CERTIFICATE-----
  48908. Network Solutions Certificate Authority
  48909. =======================================
  48910. -----BEGIN CERTIFICATE-----
  48911. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  48912. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  48913. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  48914. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  48915. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  48916. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  48917. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  48918. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  48919. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  48920. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  48921. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  48922. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  48923. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  48924. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  48925. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  48926. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  48927. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  48928. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  48929. -----END CERTIFICATE-----
  48930. WellsSecure Public Root Certificate Authority
  48931. =============================================
  48932. -----BEGIN CERTIFICATE-----
  48933. MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
  48934. F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
  48935. NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
  48936. MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
  48937. bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
  48938. VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  48939. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
  48940. iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
  48941. i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
  48942. bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
  48943. K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
  48944. AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
  48945. cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
  48946. lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
  48947. i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
  48948. GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
  48949. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
  48950. K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
  48951. bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
  48952. qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
  48953. E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
  48954. tylv2G0xffX8oRAHh84vWdw+WNs=
  48955. -----END CERTIFICATE-----
  48956. COMODO ECC Certification Authority
  48957. ==================================
  48958. -----BEGIN CERTIFICATE-----
  48959. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  48960. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  48961. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  48962. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  48963. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  48964. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  48965. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  48966. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  48967. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  48968. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  48969. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  48970. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  48971. -----END CERTIFICATE-----
  48972. IGC/A
  48973. =====
  48974. -----BEGIN CERTIFICATE-----
  48975. MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
  48976. VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
  48977. Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
  48978. MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
  48979. EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
  48980. STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
  48981. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
  48982. TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
  48983. So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
  48984. HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
  48985. frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
  48986. tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
  48987. egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
  48988. iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
  48989. q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
  48990. MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
  48991. Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
  48992. lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
  48993. 0mBWWg==
  48994. -----END CERTIFICATE-----
  48995. Security Communication EV RootCA1
  48996. =================================
  48997. -----BEGIN CERTIFICATE-----
  48998. MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  48999. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
  49000. dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
  49001. BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
  49002. Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  49003. AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
  49004. /VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
  49005. WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
  49006. ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
  49007. bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
  49008. 9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
  49009. SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
  49010. iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
  49011. Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
  49012. mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
  49013. T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
  49014. -----END CERTIFICATE-----
  49015. OISTE WISeKey Global Root GA CA
  49016. ===============================
  49017. -----BEGIN CERTIFICATE-----
  49018. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  49019. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  49020. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  49021. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  49022. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  49023. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  49024. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  49025. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  49026. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  49027. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  49028. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  49029. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  49030. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  49031. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  49032. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  49033. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  49034. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  49035. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  49036. -----END CERTIFICATE-----
  49037. Microsec e-Szigno Root CA
  49038. =========================
  49039. -----BEGIN CERTIFICATE-----
  49040. MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
  49041. BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
  49042. EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
  49043. MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
  49044. dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
  49045. GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  49046. AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
  49047. d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
  49048. oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
  49049. QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
  49050. PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
  49051. MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
  49052. IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
  49053. VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
  49054. LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
  49055. dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
  49056. AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
  49057. 4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
  49058. AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
  49059. egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
  49060. Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
  49061. PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
  49062. c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
  49063. cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
  49064. IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
  49065. WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
  49066. MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
  49067. MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
  49068. Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
  49069. HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
  49070. nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
  49071. aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
  49072. 86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
  49073. yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
  49074. S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
  49075. -----END CERTIFICATE-----
  49076. Certigna
  49077. ========
  49078. -----BEGIN CERTIFICATE-----
  49079. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  49080. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  49081. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  49082. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  49083. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  49084. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  49085. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  49086. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  49087. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  49088. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  49089. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  49090. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  49091. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  49092. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  49093. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  49094. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  49095. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  49096. -----END CERTIFICATE-----
  49097. Deutsche Telekom Root CA 2
  49098. ==========================
  49099. -----BEGIN CERTIFICATE-----
  49100. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  49101. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  49102. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  49103. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  49104. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  49105. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  49106. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  49107. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  49108. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  49109. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  49110. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  49111. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  49112. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  49113. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  49114. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  49115. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  49116. Cm26OWMohpLzGITY+9HPBVZkVw==
  49117. -----END CERTIFICATE-----
  49118. Cybertrust Global Root
  49119. ======================
  49120. -----BEGIN CERTIFICATE-----
  49121. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  49122. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  49123. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  49124. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  49125. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  49126. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  49127. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  49128. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  49129. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  49130. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  49131. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  49132. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  49133. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  49134. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  49135. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  49136. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  49137. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  49138. -----END CERTIFICATE-----
  49139. ePKI Root Certification Authority
  49140. =================================
  49141. -----BEGIN CERTIFICATE-----
  49142. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  49143. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  49144. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  49145. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  49146. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  49147. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  49148. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  49149. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  49150. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  49151. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  49152. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  49153. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  49154. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  49155. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  49156. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  49157. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  49158. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  49159. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  49160. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  49161. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  49162. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  49163. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  49164. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  49165. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  49166. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  49167. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  49168. -----END CERTIFICATE-----
  49169. T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
  49170. =============================================================================================================================
  49171. -----BEGIN CERTIFICATE-----
  49172. MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
  49173. DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
  49174. aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
  49175. b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
  49176. BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
  49177. S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
  49178. MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
  49179. IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
  49180. n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
  49181. IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
  49182. dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
  49183. cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
  49184. AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
  49185. Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
  49186. xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
  49187. 6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
  49188. hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
  49189. BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  49190. MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
  49191. N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
  49192. y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
  49193. LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
  49194. dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
  49195. -----END CERTIFICATE-----
  49196. Buypass Class 2 CA 1
  49197. ====================
  49198. -----BEGIN CERTIFICATE-----
  49199. MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  49200. QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
  49201. MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
  49202. c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
  49203. hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
  49204. cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
  49205. 0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
  49206. 0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
  49207. uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
  49208. MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
  49209. AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
  49210. 1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
  49211. 7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
  49212. fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
  49213. wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
  49214. -----END CERTIFICATE-----
  49215. EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
  49216. ==========================================================================
  49217. -----BEGIN CERTIFICATE-----
  49218. MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
  49219. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
  49220. QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
  49221. Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
  49222. ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
  49223. IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
  49224. SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
  49225. X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
  49226. gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
  49227. eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
  49228. TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
  49229. Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
  49230. uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
  49231. qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
  49232. ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
  49233. Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  49234. /wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
  49235. Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
  49236. FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
  49237. zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
  49238. XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
  49239. bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
  49240. RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
  49241. 1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
  49242. 2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
  49243. Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
  49244. AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
  49245. -----END CERTIFICATE-----
  49246. certSIGN ROOT CA
  49247. ================
  49248. -----BEGIN CERTIFICATE-----
  49249. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  49250. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  49251. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  49252. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  49253. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  49254. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  49255. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  49256. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  49257. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  49258. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  49259. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  49260. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  49261. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  49262. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  49263. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  49264. -----END CERTIFICATE-----
  49265. CNNIC ROOT
  49266. ==========
  49267. -----BEGIN CERTIFICATE-----
  49268. MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
  49269. ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
  49270. OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
  49271. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
  49272. o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
  49273. VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
  49274. VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
  49275. czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
  49276. y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
  49277. wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
  49278. lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
  49279. Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
  49280. O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
  49281. BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
  49282. G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
  49283. mxE=
  49284. -----END CERTIFICATE-----
  49285. ApplicationCA - Japanese Government
  49286. ===================================
  49287. -----BEGIN CERTIFICATE-----
  49288. MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
  49289. SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
  49290. MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
  49291. cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  49292. CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
  49293. fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
  49294. wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
  49295. jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
  49296. nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
  49297. WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
  49298. BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
  49299. vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
  49300. o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
  49301. /DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
  49302. io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
  49303. dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
  49304. rosot4LKGAfmt1t06SAZf7IbiVQ=
  49305. -----END CERTIFICATE-----
  49306. GeoTrust Primary Certification Authority - G3
  49307. =============================================
  49308. -----BEGIN CERTIFICATE-----
  49309. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  49310. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  49311. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  49312. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  49313. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  49314. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  49315. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  49316. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  49317. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  49318. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  49319. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  49320. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  49321. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  49322. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  49323. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  49324. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  49325. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  49326. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  49327. -----END CERTIFICATE-----
  49328. thawte Primary Root CA - G2
  49329. ===========================
  49330. -----BEGIN CERTIFICATE-----
  49331. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  49332. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  49333. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  49334. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  49335. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  49336. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  49337. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  49338. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  49339. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  49340. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  49341. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  49342. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  49343. -----END CERTIFICATE-----
  49344. thawte Primary Root CA - G3
  49345. ===========================
  49346. -----BEGIN CERTIFICATE-----
  49347. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  49348. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  49349. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  49350. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  49351. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  49352. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  49353. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  49354. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  49355. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  49356. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  49357. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  49358. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  49359. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  49360. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  49361. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  49362. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  49363. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  49364. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  49365. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  49366. -----END CERTIFICATE-----
  49367. GeoTrust Primary Certification Authority - G2
  49368. =============================================
  49369. -----BEGIN CERTIFICATE-----
  49370. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  49371. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  49372. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  49373. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  49374. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  49375. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  49376. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  49377. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  49378. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  49379. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  49380. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  49381. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  49382. npaqBA+K
  49383. -----END CERTIFICATE-----
  49384. VeriSign Universal Root Certification Authority
  49385. ===============================================
  49386. -----BEGIN CERTIFICATE-----
  49387. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  49388. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  49389. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  49390. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  49391. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  49392. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  49393. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  49394. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  49395. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  49396. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  49397. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  49398. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  49399. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  49400. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  49401. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  49402. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  49403. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  49404. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  49405. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  49406. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  49407. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  49408. mJO37M2CYfE45k+XmCpajQ==
  49409. -----END CERTIFICATE-----
  49410. VeriSign Class 3 Public Primary Certification Authority - G4
  49411. ============================================================
  49412. -----BEGIN CERTIFICATE-----
  49413. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  49414. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  49415. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  49416. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  49417. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  49418. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  49419. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  49420. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  49421. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  49422. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  49423. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  49424. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  49425. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  49426. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  49427. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  49428. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  49429. -----END CERTIFICATE-----
  49430. NetLock Arany (Class Gold) Főtanúsítvány
  49431. ========================================
  49432. -----BEGIN CERTIFICATE-----
  49433. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  49434. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  49435. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  49436. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  49437. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  49438. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  49439. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  49440. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  49441. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  49442. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  49443. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  49444. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  49445. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  49446. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  49447. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  49448. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  49449. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  49450. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  49451. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  49452. -----END CERTIFICATE-----
  49453. Staat der Nederlanden Root CA - G2
  49454. ==================================
  49455. -----BEGIN CERTIFICATE-----
  49456. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  49457. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  49458. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  49459. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  49460. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  49461. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  49462. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  49463. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  49464. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  49465. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  49466. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  49467. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  49468. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  49469. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  49470. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  49471. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  49472. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  49473. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  49474. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  49475. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  49476. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  49477. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  49478. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  49479. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  49480. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  49481. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  49482. 66+KAQ==
  49483. -----END CERTIFICATE-----
  49484. Juur-SK
  49485. =======
  49486. -----BEGIN CERTIFICATE-----
  49487. MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
  49488. c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
  49489. DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
  49490. SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
  49491. aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  49492. ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
  49493. TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
  49494. +Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
  49495. UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
  49496. Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
  49497. MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
  49498. HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
  49499. AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
  49500. cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
  49501. AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
  49502. cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
  49503. FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
  49504. A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
  49505. ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
  49506. abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
  49507. IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
  49508. Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
  49509. yyqcjg==
  49510. -----END CERTIFICATE-----
  49511. Hongkong Post Root CA 1
  49512. =======================
  49513. -----BEGIN CERTIFICATE-----
  49514. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  49515. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  49516. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  49517. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  49518. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  49519. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  49520. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  49521. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  49522. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  49523. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  49524. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  49525. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  49526. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  49527. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  49528. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  49529. -----END CERTIFICATE-----
  49530. SecureSign RootCA11
  49531. ===================
  49532. -----BEGIN CERTIFICATE-----
  49533. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  49534. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  49535. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  49536. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  49537. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  49538. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  49539. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  49540. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  49541. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  49542. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  49543. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  49544. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  49545. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  49546. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  49547. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  49548. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  49549. -----END CERTIFICATE-----
  49550. ACEDICOM Root
  49551. =============
  49552. -----BEGIN CERTIFICATE-----
  49553. MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
  49554. T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
  49555. MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
  49556. A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
  49557. AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
  49558. WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
  49559. YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
  49560. MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
  49561. m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
  49562. HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
  49563. xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
  49564. 3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
  49565. 2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
  49566. TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
  49567. 4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
  49568. 9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
  49569. bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
  49570. aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
  49571. eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
  49572. zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
  49573. ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
  49574. KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
  49575. nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
  49576. I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
  49577. MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
  49578. tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
  49579. -----END CERTIFICATE-----
  49580. Microsec e-Szigno Root CA 2009
  49581. ==============================
  49582. -----BEGIN CERTIFICATE-----
  49583. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  49584. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  49585. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  49586. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  49587. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  49588. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  49589. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  49590. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  49591. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  49592. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  49593. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  49594. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  49595. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  49596. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  49597. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  49598. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  49599. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  49600. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  49601. LXpUq3DDfSJlgnCW
  49602. -----END CERTIFICATE-----
  49603. GlobalSign Root CA - R3
  49604. =======================
  49605. -----BEGIN CERTIFICATE-----
  49606. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  49607. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  49608. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  49609. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  49610. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  49611. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  49612. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  49613. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  49614. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  49615. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  49616. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  49617. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  49618. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  49619. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  49620. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  49621. kpeDMdmztcpHWD9f
  49622. -----END CERTIFICATE-----
  49623. Autoridad de Certificacion Firmaprofesional CIF A62634068
  49624. =========================================================
  49625. -----BEGIN CERTIFICATE-----
  49626. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  49627. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  49628. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  49629. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  49630. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  49631. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  49632. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  49633. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  49634. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  49635. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  49636. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  49637. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  49638. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  49639. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  49640. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  49641. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  49642. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  49643. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  49644. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  49645. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  49646. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  49647. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  49648. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  49649. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  49650. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  49651. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  49652. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  49653. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  49654. -----END CERTIFICATE-----
  49655. Izenpe.com
  49656. ==========
  49657. -----BEGIN CERTIFICATE-----
  49658. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  49659. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  49660. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  49661. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  49662. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  49663. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  49664. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  49665. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  49666. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  49667. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  49668. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  49669. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  49670. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  49671. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  49672. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  49673. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  49674. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  49675. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  49676. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  49677. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  49678. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  49679. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  49680. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  49681. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  49682. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  49683. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  49684. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  49685. -----END CERTIFICATE-----
  49686. Chambers of Commerce Root - 2008
  49687. ================================
  49688. -----BEGIN CERTIFICATE-----
  49689. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  49690. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  49691. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  49692. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  49693. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  49694. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  49695. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  49696. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  49697. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  49698. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  49699. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  49700. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  49701. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  49702. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  49703. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  49704. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  49705. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  49706. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  49707. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  49708. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  49709. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  49710. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  49711. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  49712. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  49713. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  49714. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  49715. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  49716. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  49717. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  49718. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  49719. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  49720. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  49721. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  49722. -----END CERTIFICATE-----
  49723. Global Chambersign Root - 2008
  49724. ==============================
  49725. -----BEGIN CERTIFICATE-----
  49726. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  49727. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  49728. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  49729. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  49730. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  49731. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  49732. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  49733. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  49734. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  49735. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  49736. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  49737. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  49738. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  49739. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  49740. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  49741. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  49742. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  49743. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  49744. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  49745. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  49746. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  49747. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  49748. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  49749. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  49750. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  49751. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  49752. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  49753. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  49754. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  49755. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  49756. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  49757. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  49758. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  49759. -----END CERTIFICATE-----
  49760. Go Daddy Root Certificate Authority - G2
  49761. ========================================
  49762. -----BEGIN CERTIFICATE-----
  49763. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  49764. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  49765. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  49766. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  49767. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  49768. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  49769. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  49770. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  49771. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  49772. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  49773. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  49774. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  49775. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  49776. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  49777. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  49778. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  49779. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  49780. -----END CERTIFICATE-----
  49781. Starfield Root Certificate Authority - G2
  49782. =========================================
  49783. -----BEGIN CERTIFICATE-----
  49784. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  49785. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  49786. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  49787. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  49788. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  49789. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  49790. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  49791. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  49792. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  49793. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  49794. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  49795. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  49796. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  49797. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  49798. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  49799. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  49800. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  49801. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  49802. -----END CERTIFICATE-----
  49803. Starfield Services Root Certificate Authority - G2
  49804. ==================================================
  49805. -----BEGIN CERTIFICATE-----
  49806. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  49807. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  49808. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  49809. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  49810. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  49811. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  49812. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  49813. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  49814. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  49815. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  49816. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  49817. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  49818. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  49819. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  49820. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  49821. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  49822. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  49823. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  49824. -----END CERTIFICATE-----
  49825. AffirmTrust Commercial
  49826. ======================
  49827. -----BEGIN CERTIFICATE-----
  49828. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  49829. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  49830. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  49831. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  49832. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  49833. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  49834. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  49835. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  49836. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  49837. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  49838. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  49839. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  49840. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  49841. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  49842. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  49843. -----END CERTIFICATE-----
  49844. AffirmTrust Networking
  49845. ======================
  49846. -----BEGIN CERTIFICATE-----
  49847. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  49848. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  49849. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  49850. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  49851. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  49852. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  49853. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  49854. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  49855. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  49856. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  49857. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  49858. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  49859. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  49860. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  49861. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  49862. -----END CERTIFICATE-----
  49863. AffirmTrust Premium
  49864. ===================
  49865. -----BEGIN CERTIFICATE-----
  49866. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  49867. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  49868. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  49869. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  49870. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  49871. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  49872. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  49873. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  49874. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  49875. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  49876. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  49877. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  49878. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  49879. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  49880. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  49881. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  49882. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  49883. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  49884. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  49885. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  49886. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  49887. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  49888. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  49889. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  49890. -----END CERTIFICATE-----
  49891. AffirmTrust Premium ECC
  49892. =======================
  49893. -----BEGIN CERTIFICATE-----
  49894. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  49895. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  49896. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  49897. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  49898. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  49899. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  49900. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  49901. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  49902. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  49903. eQ==
  49904. -----END CERTIFICATE-----
  49905. Certum Trusted Network CA
  49906. =========================
  49907. -----BEGIN CERTIFICATE-----
  49908. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  49909. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  49910. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  49911. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  49912. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  49913. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  49914. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  49915. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  49916. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  49917. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  49918. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  49919. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  49920. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  49921. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  49922. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  49923. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  49924. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  49925. -----END CERTIFICATE-----
  49926. Certinomis - Autorité Racine
  49927. ============================
  49928. -----BEGIN CERTIFICATE-----
  49929. MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  49930. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
  49931. LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
  49932. A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
  49933. JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
  49934. ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
  49935. wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
  49936. Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
  49937. 2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
  49938. jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
  49939. c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
  49940. lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
  49941. xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
  49942. 530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
  49943. 4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  49944. A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
  49945. KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
  49946. WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
  49947. R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
  49948. nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
  49949. CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
  49950. JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
  49951. qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
  49952. WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
  49953. wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
  49954. vgt2Fl43N+bYdJeimUV5
  49955. -----END CERTIFICATE-----
  49956. Root CA Generalitat Valenciana
  49957. ==============================
  49958. -----BEGIN CERTIFICATE-----
  49959. MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
  49960. ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
  49961. IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
  49962. WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
  49963. CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
  49964. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
  49965. F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
  49966. ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
  49967. D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
  49968. JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
  49969. AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
  49970. dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
  49971. ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
  49972. AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
  49973. YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
  49974. AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
  49975. aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
  49976. AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
  49977. YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
  49978. AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
  49979. OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
  49980. dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
  49981. BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
  49982. A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
  49983. b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
  49984. TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
  49985. Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
  49986. NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
  49987. iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
  49988. +GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
  49989. -----END CERTIFICATE-----
  49990. TWCA Root Certification Authority
  49991. =================================
  49992. -----BEGIN CERTIFICATE-----
  49993. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  49994. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  49995. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  49996. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  49997. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  49998. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  49999. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  50000. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  50001. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  50002. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  50003. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  50004. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  50005. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  50006. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  50007. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  50008. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  50009. -----END CERTIFICATE-----
  50010. Security Communication RootCA2
  50011. ==============================
  50012. -----BEGIN CERTIFICATE-----
  50013. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  50014. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  50015. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  50016. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  50017. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50018. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  50019. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  50020. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  50021. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  50022. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  50023. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  50024. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  50025. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  50026. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  50027. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  50028. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  50029. -----END CERTIFICATE-----
  50030. EC-ACC
  50031. ======
  50032. -----BEGIN CERTIFICATE-----
  50033. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  50034. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  50035. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  50036. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  50037. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  50038. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  50039. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  50040. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  50041. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  50042. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  50043. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  50044. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  50045. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  50046. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  50047. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  50048. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  50049. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  50050. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  50051. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  50052. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  50053. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  50054. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  50055. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  50056. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  50057. 5EI=
  50058. -----END CERTIFICATE-----
  50059. Hellenic Academic and Research Institutions RootCA 2011
  50060. =======================================================
  50061. -----BEGIN CERTIFICATE-----
  50062. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  50063. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  50064. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  50065. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  50066. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  50067. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  50068. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50069. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  50070. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  50071. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  50072. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  50073. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  50074. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  50075. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  50076. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  50077. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  50078. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  50079. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  50080. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  50081. -----END CERTIFICATE-----
  50082. Actalis Authentication Root CA
  50083. ==============================
  50084. -----BEGIN CERTIFICATE-----
  50085. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  50086. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  50087. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  50088. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  50089. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  50090. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  50091. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  50092. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  50093. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  50094. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  50095. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  50096. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  50097. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  50098. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  50099. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  50100. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  50101. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  50102. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  50103. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  50104. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  50105. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  50106. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  50107. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  50108. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  50109. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  50110. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  50111. -----END CERTIFICATE-----
  50112. Trustis FPS Root CA
  50113. ===================
  50114. -----BEGIN CERTIFICATE-----
  50115. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  50116. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  50117. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  50118. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  50119. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  50120. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  50121. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  50122. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  50123. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  50124. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  50125. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  50126. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  50127. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  50128. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  50129. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  50130. iB6XzCGcKQENZetX2fNXlrtIzYE=
  50131. -----END CERTIFICATE-----
  50132. StartCom Certification Authority
  50133. ================================
  50134. -----BEGIN CERTIFICATE-----
  50135. MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  50136. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  50137. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  50138. NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  50139. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  50140. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  50141. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  50142. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  50143. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  50144. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  50145. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  50146. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  50147. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  50148. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  50149. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  50150. 37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
  50151. VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
  50152. Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
  50153. dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
  50154. c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
  50155. bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
  50156. aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
  50157. aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
  50158. L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
  50159. cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
  50160. fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
  50161. N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
  50162. Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
  50163. tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
  50164. e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
  50165. 2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
  50166. HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
  50167. JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
  50168. D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
  50169. -----END CERTIFICATE-----
  50170. StartCom Certification Authority G2
  50171. ===================================
  50172. -----BEGIN CERTIFICATE-----
  50173. MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  50174. U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
  50175. RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
  50176. ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  50177. dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
  50178. o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
  50179. 4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
  50180. Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
  50181. Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
  50182. O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
  50183. vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
  50184. nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
  50185. FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
  50186. z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
  50187. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
  50188. KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
  50189. 2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
  50190. J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
  50191. JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
  50192. /+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
  50193. nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
  50194. blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
  50195. l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
  50196. 7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
  50197. obp573PYtlNXLfbQ4ddI
  50198. -----END CERTIFICATE-----
  50199. Buypass Class 2 Root CA
  50200. =======================
  50201. -----BEGIN CERTIFICATE-----
  50202. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  50203. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  50204. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  50205. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  50206. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  50207. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  50208. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  50209. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  50210. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  50211. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  50212. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  50213. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  50214. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  50215. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  50216. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  50217. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  50218. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  50219. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  50220. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  50221. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  50222. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  50223. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  50224. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  50225. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  50226. rJgWVqA=
  50227. -----END CERTIFICATE-----
  50228. Buypass Class 3 Root CA
  50229. =======================
  50230. -----BEGIN CERTIFICATE-----
  50231. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  50232. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  50233. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  50234. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  50235. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  50236. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  50237. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  50238. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  50239. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  50240. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  50241. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  50242. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  50243. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  50244. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  50245. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  50246. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  50247. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  50248. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  50249. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  50250. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  50251. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  50252. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  50253. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  50254. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  50255. Cp/HuZc=
  50256. -----END CERTIFICATE-----
  50257. T-TeleSec GlobalRoot Class 3
  50258. ============================
  50259. -----BEGIN CERTIFICATE-----
  50260. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  50261. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  50262. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  50263. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  50264. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  50265. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  50266. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  50267. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  50268. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  50269. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  50270. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  50271. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  50272. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  50273. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  50274. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  50275. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  50276. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  50277. -----END CERTIFICATE-----
  50278. EE Certification Centre Root CA
  50279. ===============================
  50280. -----BEGIN CERTIFICATE-----
  50281. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  50282. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  50283. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  50284. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  50285. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  50286. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  50287. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  50288. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  50289. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  50290. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  50291. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  50292. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  50293. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  50294. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  50295. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  50296. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  50297. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  50298. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  50299. dcGWxZ0=
  50300. -----END CERTIFICATE-----
  50301. TURKTRUST Certificate Services Provider Root 2007
  50302. =================================================
  50303. -----BEGIN CERTIFICATE-----
  50304. MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  50305. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  50306. MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  50307. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
  50308. DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
  50309. a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
  50310. BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  50311. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
  50312. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
  50313. YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
  50314. KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
  50315. KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
  50316. rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
  50317. AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
  50318. BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
  50319. Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
  50320. aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
  50321. Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
  50322. BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
  50323. poRq0Tl9
  50324. -----END CERTIFICATE-----
  50325. D-TRUST Root Class 3 CA 2 2009
  50326. ==============================
  50327. -----BEGIN CERTIFICATE-----
  50328. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  50329. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  50330. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  50331. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  50332. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  50333. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  50334. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  50335. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  50336. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  50337. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  50338. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  50339. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  50340. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  50341. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  50342. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  50343. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  50344. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  50345. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  50346. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  50347. -----END CERTIFICATE-----
  50348. D-TRUST Root Class 3 CA 2 EV 2009
  50349. =================================
  50350. -----BEGIN CERTIFICATE-----
  50351. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  50352. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  50353. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  50354. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  50355. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  50356. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  50357. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  50358. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  50359. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  50360. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  50361. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  50362. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  50363. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  50364. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  50365. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  50366. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  50367. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  50368. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  50369. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  50370. w9y4AyHqnxbxLFS1
  50371. -----END CERTIFICATE-----
  50372. PSCProcert
  50373. ==========
  50374. -----BEGIN CERTIFICATE-----
  50375. MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
  50376. ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
  50377. MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
  50378. dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
  50379. cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
  50380. IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
  50381. MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
  50382. DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
  50383. ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
  50384. Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
  50385. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
  50386. wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
  50387. 3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
  50388. RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
  50389. EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
  50390. 0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
  50391. 0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
  50392. td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
  50393. Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
  50394. r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
  50395. AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
  50396. Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
  50397. xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
  50398. ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
  50399. EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
  50400. Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
  50401. ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
  50402. 9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
  50403. MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
  50404. LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
  50405. ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
  50406. YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
  50407. Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
  50408. dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
  50409. T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
  50410. g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
  50411. uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
  50412. n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
  50413. FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
  50414. 5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
  50415. 3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
  50416. poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
  50417. eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
  50418. -----END CERTIFICATE-----
  50419. China Internet Network Information Center EV Certificates Root
  50420. ==============================================================
  50421. -----BEGIN CERTIFICATE-----
  50422. MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV
  50423. BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D
  50424. aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg
  50425. Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG
  50426. A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM
  50427. PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl
  50428. cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y
  50429. jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV
  50430. 98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H
  50431. klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23
  50432. KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC
  50433. 7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV
  50434. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD
  50435. glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5
  50436. 0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM
  50437. 7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws
  50438. ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0
  50439. 5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8=
  50440. -----END CERTIFICATE-----
  50441. Swisscom Root CA 2
  50442. ==================
  50443. -----BEGIN CERTIFICATE-----
  50444. MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBkMQswCQYDVQQG
  50445. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  50446. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2
  50447. MjUwNzM4MTRaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  50448. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIIC
  50449. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvErjw0DzpPM
  50450. LgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r0rk0X2s682Q2zsKwzxNo
  50451. ysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJ
  50452. wDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVPACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpH
  50453. Wrumnf2U5NGKpV+GY3aFy6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1a
  50454. SgJA/MTAtukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL6yxS
  50455. NLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0uPoTXGiTOmekl9Ab
  50456. mbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrALacywlKinh/LTSlDcX3KwFnUey7QY
  50457. Ypqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velhk6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3
  50458. qPyZ7iVNTA6z00yPhOgpD/0QVAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  50459. HQYDVR0hBBYwFDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O
  50460. BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqhb97iEoHF8Twu
  50461. MA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4RfbgZPnm3qKhyN2abGu2sEzsO
  50462. v2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ
  50463. 82YqZh6NM4OKb3xuqFp1mrjX2lhIREeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLz
  50464. o9v/tdhZsnPdTSpxsrpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcs
  50465. a0vvaGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciATwoCqISxx
  50466. OQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99nBjx8Oto0QuFmtEYE3saW
  50467. mA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5Wt6NlUe07qxS/TFED6F+KBZvuim6c779o
  50468. +sjaC+NCydAXFJy3SuCvkychVSa1ZC+N8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TC
  50469. rvJcwhbtkj6EPnNgiLx29CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX
  50470. 5OfNeOI5wSsSnqaeG8XmDtkx2Q==
  50471. -----END CERTIFICATE-----
  50472. Swisscom Root EV CA 2
  50473. =====================
  50474. -----BEGIN CERTIFICATE-----
  50475. MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UE
  50476. BhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdpdGFsIENlcnRpZmljYXRlIFNl
  50477. cnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcN
  50478. MzEwNjI1MDg0NTA4WjBnMQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsT
  50479. HERpZ2l0YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYg
  50480. Q0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7BxUglgRCgz
  50481. o3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD1ycfMQ4jFrclyxy0uYAy
  50482. Xhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPHoCE2G3pXKSinLr9xJZDzRINpUKTk4Rti
  50483. GZQJo/PDvO/0vezbE53PnUgJUmfANykRHvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8Li
  50484. qG12W0OfvrSdsyaGOx9/5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaH
  50485. Za0zKcQvidm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHLOdAG
  50486. alNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaCNYGu+HuB5ur+rPQa
  50487. m3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f46Fq9mDU5zXNysRojddxyNMkM3Ox
  50488. bPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCBUWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDi
  50489. xzgHcgplwLa7JSnaFp6LNYth7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/
  50490. BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED
  50491. MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB
  50492. bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL
  50493. j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU
  50494. wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7
  50495. XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH
  50496. 59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/
  50497. 23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq
  50498. J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA
  50499. HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi
  50500. uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW
  50501. l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc=
  50502. -----END CERTIFICATE-----
  50503. CA Disig Root R1
  50504. ================
  50505. -----BEGIN CERTIFICATE-----
  50506. MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
  50507. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  50508. ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
  50509. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  50510. c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
  50511. 3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
  50512. u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
  50513. m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
  50514. CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
  50515. YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
  50516. vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
  50517. LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
  50518. ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
  50519. XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
  50520. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
  50521. 04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
  50522. xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
  50523. LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
  50524. CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
  50525. VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
  50526. YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
  50527. ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
  50528. lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
  50529. UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
  50530. a7+h89n07eLw4+1knj0vllJPgFOL
  50531. -----END CERTIFICATE-----
  50532. CA Disig Root R2
  50533. ================
  50534. -----BEGIN CERTIFICATE-----
  50535. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  50536. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  50537. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  50538. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  50539. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  50540. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  50541. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  50542. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  50543. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  50544. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  50545. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  50546. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  50547. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  50548. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  50549. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  50550. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  50551. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  50552. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  50553. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  50554. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  50555. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  50556. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  50557. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  50558. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  50559. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  50560. -----END CERTIFICATE-----
  50561. ACCVRAIZ1
  50562. =========
  50563. -----BEGIN CERTIFICATE-----
  50564. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  50565. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  50566. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  50567. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50568. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  50569. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  50570. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  50571. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  50572. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  50573. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  50574. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  50575. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  50576. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  50577. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  50578. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  50579. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  50580. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  50581. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  50582. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  50583. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  50584. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  50585. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  50586. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  50587. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  50588. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  50589. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  50590. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  50591. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  50592. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  50593. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  50594. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  50595. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  50596. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  50597. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  50598. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  50599. EfbRD0tVNEYqi4Y7
  50600. -----END CERTIFICATE-----
  50601. TWCA Global Root CA
  50602. ===================
  50603. -----BEGIN CERTIFICATE-----
  50604. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  50605. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  50606. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  50607. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  50608. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  50609. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  50610. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  50611. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  50612. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  50613. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  50614. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  50615. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  50616. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  50617. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  50618. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  50619. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  50620. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  50621. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  50622. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  50623. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  50624. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  50625. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  50626. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  50627. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  50628. -----END CERTIFICATE-----
  50629. TeliaSonera Root CA v1
  50630. ======================
  50631. -----BEGIN CERTIFICATE-----
  50632. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  50633. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  50634. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  50635. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  50636. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  50637. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  50638. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  50639. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  50640. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  50641. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  50642. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  50643. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  50644. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  50645. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  50646. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  50647. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  50648. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  50649. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  50650. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  50651. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  50652. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  50653. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  50654. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  50655. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  50656. -----END CERTIFICATE-----
  50657. E-Tugra Certification Authority
  50658. ===============================
  50659. -----BEGIN CERTIFICATE-----
  50660. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  50661. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  50662. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  50663. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  50664. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  50665. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  50666. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  50667. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  50668. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  50669. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  50670. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  50671. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  50672. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  50673. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  50674. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  50675. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  50676. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  50677. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  50678. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  50679. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  50680. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  50681. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  50682. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  50683. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  50684. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  50685. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  50686. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  50687. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  50688. C7TbO6Orb1wdtn7os4I07QZcJA==
  50689. -----END CERTIFICATE-----
  50690. T-TeleSec GlobalRoot Class 2
  50691. ============================
  50692. -----BEGIN CERTIFICATE-----
  50693. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  50694. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  50695. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  50696. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  50697. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  50698. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  50699. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  50700. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  50701. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  50702. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  50703. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  50704. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  50705. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  50706. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  50707. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  50708. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  50709. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  50710. -----END CERTIFICATE-----
  50711. Atos TrustedRoot 2011
  50712. =====================
  50713. -----BEGIN CERTIFICATE-----
  50714. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  50715. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  50716. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  50717. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  50718. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  50719. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  50720. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  50721. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  50722. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  50723. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  50724. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  50725. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  50726. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  50727. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  50728. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  50729. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  50730. -----END CERTIFICATE-----
  50731. QuoVadis Root CA 1 G3
  50732. =====================
  50733. -----BEGIN CERTIFICATE-----
  50734. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  50735. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  50736. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  50737. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  50738. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  50739. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  50740. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  50741. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  50742. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  50743. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  50744. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  50745. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  50746. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  50747. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  50748. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  50749. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  50750. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  50751. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  50752. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  50753. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  50754. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  50755. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  50756. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  50757. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  50758. hMJKzRwuJIczYOXD
  50759. -----END CERTIFICATE-----
  50760. QuoVadis Root CA 2 G3
  50761. =====================
  50762. -----BEGIN CERTIFICATE-----
  50763. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  50764. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  50765. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  50766. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  50767. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  50768. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  50769. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  50770. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  50771. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  50772. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  50773. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  50774. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  50775. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  50776. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  50777. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  50778. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  50779. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  50780. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  50781. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  50782. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  50783. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  50784. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  50785. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  50786. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  50787. O3jtZsSOeWmD3n+M
  50788. -----END CERTIFICATE-----
  50789. QuoVadis Root CA 3 G3
  50790. =====================
  50791. -----BEGIN CERTIFICATE-----
  50792. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  50793. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  50794. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  50795. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  50796. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  50797. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  50798. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  50799. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  50800. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  50801. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  50802. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  50803. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  50804. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  50805. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  50806. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  50807. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  50808. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  50809. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  50810. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  50811. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  50812. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  50813. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  50814. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  50815. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  50816. PpxxVJkES/1Y+Zj0
  50817. -----END CERTIFICATE-----
  50818. DigiCert Assured ID Root G2
  50819. ===========================
  50820. -----BEGIN CERTIFICATE-----
  50821. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  50822. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  50823. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  50824. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  50825. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  50826. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  50827. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  50828. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  50829. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  50830. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  50831. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  50832. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  50833. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  50834. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  50835. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  50836. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  50837. IhNzbM8m9Yop5w==
  50838. -----END CERTIFICATE-----
  50839. DigiCert Assured ID Root G3
  50840. ===========================
  50841. -----BEGIN CERTIFICATE-----
  50842. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  50843. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  50844. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  50845. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  50846. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  50847. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  50848. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  50849. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  50850. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  50851. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  50852. 1vUhZscv6pZjamVFkpUBtA==
  50853. -----END CERTIFICATE-----
  50854. DigiCert Global Root G2
  50855. =======================
  50856. -----BEGIN CERTIFICATE-----
  50857. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  50858. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  50859. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  50860. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  50861. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  50862. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  50863. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  50864. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  50865. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  50866. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  50867. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  50868. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  50869. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  50870. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  50871. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  50872. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  50873. MrY=
  50874. -----END CERTIFICATE-----
  50875. DigiCert Global Root G3
  50876. =======================
  50877. -----BEGIN CERTIFICATE-----
  50878. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  50879. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  50880. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  50881. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  50882. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  50883. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  50884. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  50885. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  50886. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  50887. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  50888. VOKa5Vt8sycX
  50889. -----END CERTIFICATE-----
  50890. DigiCert Trusted Root G4
  50891. ========================
  50892. -----BEGIN CERTIFICATE-----
  50893. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  50894. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  50895. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  50896. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  50897. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  50898. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  50899. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  50900. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  50901. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  50902. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  50903. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  50904. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  50905. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  50906. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  50907. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  50908. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  50909. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  50910. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  50911. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  50912. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  50913. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  50914. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  50915. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  50916. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  50917. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  50918. 82Z+
  50919. -----END CERTIFICATE-----
  50920. WoSign
  50921. ======
  50922. -----BEGIN CERTIFICATE-----
  50923. MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
  50924. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
  50925. QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
  50926. BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
  50927. dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
  50928. vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
  50929. CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
  50930. 2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
  50931. KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
  50932. +ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
  50933. EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
  50934. lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
  50935. 8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
  50936. yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
  50937. AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
  50938. 8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
  50939. LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
  50940. T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
  50941. y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
  50942. 2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
  50943. 5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
  50944. EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
  50945. mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
  50946. kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
  50947. kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
  50948. -----END CERTIFICATE-----
  50949. WoSign China
  50950. ============
  50951. -----BEGIN CERTIFICATE-----
  50952. MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
  50953. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
  50954. geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
  50955. VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
  50956. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
  50957. 8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
  50958. uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
  50959. dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
  50960. Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
  50961. b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
  50962. 76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
  50963. +Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
  50964. yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
  50965. GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
  50966. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
  50967. A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
  50968. yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
  50969. r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
  50970. j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
  50971. kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
  50972. qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
  50973. jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
  50974. ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
  50975. T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
  50976. kI26oQ==
  50977. -----END CERTIFICATE-----
  50978. COMODO RSA Certification Authority
  50979. ==================================
  50980. -----BEGIN CERTIFICATE-----
  50981. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  50982. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  50983. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  50984. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  50985. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  50986. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  50987. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  50988. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  50989. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  50990. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  50991. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  50992. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  50993. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  50994. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  50995. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  50996. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  50997. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  50998. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  50999. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  51000. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  51001. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  51002. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  51003. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  51004. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  51005. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  51006. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  51007. LaZRfyHBNVOFBkpdn627G190
  51008. -----END CERTIFICATE-----
  51009. USERTrust RSA Certification Authority
  51010. =====================================
  51011. -----BEGIN CERTIFICATE-----
  51012. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  51013. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  51014. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  51015. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  51016. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  51017. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  51018. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  51019. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  51020. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  51021. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  51022. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  51023. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  51024. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  51025. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  51026. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  51027. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  51028. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  51029. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  51030. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  51031. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  51032. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  51033. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  51034. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  51035. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  51036. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  51037. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  51038. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  51039. -----END CERTIFICATE-----
  51040. USERTrust ECC Certification Authority
  51041. =====================================
  51042. -----BEGIN CERTIFICATE-----
  51043. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  51044. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  51045. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  51046. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  51047. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  51048. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  51049. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  51050. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  51051. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  51052. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  51053. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  51054. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  51055. -----END CERTIFICATE-----
  51056. GlobalSign ECC Root CA - R4
  51057. ===========================
  51058. -----BEGIN CERTIFICATE-----
  51059. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  51060. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51061. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  51062. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51063. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  51064. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  51065. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  51066. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  51067. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  51068. -----END CERTIFICATE-----
  51069. GlobalSign ECC Root CA - R5
  51070. ===========================
  51071. -----BEGIN CERTIFICATE-----
  51072. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  51073. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51074. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  51075. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51076. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  51077. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  51078. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  51079. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  51080. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  51081. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  51082. -----END CERTIFICATE-----
  51083. Staat der Nederlanden Root CA - G3
  51084. ==================================
  51085. -----BEGIN CERTIFICATE-----
  51086. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51087. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51088. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  51089. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  51090. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  51091. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  51092. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  51093. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  51094. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  51095. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  51096. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  51097. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  51098. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  51099. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  51100. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  51101. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  51102. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  51103. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  51104. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  51105. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  51106. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  51107. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  51108. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  51109. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  51110. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  51111. -----END CERTIFICATE-----
  51112. Staat der Nederlanden EV Root CA
  51113. ================================
  51114. -----BEGIN CERTIFICATE-----
  51115. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51116. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51117. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  51118. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  51119. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  51120. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  51121. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  51122. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  51123. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  51124. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  51125. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  51126. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  51127. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  51128. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  51129. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  51130. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  51131. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  51132. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  51133. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  51134. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  51135. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  51136. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  51137. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  51138. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  51139. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  51140. -----END CERTIFICATE-----
  51141. IdenTrust Commercial Root CA 1
  51142. ==============================
  51143. -----BEGIN CERTIFICATE-----
  51144. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  51145. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  51146. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  51147. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  51148. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  51149. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  51150. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  51151. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  51152. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  51153. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  51154. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  51155. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  51156. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  51157. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  51158. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  51159. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  51160. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  51161. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  51162. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  51163. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  51164. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  51165. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  51166. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  51167. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  51168. cGzM7vRX+Bi6hG6H
  51169. -----END CERTIFICATE-----
  51170. IdenTrust Public Sector Root CA 1
  51171. =================================
  51172. -----BEGIN CERTIFICATE-----
  51173. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  51174. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  51175. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  51176. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  51177. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  51178. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  51179. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  51180. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  51181. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  51182. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  51183. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  51184. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  51185. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  51186. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  51187. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  51188. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  51189. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  51190. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  51191. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  51192. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  51193. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  51194. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  51195. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  51196. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  51197. 3Wl9af0AVqW3rLatt8o+Ae+c
  51198. -----END CERTIFICATE-----
  51199. Entrust Root Certification Authority - G2
  51200. =========================================
  51201. -----BEGIN CERTIFICATE-----
  51202. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  51203. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  51204. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  51205. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  51206. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  51207. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  51208. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  51209. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  51210. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  51211. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  51212. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  51213. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  51214. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  51215. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  51216. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  51217. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  51218. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  51219. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  51220. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  51221. e4pIb4tF9g==
  51222. -----END CERTIFICATE-----
  51223. Entrust Root Certification Authority - EC1
  51224. ==========================================
  51225. -----BEGIN CERTIFICATE-----
  51226. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  51227. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  51228. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  51229. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51230. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  51231. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  51232. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  51233. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  51234. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  51235. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  51236. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  51237. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  51238. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  51239. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  51240. -----END CERTIFICATE-----
  51241. CFCA EV ROOT
  51242. ============
  51243. -----BEGIN CERTIFICATE-----
  51244. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  51245. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  51246. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  51247. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  51248. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  51249. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  51250. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  51251. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  51252. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  51253. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  51254. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  51255. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  51256. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  51257. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  51258. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  51259. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  51260. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  51261. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  51262. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  51263. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  51264. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  51265. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  51266. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  51267. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  51268. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  51269. -----END CERTIFICATE-----
  51270. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  51271. ====================================================
  51272. -----BEGIN CERTIFICATE-----
  51273. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  51274. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  51275. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  51276. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  51277. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  51278. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  51279. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  51280. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51281. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  51282. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  51283. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  51284. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  51285. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  51286. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  51287. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  51288. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  51289. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  51290. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  51291. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  51292. -----END CERTIFICATE-----
  51293. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6
  51294. ====================================================
  51295. -----BEGIN CERTIFICATE-----
  51296. MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQGEwJUUjEPMA0G
  51297. A1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
  51298. acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBF
  51299. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5
  51300. MDQxMFoXDTIzMTIxNjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBL
  51301. BgNVBAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2ZW5sacSf
  51302. aSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVsZWt0cm9uaWsgU2VydGlm
  51303. aWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  51304. AoIBAQCdsGjW6L0UlqMACprx9MfMkU1xeHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a
  51305. 2uqsxgbPJQ1BgfbBOCK9+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EED
  51306. wnS3/faAz1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0pu5Fb
  51307. HH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6plVxiSvgNZ1GpryHV
  51308. +DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMBAAGjQjBAMB0GA1UdDgQWBBTdVRcT
  51309. 9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG
  51310. 9w0BAQsFAAOCAQEAb1gNl0OqFlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3R
  51311. fdCaqaXKGDsCQC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy
  51312. o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKIDgI6tflEATseW
  51313. hvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm9ocJV612ph1jmv3XZch4gyt1
  51314. O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsGtAuYSyher4hYyw==
  51315. -----END CERTIFICATE-----
  51316. Certinomis - Root CA
  51317. ====================
  51318. -----BEGIN CERTIFICATE-----
  51319. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  51320. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  51321. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  51322. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  51323. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  51324. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  51325. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  51326. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  51327. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  51328. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  51329. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  51330. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  51331. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  51332. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  51333. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  51334. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  51335. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  51336. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  51337. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  51338. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  51339. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  51340. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  51341. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  51342. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  51343. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  51344. hkIGuUE=
  51345. -----END CERTIFICATE-----
  51346. OISTE WISeKey Global Root GB CA
  51347. ===============================
  51348. -----BEGIN CERTIFICATE-----
  51349. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  51350. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  51351. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  51352. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  51353. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  51354. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  51355. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  51356. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  51357. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  51358. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  51359. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  51360. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  51361. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  51362. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  51363. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  51364. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  51365. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  51366. -----END CERTIFICATE-----
  51367. Certification Authority of WoSign G2
  51368. ====================================
  51369. -----BEGIN CERTIFICATE-----
  51370. MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG
  51371. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g
  51372. QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx
  51373. CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm
  51374. aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51375. CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai
  51376. XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du
  51377. W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9
  51378. 5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK
  51379. v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  51380. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI
  51381. hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY
  51382. P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3
  51383. TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu
  51384. +sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+
  51385. 7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg=
  51386. -----END CERTIFICATE-----
  51387. CA WoSign ECC Root
  51388. ==================
  51389. -----BEGIN CERTIFICATE-----
  51390. MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD
  51391. TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v
  51392. dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK
  51393. ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI
  51394. zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU
  51395. t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw
  51396. QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R
  51397. MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
  51398. Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
  51399. a/GRspBl9JrmkO5K
  51400. -----END CERTIFICATE-----
  51401. SZAFIR ROOT CA2
  51402. ===============
  51403. -----BEGIN CERTIFICATE-----
  51404. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  51405. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  51406. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  51407. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  51408. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  51409. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  51410. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  51411. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  51412. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  51413. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  51414. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  51415. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  51416. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  51417. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  51418. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  51419. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  51420. -----END CERTIFICATE-----
  51421. Certum Trusted Network CA 2
  51422. ===========================
  51423. -----BEGIN CERTIFICATE-----
  51424. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  51425. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  51426. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  51427. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  51428. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  51429. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  51430. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  51431. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  51432. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  51433. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  51434. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  51435. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  51436. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  51437. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  51438. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  51439. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51440. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  51441. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  51442. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  51443. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  51444. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  51445. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  51446. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  51447. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  51448. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  51449. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  51450. zAYspsbiDrW5viSP
  51451. -----END CERTIFICATE-----
  51452. Hellenic Academic and Research Institutions RootCA 2015
  51453. =======================================================
  51454. -----BEGIN CERTIFICATE-----
  51455. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  51456. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  51457. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  51458. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  51459. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  51460. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  51461. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  51462. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  51463. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  51464. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  51465. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  51466. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  51467. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  51468. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  51469. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  51470. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  51471. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51472. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  51473. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  51474. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  51475. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  51476. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  51477. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  51478. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  51479. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  51480. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  51481. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  51482. p/UsQu0yrbYhnr68
  51483. -----END CERTIFICATE-----
  51484. Hellenic Academic and Research Institutions ECC RootCA 2015
  51485. ===========================================================
  51486. -----BEGIN CERTIFICATE-----
  51487. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  51488. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  51489. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  51490. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  51491. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  51492. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  51493. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  51494. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  51495. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  51496. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  51497. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  51498. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  51499. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  51500. -----END CERTIFICATE-----
  51501. Certplus Root CA G1
  51502. ===================
  51503. -----BEGIN CERTIFICATE-----
  51504. MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
  51505. BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
  51506. Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
  51507. ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
  51508. ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
  51509. r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
  51510. Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
  51511. BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
  51512. LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
  51513. z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
  51514. 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
  51515. 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
  51516. jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
  51517. ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
  51518. A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
  51519. lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
  51520. 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
  51521. YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
  51522. 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
  51523. 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
  51524. CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
  51525. tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
  51526. VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
  51527. +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
  51528. qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
  51529. -----END CERTIFICATE-----
  51530. Certplus Root CA G2
  51531. ===================
  51532. -----BEGIN CERTIFICATE-----
  51533. MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
  51534. AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
  51535. NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
  51536. cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  51537. BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
  51538. Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
  51539. AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
  51540. IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
  51541. HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
  51542. vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
  51543. -----END CERTIFICATE-----
  51544. OpenTrust Root CA G1
  51545. ====================
  51546. -----BEGIN CERTIFICATE-----
  51547. MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
  51548. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
  51549. MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  51550. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
  51551. AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
  51552. Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
  51553. ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
  51554. YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
  51555. xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
  51556. 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
  51557. 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
  51558. n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
  51559. URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
  51560. TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  51561. /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
  51562. N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
  51563. PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
  51564. uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
  51565. n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
  51566. X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
  51567. nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
  51568. GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
  51569. bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
  51570. 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
  51571. OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
  51572. -----END CERTIFICATE-----
  51573. OpenTrust Root CA G2
  51574. ====================
  51575. -----BEGIN CERTIFICATE-----
  51576. MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
  51577. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
  51578. MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  51579. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
  51580. AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
  51581. Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
  51582. 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
  51583. eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
  51584. UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
  51585. 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
  51586. 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
  51587. 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
  51588. 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
  51589. y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  51590. /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
  51591. M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
  51592. Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
  51593. mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
  51594. S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
  51595. EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
  51596. 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
  51597. gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
  51598. SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
  51599. YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
  51600. u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
  51601. -----END CERTIFICATE-----
  51602. OpenTrust Root CA G3
  51603. ====================
  51604. -----BEGIN CERTIFICATE-----
  51605. MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
  51606. AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
  51607. DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
  51608. ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
  51609. IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
  51610. ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
  51611. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
  51612. BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
  51613. BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
  51614. 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
  51615. -----END CERTIFICATE-----
  51616. ISRG Root X1
  51617. ============
  51618. -----BEGIN CERTIFICATE-----
  51619. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  51620. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  51621. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  51622. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  51623. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  51624. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  51625. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  51626. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  51627. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  51628. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  51629. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  51630. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  51631. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  51632. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  51633. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  51634. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  51635. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  51636. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  51637. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  51638. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  51639. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  51640. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  51641. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  51642. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  51643. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  51644. -----END CERTIFICATE-----
  51645. <?php
  51646. if (PHP_SAPI !== 'cli') {
  51647. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  51648. }
  51649. require __DIR__.'/../src/bootstrap.php';
  51650. use Composer\Factory;
  51651. use Composer\XdebugHandler;
  51652. use Composer\Console\Application;
  51653. error_reporting(-1);
  51654. // Create output for XdebugHandler and Application
  51655. $output = Factory::createOutput();
  51656. $xdebug = new XdebugHandler($output);
  51657. $xdebug->check();
  51658. unset($xdebug);
  51659. if (function_exists('ini_set')) {
  51660. @ini_set('display_errors', 1);
  51661. $memoryInBytes = function ($value) {
  51662. $unit = strtolower(substr($value, -1, 1));
  51663. $value = (int) $value;
  51664. switch($unit) {
  51665. case 'g':
  51666. $value *= 1024;
  51667. // no break (cumulative multiplier)
  51668. case 'm':
  51669. $value *= 1024;
  51670. // no break (cumulative multiplier)
  51671. case 'k':
  51672. $value *= 1024;
  51673. }
  51674. return $value;
  51675. };
  51676. $memoryLimit = trim(ini_get('memory_limit'));
  51677. // Increase memory_limit if it is lower than 1.5GB
  51678. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  51679. @ini_set('memory_limit', '1536M');
  51680. }
  51681. unset($memoryInBytes, $memoryLimit);
  51682. }
  51683. // run the command application
  51684. $application = new Application();
  51685. $application->run(null, $output);
  51686. Copyright (c) 2016 Nils Adermann, Jordi Boggiano
  51687. Permission is hereby granted, free of charge, to any person obtaining a copy
  51688. of this software and associated documentation files (the "Software"), to deal
  51689. in the Software without restriction, including without limitation the rights
  51690. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51691. copies of the Software, and to permit persons to whom the Software is furnished
  51692. to do so, subject to the following conditions:
  51693. The above copyright notice and this permission notice shall be included in all
  51694. copies or substantial portions of the Software.
  51695. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51696. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51697. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51698. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51699. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51700. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51701. THE SOFTWARE.
  51702. ,ÕÔ‚B-êWjæbÌ/P�ÏÀ���GBMB